inline_forms 1.6.58 → 1.6.59
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.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjljZGZiZjg5NzQzOTMyNmEzYzRmNjcyY2RmZjhmMTViZTFhMzJiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTJkYTcxYWE1NmI0MDQyYTE2NGI5NTlkM2VhYjJjNWQxYzVkYjI3Nw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzJiYWE3ZDZiNDU3OTQ3NDhiODgwNDhhZTA5MWVkOWIzYmQzZDY5ZDFhOGRk
|
10
|
+
NDZlN2FjOWQxMTI3NjA5NmJlNmJlMTFiYjczNzBmZTIzN2JlMjUwZWNlNDM1
|
11
|
+
NmY0NWE0OTY0ZWZlZWM2ZmYxZjMwNjAyMzNhMDJlN2IyZmFlZDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDEwNzNhM2UwZDYzN2E5ZmQxYjJmNDA0ZjA1YWU3NjA2MTRlMTk0NjFkYjIz
|
14
|
+
MzU2ZWY3MDJiZmM3NDg4N2IyMDIxNTQwYjQ5ZWZmYWUwMTJhZjZjN2E0NWI2
|
15
|
+
ZGE2YzA1NTA5NThhYmM3MzRjOTA0MjViNDAxYjUwYjNlOWU5ZjI=
|
@@ -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
|
+
integer_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,91 @@
|
|
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-1 column slider_value' id='value_#{css_id}'>#{display_value}</div>".html_safe
|
15
|
+
out << "<div class='small-11 column 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
|
+
range: "min",
|
24
|
+
disabled: true,
|
25
|
+
min: 1,
|
26
|
+
max: 5,
|
27
|
+
step: 1,
|
28
|
+
}
|
29
|
+
);
|
30
|
+
});
|
31
|
+
</script>').html_safe
|
32
|
+
out << "</div>".html_safe
|
33
|
+
end
|
34
|
+
link_to_inline_edit object, attribute, out
|
35
|
+
end
|
36
|
+
|
37
|
+
def kansen_slider_edit(object, attribute)
|
38
|
+
# 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!
|
39
|
+
values = attribute_values(object, attribute)
|
40
|
+
value = object.send(attribute).to_i # should be an int, will be 0 if nil
|
41
|
+
css_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
|
42
|
+
display_value = values.assoc(value)[1] # values should be [ [ 0, value ], [ 3, value2 ] .... ] and we lookup the key, not the place in the array!
|
43
|
+
out = "<div class='row collapse'>".html_safe
|
44
|
+
out << "<div class='small-5 column slider_value' id='value_#{css_id}'>#{display_value}</div>".html_safe
|
45
|
+
out << "<div class='small-7 column slider slider_#{attribute.to_s}' id='slider_#{css_id}'></div>".html_safe
|
46
|
+
out << "<input type='hidden' name='_#{object.class.to_s.underscore}[#{attribute}]' value='0' id='input_#{css_id}' />".html_safe
|
47
|
+
out << ('<script>
|
48
|
+
$(function() {
|
49
|
+
var displayvalues = ' + values.collect {|x| x[1]}.inspect + ';
|
50
|
+
$( "#slider_' + css_id + '" ).slider(
|
51
|
+
{
|
52
|
+
value:' + value.to_s + ',
|
53
|
+
range: "min",
|
54
|
+
min: 0,
|
55
|
+
max: ' + (values.length - 1 ).to_s + ',
|
56
|
+
step: 1,
|
57
|
+
slide: function( event, ui ) {
|
58
|
+
$( "#input_' + css_id + '" ).val( ui.value );
|
59
|
+
$( "#value_' + css_id + '" ).html( displayvalues[ui.value] );
|
60
|
+
}
|
61
|
+
}
|
62
|
+
);').html_safe
|
63
|
+
out << ('$( "#value_' + css_id + '" ).html(displayvalues[' + value.to_s + ']);').html_safe
|
64
|
+
out << ('$( "#input_' + css_id + '" ).val(' + value.to_s + ');').html_safe
|
65
|
+
out << ('});
|
66
|
+
</script>').html_safe
|
67
|
+
out << '</div>'.html_safe
|
68
|
+
out
|
69
|
+
end
|
70
|
+
|
71
|
+
def kansen_slider_update(object, attribute)
|
72
|
+
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
73
|
+
end
|
74
|
+
|
75
|
+
#<style>
|
76
|
+
# #demo-frame > div.demo { padding: 10px !important; };
|
77
|
+
# </style>
|
78
|
+
#
|
79
|
+
#
|
80
|
+
#
|
81
|
+
#<div class="demo">
|
82
|
+
#
|
83
|
+
#<p>
|
84
|
+
# <label for="amount">Donation amount ($50 increments):</label>
|
85
|
+
# <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
|
86
|
+
#</p>
|
87
|
+
#
|
88
|
+
#<div id="slider"></div>
|
89
|
+
#
|
90
|
+
#</div><!-- End demo -->
|
91
|
+
#
|
data/lib/inline_forms/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ace Suares
|
@@ -198,6 +198,8 @@ files:
|
|
198
198
|
- lib/app/helpers/form_elements/image_field.rb
|
199
199
|
- lib/app/helpers/form_elements/info.rb
|
200
200
|
- lib/app/helpers/form_elements/info_list.rb
|
201
|
+
- lib/app/helpers/form_elements/integer_field.rb
|
202
|
+
- lib/app/helpers/form_elements/kansen_slider.rb
|
201
203
|
- lib/app/helpers/form_elements/money_field.rb
|
202
204
|
- lib/app/helpers/form_elements/month_year_picker.rb
|
203
205
|
- lib/app/helpers/form_elements/pdf_link.rb
|