Commit af7bed2aa5476ca6f359f0b0c67f46151b5db9b9

Authored by Aleksei Kvitinskii
1 parent 060a2e22

add tag links to project page

app/assets/stylesheets/tags.css.css
... ... @@ -27,4 +27,18 @@
27 27 color: #FFF;
28 28 text-shadow: none;
29 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 45 \ No newline at end of file
... ...
app/helpers/tags_helper.rb
... ... @@ -2,4 +2,14 @@ module TagsHelper
2 2 def tag_path tag
3 3 "/tags/#{tag}"
4 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 15 end
... ...
app/views/layouts/project.html.haml
... ... @@ -39,6 +39,9 @@
39 39 %span{ :class => "number" }= @project.snippets.non_expired.count
40 40 - if @commit
41 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 46 .project-content
44 47 = yield
... ...
app/views/projects/_list.html.haml
... ... @@ -12,9 +12,8 @@
12 12 %tr{ :class => "project", :url => project_path(project) }
13 13 %td
14 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 18 %td= truncate project.url_to_repo
20 19 %td= project.code
... ...
app/views/projects/_tile.html.haml
... ... @@ -13,9 +13,7 @@
13 13 - last_note = project.notes.last
14 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 18 .buttons
21 19 %a.browse-code.button.yellow{:href => tree_project_path(project)} Browse code
... ...