Commit af7bed2aa5476ca6f359f0b0c67f46151b5db9b9
1 parent
060a2e22
Exists in
master
and in
4 other branches
add tag links to project page
Showing
5 changed files
with
30 additions
and
6 deletions
Show diff stats
app/assets/stylesheets/tags.css.css
| @@ -27,4 +27,18 @@ | @@ -27,4 +27,18 @@ | ||
| 27 | color: #FFF; | 27 | color: #FFF; |
| 28 | text-shadow: none; | 28 | text-shadow: none; |
| 29 | font-weight: bold; | 29 | font-weight: bold; |
| 30 | +} | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +.medium-tags a{ | ||
| 34 | + font-size: 12px; | ||
| 35 | + | ||
| 36 | + display: inline-block; | ||
| 37 | + padding: 3px 4px 2px 4px; | ||
| 38 | + margin: 0px 7px 8px 0px; | ||
| 39 | + border-radius: 3px; | ||
| 40 | + background-color: #72bbdf; | ||
| 41 | + color: #FFF; | ||
| 42 | + text-shadow: none; | ||
| 43 | + font-weight: bold; | ||
| 30 | } | 44 | } |
| 31 | \ No newline at end of file | 45 | \ No newline at end of file |
app/helpers/tags_helper.rb
| @@ -2,4 +2,14 @@ module TagsHelper | @@ -2,4 +2,14 @@ module TagsHelper | ||
| 2 | def tag_path tag | 2 | def tag_path tag |
| 3 | "/tags/#{tag}" | 3 | "/tags/#{tag}" |
| 4 | end | 4 | end |
| 5 | + | ||
| 6 | + def tag_list project | ||
| 7 | + html = '' | ||
| 8 | + project.tag_list.each do |tag| | ||
| 9 | + html += link_to tag, tag_path(tag) | ||
| 10 | + end | ||
| 11 | + | ||
| 12 | + html.html_safe | ||
| 13 | + end | ||
| 14 | + | ||
| 5 | end | 15 | end |
app/views/layouts/project.html.haml
| @@ -39,6 +39,9 @@ | @@ -39,6 +39,9 @@ | ||
| 39 | %span{ :class => "number" }= @project.snippets.non_expired.count | 39 | %span{ :class => "number" }= @project.snippets.non_expired.count |
| 40 | - if @commit | 40 | - if @commit |
| 41 | = link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil | 41 | = link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil |
| 42 | + | ||
| 43 | + .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project | ||
| 44 | + | ||
| 42 | 45 | ||
| 43 | .project-content | 46 | .project-content |
| 44 | = yield | 47 | = yield |
app/views/projects/_list.html.haml
| @@ -12,9 +12,8 @@ | @@ -12,9 +12,8 @@ | ||
| 12 | %tr{ :class => "project", :url => project_path(project) } | 12 | %tr{ :class => "project", :url => project_path(project) } |
| 13 | %td | 13 | %td |
| 14 | = project.name | 14 | = project.name |
| 15 | - .small-tags | ||
| 16 | - - project.tag_list.each do |tag| | ||
| 17 | - = link_to tag, tag_path(tag) | 15 | + .small-tags= tag_list project |
| 16 | + | ||
| 18 | 17 | ||
| 19 | %td= truncate project.url_to_repo | 18 | %td= truncate project.url_to_repo |
| 20 | %td= project.code | 19 | %td= project.code |
app/views/projects/_tile.html.haml
| @@ -13,9 +13,7 @@ | @@ -13,9 +13,7 @@ | ||
| 13 | - last_note = project.notes.last | 13 | - last_note = project.notes.last |
| 14 | = last_note ? last_note.created_at.stamp("24 Aug, 2011") : "Never" | 14 | = last_note ? last_note.created_at.stamp("24 Aug, 2011") : "Never" |
| 15 | 15 | ||
| 16 | - %p.small-tags | ||
| 17 | - - project.tag_list.each do |tag| | ||
| 18 | - = link_to tag, "/tags/#{tag}" | 16 | + %p.small-tags= tag_list project |
| 19 | 17 | ||
| 20 | .buttons | 18 | .buttons |
| 21 | %a.browse-code.button.yellow{:href => tree_project_path(project)} Browse code | 19 | %a.browse-code.button.yellow{:href => tree_project_path(project)} Browse code |