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() {
|
function focusSearch() {
|
||||||
$("#search").focus();
|
$("#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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,25 +6,34 @@
|
||||||
- @admin_project.errors.full_messages.each do |msg|
|
- @admin_project.errors.full_messages.each do |msg|
|
||||||
%li= msg
|
%li= msg
|
||||||
|
|
||||||
.span-24
|
.form-row
|
||||||
.span-12
|
= f.label :name
|
||||||
.field
|
%br
|
||||||
= f.label :name
|
= f.text_field :name
|
||||||
%br
|
.form-row
|
||||||
= f.text_field :name
|
= f.label :code
|
||||||
.field
|
%br
|
||||||
= f.label :code
|
= f.text_field :code
|
||||||
%br
|
.form-row
|
||||||
= f.text_field :code
|
= f.label :path
|
||||||
.field
|
%br
|
||||||
= f.label :path
|
= f.text_field :path
|
||||||
%br
|
|
||||||
= f.text_field :path
|
|
||||||
.span-10
|
.form-row
|
||||||
.field
|
= f.label :tag_list
|
||||||
= f.label :description
|
%br
|
||||||
%br
|
= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
|
||||||
= f.text_area :description
|
|
||||||
|
.form-row
|
||||||
|
= f.label :description
|
||||||
|
%br
|
||||||
|
= f.text_area :description
|
||||||
.clear
|
.clear
|
||||||
.actions
|
.actions
|
||||||
= f.submit 'Save', :class => "lbutton"
|
= f.submit 'Save', :class => "lbutton"
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$(function(){
|
||||||
|
taggifyForm();
|
||||||
|
})
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
%td= f.label :tag_list
|
%td= f.label :tag_list
|
||||||
%td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
|
%td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
|
||||||
|
|
||||||
.field
|
.form-row
|
||||||
= f.label :description
|
= f.label :description
|
||||||
%br/
|
%br/
|
||||||
= f.text_area :description, :style => "height:140px;width:932px;"
|
= f.text_area :description, :style => "height:140px;width:932px;"
|
||||||
|
@ -55,16 +55,5 @@
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(function(){
|
$(function(){
|
||||||
var tag_field = $('#tag_field').tagify();
|
taggifyForm();
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue