inline_forms 2.23 → 3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +9 -9
  2. data/.gitignore +5 -0
  3. data/bin/inline_forms +41 -414
  4. data/bin/inline_forms_app_template.rb +16 -0
  5. data/bin/inline_forms_installer_core.rb +423 -0
  6. data/lib/app/assets/javascripts/inline_forms.js +12 -32
  7. data/lib/app/assets/javascripts/inline_forms_application.js +7 -1
  8. data/lib/app/assets/stylesheets/inline_forms.css +5 -399
  9. data/lib/app/assets/stylesheets/inline_forms_application.css +3 -3
  10. data/lib/app/controllers/inline_forms_application_controller.rb +1 -2
  11. data/lib/app/controllers/inline_forms_controller.rb +2 -2
  12. data/lib/app/helpers/form_elements/check_list.rb +7 -14
  13. data/lib/app/helpers/form_elements/date.rb +3 -8
  14. data/lib/app/helpers/form_elements/decimal_field.rb +15 -0
  15. data/lib/app/helpers/form_elements/dropdown.rb +1 -1
  16. data/lib/app/helpers/form_elements/dropdown_with_other.rb +153 -0
  17. data/lib/app/helpers/form_elements/dropdown_with_values.rb +1 -1
  18. data/lib/app/helpers/form_elements/info_list.rb +22 -0
  19. data/lib/app/helpers/form_elements/integer_field.rb +15 -0
  20. data/lib/app/helpers/form_elements/kansen_slider.rb +89 -0
  21. data/lib/app/helpers/form_elements/month_year_picker.rb +33 -0
  22. data/lib/app/helpers/form_elements/move.rb +17 -0
  23. data/lib/app/helpers/form_elements/plain_text_area.rb +1 -1
  24. data/lib/app/helpers/form_elements/radio_button.rb +5 -6
  25. data/lib/app/helpers/form_elements/slider_with_values.rb +1 -1
  26. data/lib/app/helpers/form_elements/text_area.rb +12 -10
  27. data/lib/app/helpers/form_elements/text_area_without_ckeditor.rb +1 -1
  28. data/lib/app/helpers/form_elements/text_field.rb +2 -2
  29. data/lib/app/helpers/inline_forms_helper.rb +32 -37
  30. data/lib/app/views/inline_forms/_close.html.erb +12 -2
  31. data/lib/app/views/inline_forms/_edit.html.erb +54 -21
  32. data/lib/app/views/inline_forms/_flash.html.erb +13 -0
  33. data/lib/app/views/inline_forms/_list.html.erb +28 -24
  34. data/lib/app/views/inline_forms/_new.html.erb +52 -60
  35. data/lib/app/views/inline_forms/_new_nested.html.erb +43 -0
  36. data/lib/app/views/inline_forms/_show.html.erb +83 -39
  37. data/lib/app/views/inline_forms/_tree.html.erb +46 -0
  38. data/lib/app/views/layouts/devise.html.erb +4 -14
  39. data/lib/app/views/layouts/inline_forms.html.erb +15 -23
  40. data/lib/inline_forms/version.rb +1 -1
  41. metadata +17 -13
  42. data/lib/app/assets/images/add.png +0 -0
  43. data/lib/app/assets/images/close.png +0 -0
  44. data/lib/app/assets/images/tooltip-bubble-down-left.png +0 -0
  45. data/lib/app/assets/images/tooltip-bubble-down-right.png +0 -0
  46. data/lib/app/assets/images/tooltip-bubble-up-left.png +0 -0
  47. data/lib/app/assets/images/tooltip-bubble-up-right.png +0 -0
  48. data/lib/app/assets/images/trash.png +0 -0
  49. data/lib/app/assets/javascripts/jquery.qtip.js +0 -3395
  50. data/lib/app/assets/stylesheets/jquery.qtip.css +0 -567
  51. data/lib/app/views/inline_forms/_header.html.erb +0 -1
@@ -113,7 +113,7 @@ class InlineFormsController < ApplicationController
113
113
  @update_span = params[:update]
114
114
  attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list
115
115
  attributes.each do | attribute, name, form_element |
116
- send("#{form_element.to_s}_update", @object, attribute) unless form_element == :associated || (cancan_enabled? && cannot?(:read, @Klass.to_s.underscore.pluralize.to_sym, attribute))
116
+ send("#{form_element.to_s}_update", @object, attribute) unless form_element == :tree || form_element == :associated || (cancan_enabled? && cannot?(:read, @Klass.to_s.underscore.pluralize.to_sym, attribute))
117
117
  end
118
118
  @parent_class = params[:parent_class]
119
119
  @parent_id = params[:parent_id]
@@ -206,7 +206,7 @@ class InlineFormsController < ApplicationController
206
206
  # Thanks Ryan Bates: http://railscasts.com/episodes/255-undo-with-paper-trail
207
207
  def revert
208
208
  @update_span = params[:update]
209
- @version = Version.find(params[:id])
209
+ @version = PaperTrail::Version.find(params[:id])
210
210
  @version.reify.save!
211
211
  @object = @Klass.find(@version.item_id)
212
212
  authorize!(:revert, @object) if cancan_enabled?
@@ -3,14 +3,13 @@ InlineForms::SPECIAL_COLUMN_TYPES[:check_list]=:no_migration
3
3
 
4
4
  # checklist
5
5
  def check_list_show(object, attribute)
6
- out = '<ul class="checklist">'
7
- out << link_to_inline_edit(object, attribute) if object.send(attribute).empty?
6
+ out = ''
7
+ out = link_to_inline_edit(object, attribute, "<i class='fi-plus'></i>".html_safe) if object.send(attribute).empty?
8
8
  object.send(attribute).sort.each do | item |
9
- out << '<li>'
9
+ out << "<div class='row #{cycle('odd', 'even')}'>"
10
10
  out << link_to_inline_edit(object, attribute, item._presentation )
11
- out << '</li>'
11
+ out << '</div>'
12
12
  end
13
- out << '</ul>'
14
13
  out.html_safe
15
14
  end
16
15
 
@@ -21,19 +20,13 @@ def check_list_edit(object, attribute)
21
20
  else
22
21
  values = object.send(attribute).first.class.name.constantize.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
23
22
  end
24
- out = '<div class="edit_form_checklist">'
25
- out << '<ul>'
23
+ out = ''
26
24
  values.each do | item |
27
- out << '<li>'
25
+ out << "<div class='row #{cycle('odd', 'even')}'>"
28
26
  out << check_box_tag( attribute.to_s + '[' + item.id.to_s + ']', 1, object.send(attribute.to_s.singularize + "_ids").include?(item.id) )
29
- out << '<div class="edit_form_checklist_text">'
30
- out << h(item._presentation)
27
+ out << "<label for=#{attribute.to_s + '[' + item.id.to_s + ']'}>#{h(item._presentation)}</label>"
31
28
  out << '</div>'
32
- out << '<div style="clear: both;"></div>'
33
- out << '</li>'
34
29
  end
35
- out << '</ul>'
36
- out << '</div>'
37
30
  out.html_safe
38
31
  end
39
32
 
@@ -3,18 +3,13 @@ InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date
3
3
 
4
4
  # date
5
5
  def date_select_show(object, attribute)
6
- link_to_inline_edit object, attribute, object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y")
6
+ link_to_inline_edit object, attribute, object.send(attribute).nil? ? "<i class='fi-plus'></i>".html_safe : object.send(attribute).strftime("%d-%m-%Y")
7
7
  end
8
8
 
9
9
  def date_select_edit(object, attribute)
10
10
  css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
11
- out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id
12
- out << '<SCRIPT>'.html_safe
13
- out << "$(function() { ".html_safe
14
- out << '$("#'.html_safe + css_id.html_safe + '").datepicker({ yearRange: "-100:+5" });'.html_safe
15
- out << '});'.html_safe
16
- out << '</SCRIPT>'.html_safe
17
- return out
11
+ out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => css_id, :class =>'datepicker'
12
+ out << "<script>$('##{css_id}').datepicker();</script>".html_safe
18
13
  end
19
14
 
20
15
  def date_select_update(object, attribute)
@@ -0,0 +1,15 @@
1
+ # -*- encoding : utf-8 -*-
2
+ InlineForms::SPECIAL_COLUMN_TYPES[:decimal_field]=:string
3
+
4
+ def decimal_field_show(object, attribute)
5
+ link_to_inline_edit object, attribute, object[attribute].nil? ? "<i class='fi-plus'></i>".html_safe : object[attribute]
6
+ end
7
+
8
+ def decimal_field_edit(object, attribute)
9
+ text_field_tag attribute, (object.send attribute.to_sym), :class => 'input_decimal_field' # for abide: , :required => true
10
+ end
11
+
12
+ def decimal_field_update(object, attribute)
13
+ object.send :write_attribute, attribute.to_sym, params[attribute.to_sym]
14
+ end
15
+
@@ -3,7 +3,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to
3
3
 
4
4
  # dropdown
5
5
  def dropdown_show(object, attribute)
6
- attribute_value = object.send(attribute)._presentation rescue nil
6
+ attribute_value = object.send(attribute)._presentation rescue "<i class='fi-plus'></i>".html_safe
7
7
  link_to_inline_edit object, attribute, attribute_value
8
8
  end
9
9
 
@@ -0,0 +1,153 @@
1
+ # -*- encoding : utf-8 -*-
2
+ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_other]=:belongs_to
3
+
4
+ # dropdown
5
+ def dropdown_with_other_show(object, attribute)
6
+ attribute = attribute.to_s
7
+ foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
8
+ id = object[foreign_key]
9
+ if id == 0
10
+ attribute_value = object[attribute + '_other']
11
+ attribute_value = "<i class='fi-plus'></i>".html_safe if attribute_value.nil? || attribute_value.empty?
12
+ else
13
+ attribute_value = object.send(attribute)._presentation rescue "<i class='fi-plus'></i>".html_safe
14
+ end
15
+ link_to_inline_edit object, attribute, attribute_value
16
+ end
17
+
18
+ def dropdown_with_other_edit(object, attribute)
19
+ attribute = attribute.to_s
20
+ foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
21
+ o = attribute.camelcase.constantize
22
+ values = o.all
23
+ values = o.accessible_by(current_ability) if cancan_enabled?
24
+ values.each do |v|
25
+ v.name = v._presentation
26
+ end
27
+ # values.sort_by! &:name
28
+
29
+ collection = values.map {|v|[v.name, v.id]}
30
+ collection << [object[attribute + '_other'], 0] unless object[attribute + '_other'].nil? || object[attribute + '_other'].empty?
31
+ out = '<div class="ui-widget">'
32
+ out << select('_' + object.class.to_s.underscore, foreign_key.to_sym, collection, {selected: object[foreign_key.to_sym]}, {id: '_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + foreign_key.to_s})
33
+ out << '</div>
34
+ <script>
35
+ (function( $ ) {
36
+ $.widget( "custom.combobox", {
37
+ _create: function() {
38
+ this.wrapper = $( "<span>" )
39
+ .addClass( "custom-combobox" )
40
+ .insertAfter( this.element );
41
+
42
+ this.element.hide();
43
+ this._createAutocomplete();
44
+ this._createShowAllButton();
45
+ },
46
+
47
+ _createAutocomplete: function() {
48
+ var selected = this.element.children( ":selected" ),
49
+ value = selected.val() ? selected.text() : "";
50
+
51
+ this.input = $( "<input name=\''
52
+
53
+ out << '_' + object.class.to_s.underscore + '[' + attribute + '_other]'
54
+
55
+ out << '\'>" )
56
+ .appendTo( this.wrapper )
57
+ .val( value )
58
+ .attr( "title", "" )
59
+ .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left" )
60
+ .autocomplete({
61
+ delay: 0,
62
+ minLength: 0,
63
+ source: $.proxy( this, "_source" )
64
+ })
65
+ .tooltip({
66
+ tooltipClass: "ui-state-highlight"
67
+ });
68
+
69
+ this._on( this.input, {
70
+ autocompleteselect: function( event, ui ) {
71
+ ui.item.option.selected = true;
72
+ this._trigger( "select", event, {
73
+ item: ui.item.option
74
+ });
75
+ }
76
+ });
77
+ },
78
+
79
+ _createShowAllButton: function() {
80
+ var input = this.input,
81
+ wasOpen = false;
82
+
83
+ $( "<a>" )
84
+ .attr( "tabIndex", -1 )
85
+ .attr( "title", "Show All Items" )
86
+ .tooltip()
87
+ .appendTo( this.wrapper )
88
+ .button({
89
+ icons: {
90
+ primary: "ui-icon-triangle-1-s"
91
+ },
92
+ text: false
93
+ })
94
+ .removeClass( "ui-corner-all" )
95
+ .addClass( "custom-combobox-toggle ui-corner-right" )
96
+ .mousedown(function() {
97
+ wasOpen = input.autocomplete( "widget" ).is( ":visible" );
98
+ })
99
+ .click(function() {
100
+ input.focus();
101
+
102
+ // Close if already visible
103
+ if ( wasOpen ) {
104
+ return;
105
+ }
106
+
107
+ // Pass empty string as value to search for, displaying all results
108
+ input.autocomplete( "search", "" );
109
+ });
110
+ },
111
+
112
+ _source: function( request, response ) {
113
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
114
+ response( this.element.children( "option" ).map(function() {
115
+ var text = $( this ).text();
116
+ if ( this.value && ( !request.term || matcher.test(text) ) )
117
+ return {
118
+ label: text,
119
+ value: text,
120
+ option: this
121
+ };
122
+ }) );
123
+ },
124
+ });
125
+ })( jQuery );
126
+
127
+ $(function() {
128
+ $( "'
129
+ out << '#_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.foreign_key.to_s
130
+ out << '" ).combobox();
131
+ });
132
+ </script>'
133
+ out.html_safe
134
+
135
+
136
+ end
137
+
138
+ def dropdown_with_other_update(object, attribute)
139
+ attribute = attribute.to_s
140
+ foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
141
+ # if there is an attribute attr, then there must be an attribute attr_other
142
+ other = params[('_' + object.class.to_s.underscore).to_sym][(attribute + "_other").to_sym]
143
+ # see if it matches anything (but we need to look at I18n too!
144
+ lookup_model = attribute.camelcase.constantize
145
+ name_field = 'name_' + I18n.locale.to_s
146
+ name_field = 'name' unless lookup_model.new.respond_to? name_field
147
+ puts 'XXXXXXXXXXXXXXXXXXXX ' + name_field.inspect
148
+ match = lookup_model.where(name_field.to_sym => other).first # problem if there are dupes!
149
+ puts 'XXXXXXXXXXXXXXXXXXXX ' + match.inspect
150
+ match.nil? ? object[foreign_key] = 0 : object[foreign_key] = match.id # problem if there is a record with id: 0 !
151
+ match.nil? ? object[attribute + '_other'] = other : object[attribute + '_other'] = nil
152
+ end
153
+
@@ -4,7 +4,7 @@ InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_values]=:integer
4
4
  # dropdown_with_values
5
5
  def dropdown_with_values_show(object, attribute)
6
6
  values = attribute_values(object, attribute)
7
- link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : ""
7
+ link_to_inline_edit object, attribute, object.send(attribute) ? values.assoc(object.send(attribute))[1] : "<i class='fi-plus'></i>".html_safe
8
8
  end
9
9
  def dropdown_with_values_edit(object, attribute)
10
10
  # the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
@@ -0,0 +1,22 @@
1
+ # -*- encoding : utf-8 -*-
2
+ # not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:info]=:string
3
+
4
+ def info_list_show(object, attribute)
5
+ # we would expect
6
+ out = ''
7
+ out = "<div class='row #{cycle('odd', 'even')}'>--</div>" if object.send(attribute).empty?
8
+ object.send(attribute).sort.each do | item |
9
+ out << "<div class='row #{cycle('odd', 'even')}'>"
10
+ out << item._presentation
11
+ out << '</div>'
12
+ end
13
+ out.html_safe
14
+ end
15
+
16
+ def info_list_edit(object, attribute)
17
+ # we should raise an error
18
+ end
19
+
20
+ def info_list_update(object, attribute)
21
+ # we should raise an errror
22
+ end
@@ -0,0 +1,15 @@
1
+ # -*- encoding : utf-8 -*-
2
+ InlineForms::SPECIAL_COLUMN_TYPES[:integer_field]=:integer
3
+
4
+ def integer_field_show(object, attribute)
5
+ link_to_inline_edit object, attribute, object[attribute].nil? ? "<i class='fi-plus'></i>".html_safe : object[attribute]
6
+ end
7
+
8
+ def integer_field_edit(object, attribute)
9
+ number_field_tag attribute, (object.send attribute.to_sym), :class => 'input_integer_field' # for abide: , :required => true
10
+ end
11
+
12
+ def integer_field_update(object, attribute)
13
+ object.send :write_attribute, attribute.to_sym, params[attribute.to_sym]
14
+ end
15
+
@@ -0,0 +1,89 @@
1
+ # -*- encoding : utf-8 -*-
2
+ InlineForms::SPECIAL_COLUMN_TYPES[:kansen_slider]=:integer
3
+
4
+ # kansen_slider
5
+ def kansen_slider_show(object, attribute)
6
+ values = attribute_values(object, attribute)
7
+ value = object.send(attribute).to_i # should be an int
8
+ display_value = values.assoc(value)[1] # values should be [ [ 0, value ], [ 3, value2 ] .... ] and we lookup the key, not the place in the array!
9
+ css_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
10
+ if value == 0 || value > 5
11
+ out = display_value
12
+ else
13
+ out = "<div class='row collapse'>".html_safe
14
+ out << "<div class='small-5 column slider_value' id='value_#{css_id}'>#{display_value}</div>".html_safe
15
+ out << "<div class='small-7 column kansen_slider_show slider slider_#{attribute.to_s}' id='slider_#{css_id}'></div>".html_safe
16
+ out << "<input type='hidden' name='_#{object.class.to_s.underscore}[#{attribute}]' value='0' id='input_#{css_id}' />".html_safe
17
+ out << ('<script>
18
+ $(function() {
19
+ var displayvalues = ' + values.collect {|x| x[1]}.inspect + ';
20
+ $( "#slider_' + css_id + '" ).slider(
21
+ {
22
+ value:' + value.to_s + ',
23
+ disabled: true,
24
+ min: 1,
25
+ max: 5,
26
+ step: 1,
27
+ }
28
+ );
29
+ });
30
+ </script>').html_safe
31
+ out << "</div>".html_safe
32
+ end
33
+ link_to_inline_edit object, attribute, out
34
+ end
35
+
36
+ def kansen_slider_edit(object, attribute)
37
+ # the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
38
+ values = attribute_values(object, attribute)
39
+ value = object.send(attribute).to_i # should be an int, will be 0 if nil
40
+ css_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
41
+ display_value = values.assoc(value)[1] # values should be [ [ 0, value ], [ 3, value2 ] .... ] and we lookup the key, not the place in the array!
42
+ out = "<div class='row collapse'>".html_safe
43
+ out << "<div class='small-5 column kansen_slider_value' id='value_#{css_id}'>#{display_value}</div>".html_safe
44
+ out << "<div class='small-7 column kansen_slider_edit slider slider_#{attribute.to_s}' id='slider_#{css_id}'></div>".html_safe
45
+ out << "<input type='hidden' name='_#{object.class.to_s.underscore}[#{attribute}]' value='0' id='input_#{css_id}' />".html_safe
46
+ out << ('<script>
47
+ $(function() {
48
+ var displayvalues = ' + values.collect {|x| x[1]}.inspect + ';
49
+ $( "#slider_' + css_id + '" ).slider(
50
+ {
51
+ value:' + value.to_s + ',
52
+ min: 0,
53
+ max: ' + (values.length - 1 ).to_s + ',
54
+ step: 1,
55
+ slide: function( event, ui ) {
56
+ $( "#input_' + css_id + '" ).val( ui.value );
57
+ $( "#value_' + css_id + '" ).html( displayvalues[ui.value] );
58
+ }
59
+ }
60
+ );').html_safe
61
+ out << ('$( "#value_' + css_id + '" ).html(displayvalues[' + value.to_s + ']);').html_safe
62
+ out << ('$( "#input_' + css_id + '" ).val(' + value.to_s + ');').html_safe
63
+ out << ('});
64
+ </script>').html_safe
65
+ out << '</div>'.html_safe
66
+ out
67
+ end
68
+
69
+ def kansen_slider_update(object, attribute)
70
+ object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
71
+ end
72
+
73
+ #<style>
74
+ # #demo-frame > div.demo { padding: 10px !important; };
75
+ # </style>
76
+ #
77
+ #
78
+ #
79
+ #<div class="demo">
80
+ #
81
+ #<p>
82
+ # <label for="amount">Donation amount ($50 increments):</label>
83
+ # <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
84
+ #</p>
85
+ #
86
+ #<div id="slider"></div>
87
+ #
88
+ #</div><!-- End demo -->
89
+ #
@@ -0,0 +1,33 @@
1
+ # -*- encoding : utf-8 -*-
2
+ InlineForms::SPECIAL_COLUMN_TYPES[:month_year_picker]=:date
3
+
4
+ # date
5
+ def month_year_picker_show(object, attribute)
6
+ link_to_inline_edit object, attribute, object.send(attribute).nil? ? "<i class='fi-plus'></i>".html_safe : object.send(attribute).strftime("%B %Y")
7
+ end
8
+
9
+ def month_year_picker_edit(object, attribute)
10
+ css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
11
+ out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%B %Y") ), :id => css_id, :class =>'datepicker'
12
+ #out << (hidden_field_tag "hidden_" + attribute.to_s, ( object.send(attribute).nil? ? "" : object.send(attribute).strftime("%d-%m-%Y") ), :id => "hiddden_" + css_id)
13
+ # http://jsfiddle.net/bopperben/DBpJe/
14
+ out << "<script>$('##{css_id}').datepicker( {
15
+ changeMonth: true,
16
+ changeYear: true,
17
+ showButtonPanel: true,
18
+ dateFormat: 'MM yy',
19
+ regional: '',
20
+ onClose: function(dateText, inst) {
21
+ var month = $('#ui-datepicker-div .ui-datepicker-month :selected').val();
22
+ var year = $('#ui-datepicker-div .ui-datepicker-year :selected').val();
23
+ $(this).datepicker('setDate', new Date(year, month, 1));
24
+ }
25
+ });</script>".html_safe
26
+ end
27
+
28
+ def month_year_picker_update(object, attribute)
29
+ puts 'XXXXXXXXXXXXXXXXXXXXXXXXXX' + object[attribute.to_sym].inspect
30
+ puts 'XXXXXXXXXXXXXXXXXXXXXXXXXX' + Date.parse(params[attribute.to_sym].to_s).strftime("%F").to_s
31
+ object[attribute.to_sym] = Date.parse(params[attribute.to_sym].to_s).strftime("%F").to_s
32
+ puts 'XXXXXXXXXXXXXXXXXXXXXXXXXX' + object[attribute.to_sym].inspect
33
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding : utf-8 -*-
2
+ #InlineForms::SPECIAL_COLUMN_TYPES[:text_field]=:string
3
+
4
+ def move_show(object, attribute)
5
+ link_to_inline_edit object, attribute, "<i class='fi-plus'></i>".html_safe
6
+ end
7
+
8
+ def move_edit(object, attribute)
9
+ values = object.class.send :hash_tree_to_collection
10
+ select( ('_' + object.class.to_s.underscore).to_sym, attribute, values, :selected => object.id )
11
+ end
12
+
13
+ def move_update(object, attribute)
14
+ parent = object.class.find_by_id(params['_' + object.class.to_s.underscore][attribute.to_sym])
15
+ parent.add_child(object) if parent
16
+ end
17
+