Commit 1d85197b08346c99e6015cb25b31f8fd10f4100f

Authored by Aleksei Kvitinskii
2 parents 5b1634cd 1fa01cbc

Merge branch 'issue-184' into dev

Conflicts:
	app/views/layouts/project.html.haml
	app/views/projects/_form.html.haml
app/assets/javascripts/projects.js
... ... @@ -40,3 +40,19 @@ $(document).ready(function(){
40 40 function focusSearch() {
41 41 $("#search").focus();
42 42 }
  43 +
  44 +function taggifyForm(){
  45 + var tag_field = $('#tag_field').tagify();
  46 +
  47 + tag_field.tagify('inputField').autocomplete({
  48 + source: '/tags.json'
  49 + });
  50 +
  51 +
  52 + $('form').submit( function() {
  53 + var tag_field = $('#tag_field')
  54 + tag_field.val( tag_field.tagify('serialize') );
  55 + return true;
  56 + });
  57 +}
  58 +
... ...
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 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +module TagsHelper
  2 + def tag_path tag
  3 + "/tags/#{tag}"
  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 +
  15 +end
... ...
app/views/admin/projects/_form.html.haml
1 1 = form_for [:admin, @admin_project] do |f|
2 2 -if @admin_project.errors.any?
3 3 #error_explanation
4   - %h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
  4 + %h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
5 5 %ul
6 6 - @admin_project.errors.full_messages.each do |msg|
7 7 %li= msg
8 8  
9   - .span-24
10   - .span-12
11   - .field
12   - = f.label :name
13   - %br
14   - = f.text_field :name
15   - .field
16   - = f.label :code
17   - %br
18   - = f.text_field :code
19   - .field
20   - = f.label :path
21   - %br
22   - = f.text_field :path
23   - .span-10
24   - .field
25   - = f.label :description
26   - %br
27   - = f.text_area :description
  9 + .form-row
  10 + = f.label :name
  11 + %br
  12 + = f.text_field :name
  13 + .form-row
  14 + = f.label :code
  15 + %br
  16 + = f.text_field :code
  17 + .form-row
  18 + = f.label :path
  19 + %br
  20 + = f.text_field :path
  21 +
  22 +
  23 + .form-row
  24 + = f.label :tag_list
  25 + %br
  26 + = f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
  27 +
  28 + .form-row
  29 + = f.label :description
  30 + %br
  31 + = f.text_area :description
28 32 .clear
29 33 .actions
30 34 = f.submit 'Save', :class => "lbutton"
  35 +
  36 +:javascript
  37 + $(function(){
  38 + taggifyForm();
  39 + })
... ...
app/views/layouts/project.html.haml
... ... @@ -40,5 +40,7 @@
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 42  
  43 + .medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project
  44 +
43 45 .project-content
44 46 = yield
... ...
app/views/projects/_form.html.haml
... ... @@ -55,16 +55,5 @@
55 55  
56 56 :javascript
57 57 $(function(){
58   - var tag_field = $('#tag_field').tagify();
59   -
60   - tag_field.tagify('inputField').autocomplete({
61   - source: '/tags.json'
62   - });
63   -
64   -
65   - $('form').submit( function() {
66   - var tag_field = $('#tag_field')
67   - tag_field.val( tag_field.tagify('serialize') );
68   - return true;
69   - });
  58 + taggifyForm();
70 59 })
... ...
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, "/tags/#{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
... ...
app/views/tags/index.html.haml
... ... @@ -7,5 +7,5 @@
7 7  
8 8 .tags-list
9 9 - @tags.all.each do |tag|
10   - = link_to "#{tag.name}(#{tag.count})", "/tags/#{tag.name}"
  10 + = link_to "#{tag.name}(#{tag.count})", tag_path(name)
11 11  
... ...