Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
9a8f28d6
Commit
9a8f28d6
authored
Dec 25, 2013
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag treeをcache
parent
0f92598d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
+5
-1
app/helpers/posts_helper.rb
+3
-1
app/views/posts/index.html.erb
+2
-0
No files found.
app/helpers/posts_helper.rb
View file @
9a8f28d6
...
...
@@ -3,7 +3,9 @@ module PostsHelper
# @param {ActiveRecord::Relation} node
def
h_display_tree
(
node
)
_html
=
'<ul>'
_html
<<
%Q{<li><a href="
#{
root_path
(
q:
'#'
+
node
.
name
)
}
">
#{
node
.
name
}
<span class="badge">
#{
node
.
post_tags
.
count
}
</span></a></li>}
if
node
.
posts
.
count
>
0
_html
<<
%Q{<li><a href="
#{
root_path
(
q:
'#'
+
node
.
name
)
}
">
#{
node
.
name
}
<span class="badge">
#{
node
.
posts
.
count
}
</span></a></li>}
end
node
.
children
.
each
do
|
_child
|
_html
<<
h_display_tree
(
_child
)
end
...
...
app/views/posts/index.html.erb
View file @
9a8f28d6
...
...
@@ -15,11 +15,13 @@
<%
end
%>
</div>
<%
cache
(
'tag-tree'
,
:expires_in
=>
1
.
hour
)
do
%>
<div
class=
"list-group"
>
<%
Tag
.
roots
.
each
do
|
root
|
%>
<%=
h_display_tree
(
root
)
%>
<%
end
%>
</div>
<%
end
%>
</div>
<!--/span-->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment