Commit b946da44695c9c8fe8867bb87bcdf801c52177d3
1 parent
6977150f
Exists in
master
and in
4 other branches
added tags to form
Showing
4 changed files
with
37 additions
and
1 deletions
Show diff stats
app/assets/javascripts/application.js
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | //= require jquery-ui | 8 | //= require jquery-ui |
9 | //= require jquery_ujs | 9 | //= require jquery_ujs |
10 | //= require jquery.ui.selectmenu | 10 | //= require jquery.ui.selectmenu |
11 | +//= require jquery.tagify | ||
11 | //= require jquery.cookie | 12 | //= require jquery.cookie |
12 | //= require_tree . | 13 | //= require_tree . |
13 | 14 |
app/assets/stylesheets/application.css
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | * the top of the compiled file, but it's generally better to create a new file per style scope. | 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. |
5 | *= require jquery-ui/jquery-ui | 5 | *= require jquery-ui/jquery-ui |
6 | *= require jquery-ui/jquery.ui.selectmenu | 6 | *= require jquery-ui/jquery.ui.selectmenu |
7 | + *= require jquery-ui/jquery.tagify | ||
7 | *= require_self | 8 | *= require_self |
8 | *= require_tree . | 9 | *= require_tree . |
9 | */ | 10 | */ |
app/views/projects/_form.html.haml
@@ -25,6 +25,11 @@ | @@ -25,6 +25,11 @@ | ||
25 | .left= f.label :code | 25 | .left= f.label :code |
26 | %cite.right http://yourserver/ | 26 | %cite.right http://yourserver/ |
27 | %td= f.text_field :code, :placeholder => "example" | 27 | %td= f.text_field :code, :placeholder => "example" |
28 | + | ||
29 | + %tr | ||
30 | + %td= f.label :tag_list | ||
31 | + %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field | ||
32 | + | ||
28 | .field | 33 | .field |
29 | = f.label :description | 34 | = f.label :description |
30 | %br/ | 35 | %br/ |
@@ -41,8 +46,20 @@ | @@ -41,8 +46,20 @@ | ||
41 | %h3.prepend-top Creating project & repository. Please wait for few minutes | 46 | %h3.prepend-top Creating project & repository. Please wait for few minutes |
42 | - else | 47 | - else |
43 | %h3.prepend-top Updating project & repository. Please wait for few minutes | 48 | %h3.prepend-top Updating project & repository. Please wait for few minutes |
49 | + | ||
44 | :javascript | 50 | :javascript |
45 | $('.new_project, .edit_project').bind('ajax:before', function() { | 51 | $('.new_project, .edit_project').bind('ajax:before', function() { |
46 | $(this).find(".form_content").hide(); | 52 | $(this).find(".form_content").hide(); |
47 | $('.ajax_loader').show(); | 53 | $('.ajax_loader').show(); |
48 | }); | 54 | }); |
55 | + | ||
56 | +:javascript | ||
57 | + $(function(){ | ||
58 | + var tag_field = $('#tag_field').tagify(); | ||
59 | + | ||
60 | + $('form').submit( function() { | ||
61 | + var tag_field = $('#tag_field') | ||
62 | + tag_field.val( tag_field.tagify('serialize') ); | ||
63 | + return true; | ||
64 | + }); | ||
65 | + }) |
db/schema.rb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended to check this file into your version control system. | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | ||
14 | -ActiveRecord::Schema.define(:version => 20111027152724) do | 14 | +ActiveRecord::Schema.define(:version => 20111101222453) do |
15 | 15 | ||
16 | create_table "issues", :force => true do |t| | 16 | create_table "issues", :force => true do |t| |
17 | t.string "title" | 17 | t.string "title" |
@@ -68,6 +68,23 @@ ActiveRecord::Schema.define(:version => 20111027152724) do | @@ -68,6 +68,23 @@ ActiveRecord::Schema.define(:version => 20111027152724) do | ||
68 | t.datetime "expires_at" | 68 | t.datetime "expires_at" |
69 | end | 69 | end |
70 | 70 | ||
71 | + create_table "taggings", :force => true do |t| | ||
72 | + t.integer "tag_id" | ||
73 | + t.integer "taggable_id" | ||
74 | + t.string "taggable_type" | ||
75 | + t.integer "tagger_id" | ||
76 | + t.string "tagger_type" | ||
77 | + t.string "context" | ||
78 | + t.datetime "created_at" | ||
79 | + end | ||
80 | + | ||
81 | + add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" | ||
82 | + add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" | ||
83 | + | ||
84 | + create_table "tags", :force => true do |t| | ||
85 | + t.string "name" | ||
86 | + end | ||
87 | + | ||
71 | create_table "users", :force => true do |t| | 88 | create_table "users", :force => true do |t| |
72 | t.string "email", :default => "", :null => false | 89 | t.string "email", :default => "", :null => false |
73 | t.string "encrypted_password", :limit => 128, :default => "", :null => false | 90 | t.string "encrypted_password", :limit => 128, :default => "", :null => false |