add tags to admin project form
This commit is contained in:
parent
af7bed2aa5
commit
4a1b70f7b2
3 changed files with 48 additions and 34 deletions
|
@ -40,3 +40,19 @@ $(document).ready(function(){
|
|||
function focusSearch() {
|
||||
$("#search").focus();
|
||||
}
|
||||
|
||||
function taggifyForm(){
|
||||
var tag_field = $('#tag_field').tagify();
|
||||
|
||||
tag_field.tagify('inputField').autocomplete({
|
||||
source: '/tags.json'
|
||||
});
|
||||
|
||||
|
||||
$('form').submit( function() {
|
||||
var tag_field = $('#tag_field')
|
||||
tag_field.val( tag_field.tagify('serialize') );
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,30 +1,39 @@
|
|||
= form_for [:admin, @admin_project] do |f|
|
||||
-if @admin_project.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
|
||||
%h2= "#{pluralize(@admin_project.errors.count, "error")} prohibited this admin_project from being saved:"
|
||||
%ul
|
||||
- @admin_project.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.span-24
|
||||
.span-12
|
||||
.field
|
||||
= f.label :name
|
||||
%br
|
||||
= f.text_field :name
|
||||
.field
|
||||
= f.label :code
|
||||
%br
|
||||
= f.text_field :code
|
||||
.field
|
||||
= f.label :path
|
||||
%br
|
||||
= f.text_field :path
|
||||
.span-10
|
||||
.field
|
||||
= f.label :description
|
||||
%br
|
||||
= f.text_area :description
|
||||
.form-row
|
||||
= f.label :name
|
||||
%br
|
||||
= f.text_field :name
|
||||
.form-row
|
||||
= f.label :code
|
||||
%br
|
||||
= f.text_field :code
|
||||
.form-row
|
||||
= f.label :path
|
||||
%br
|
||||
= f.text_field :path
|
||||
|
||||
|
||||
.form-row
|
||||
= f.label :tag_list
|
||||
%br
|
||||
= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
|
||||
|
||||
.form-row
|
||||
= f.label :description
|
||||
%br
|
||||
= f.text_area :description
|
||||
.clear
|
||||
.actions
|
||||
= f.submit 'Save', :class => "lbutton"
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
taggifyForm();
|
||||
})
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
%tr
|
||||
%td= f.label :tag_list
|
||||
%td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
|
||||
|
||||
.field
|
||||
|
||||
.form-row
|
||||
= f.label :description
|
||||
%br/
|
||||
= f.text_area :description, :style => "height:140px;width:932px;"
|
||||
|
@ -55,16 +55,5 @@
|
|||
|
||||
:javascript
|
||||
$(function(){
|
||||
var tag_field = $('#tag_field').tagify();
|
||||
|
||||
tag_field.tagify('inputField').autocomplete({
|
||||
source: '/tags.json'
|
||||
});
|
||||
|
||||
|
||||
$('form').submit( function() {
|
||||
var tag_field = $('#tag_field')
|
||||
tag_field.val( tag_field.tagify('serialize') );
|
||||
return true;
|
||||
});
|
||||
taggifyForm();
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue