Commit b946da44695c9c8fe8867bb87bcdf801c52177d3

Authored by Aleksei Kvitinskii
1 parent 6977150f

added tags to form

app/assets/javascripts/application.js
... ... @@ -8,6 +8,7 @@
8 8 //= require jquery-ui
9 9 //= require jquery_ujs
10 10 //= require jquery.ui.selectmenu
  11 +//= require jquery.tagify
11 12 //= require jquery.cookie
12 13 //= require_tree .
13 14  
... ...
app/assets/stylesheets/application.css
... ... @@ -4,6 +4,7 @@
4 4 * the top of the compiled file, but it's generally better to create a new file per style scope.
5 5 *= require jquery-ui/jquery-ui
6 6 *= require jquery-ui/jquery.ui.selectmenu
  7 + *= require jquery-ui/jquery.tagify
7 8 *= require_self
8 9 *= require_tree .
9 10 */
... ...
app/views/projects/_form.html.haml
... ... @@ -25,6 +25,11 @@
25 25 .left= f.label :code
26 26 %cite.right http://yourserver/
27 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 33 .field
29 34 = f.label :description
30 35 %br/
... ... @@ -41,8 +46,20 @@
41 46 %h3.prepend-top Creating project & repository. Please wait for few minutes
42 47 - else
43 48 %h3.prepend-top Updating project & repository. Please wait for few minutes
  49 +
44 50 :javascript
45 51 $('.new_project, .edit_project').bind('ajax:before', function() {
46 52 $(this).find(".form_content").hide();
47 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 11 #
12 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 16 create_table "issues", :force => true do |t|
17 17 t.string "title"
... ... @@ -68,6 +68,23 @@ ActiveRecord::Schema.define(:version => 20111027152724) do
68 68 t.datetime "expires_at"
69 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 88 create_table "users", :force => true do |t|
72 89 t.string "email", :default => "", :null => false
73 90 t.string "encrypted_password", :limit => 128, :default => "", :null => false
... ...