From af7bed2aa5476ca6f359f0b0c67f46151b5db9b9 Mon Sep 17 00:00:00 2001 From: Aleksei Kvitinskii Date: Mon, 7 Nov 2011 19:48:58 +0200 Subject: [PATCH] add tag links to project page --- app/assets/stylesheets/tags.css.css | 14 ++++++++++++++ app/helpers/tags_helper.rb | 10 ++++++++++ app/views/layouts/project.html.haml | 3 +++ app/views/projects/_list.html.haml | 5 ++--- app/views/projects/_tile.html.haml | 4 +--- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/tags.css.css b/app/assets/stylesheets/tags.css.css index afd458fd..e65918ea 100644 --- a/app/assets/stylesheets/tags.css.css +++ b/app/assets/stylesheets/tags.css.css @@ -27,4 +27,18 @@ color: #FFF; text-shadow: none; font-weight: bold; +} + + +.medium-tags a{ + font-size: 12px; + + display: inline-block; + padding: 3px 4px 2px 4px; + margin: 0px 7px 8px 0px; + border-radius: 3px; + background-color: #72bbdf; + color: #FFF; + text-shadow: none; + font-weight: bold; } \ No newline at end of file diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 1e82e34d..5c1ecc86 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -2,4 +2,14 @@ module TagsHelper def tag_path tag "/tags/#{tag}" end + + def tag_list project + html = '' + project.tag_list.each do |tag| + html += link_to tag, tag_path(tag) + end + + html.html_safe + end + end diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index ee6581ec..70ebb890 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -39,6 +39,9 @@ %span{ :class => "number" }= @project.snippets.non_expired.count - if @commit = 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 + + .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project + .project-content = yield diff --git a/app/views/projects/_list.html.haml b/app/views/projects/_list.html.haml index 89deb76d..f41fb3e4 100644 --- a/app/views/projects/_list.html.haml +++ b/app/views/projects/_list.html.haml @@ -12,9 +12,8 @@ %tr{ :class => "project", :url => project_path(project) } %td = project.name - .small-tags - - project.tag_list.each do |tag| - = link_to tag, tag_path(tag) + .small-tags= tag_list project + %td= truncate project.url_to_repo %td= project.code diff --git a/app/views/projects/_tile.html.haml b/app/views/projects/_tile.html.haml index cc891f63..1f2a4a97 100644 --- a/app/views/projects/_tile.html.haml +++ b/app/views/projects/_tile.html.haml @@ -13,9 +13,7 @@ - last_note = project.notes.last = last_note ? last_note.created_at.stamp("24 Aug, 2011") : "Never" - %p.small-tags - - project.tag_list.each do |tag| - = link_to tag, "/tags/#{tag}" + %p.small-tags= tag_list project .buttons %a.browse-code.button.yellow{:href => tree_project_path(project)} Browse code