effective_form_inputs 1.2.7 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/config/effective_form_inputs_manifest.js +2 -0
- data/app/assets/javascripts/effective_ckeditor_text_area/initialize.js.coffee +5 -2
- data/app/assets/stylesheets/effective_select/{bootstrap-theme.css → bootstrap-theme.scss} +0 -0
- data/app/assets/stylesheets/effective_select/{select2.css → select2.scss} +0 -0
- data/app/models/effective/{form_input.rb → form_builder_input.rb} +1 -1
- data/app/models/effective/form_builder_inputs/effective_ckeditor_text_area.rb +36 -0
- data/app/models/{inputs/effective_date_picker/input.rb → effective/form_builder_inputs/effective_date_picker.rb} +3 -4
- data/app/models/{inputs/effective_date_time_picker/input.rb → effective/form_builder_inputs/effective_date_time_picker.rb} +3 -4
- data/app/models/{inputs/effective_email/input.rb → effective/form_builder_inputs/effective_email.rb} +3 -4
- data/app/models/{inputs/effective_panel_select/input.rb → effective/form_builder_inputs/effective_panel_select.rb} +3 -3
- data/app/models/{inputs/effective_price/input.rb → effective/form_builder_inputs/effective_price.rb} +3 -4
- data/app/models/{inputs/effective_radio_buttons/input.rb → effective/form_builder_inputs/effective_radio_buttons.rb} +3 -4
- data/app/models/{inputs/effective_select/input.rb → effective/form_builder_inputs/effective_select.rb} +3 -3
- data/app/models/{inputs/effective_static_control/input.rb → effective/form_builder_inputs/effective_static_control.rb} +3 -4
- data/app/models/{inputs/effective_tel/input.rb → effective/form_builder_inputs/effective_tel.rb} +3 -4
- data/app/models/{inputs/effective_time_picker/input.rb → effective/form_builder_inputs/effective_time_picker.rb} +3 -4
- data/app/models/{inputs/effective_url/input.rb → effective/form_builder_inputs/effective_url.rb} +3 -4
- data/lib/effective_form_inputs.rb +1 -0
- data/lib/effective_form_inputs/engine.rb +11 -9
- data/lib/effective_form_inputs/form_builder_inputs.rb +50 -0
- data/{app/models → lib/effective_form_inputs}/inputs/effective_ckeditor_text_area_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_date_picker_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_date_time_picker_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_email_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_panel_select_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_price_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_radio_buttons_input.rb +1 -1
- data/lib/effective_form_inputs/inputs/effective_select_input.rb +38 -0
- data/{app/models → lib/effective_form_inputs}/inputs/effective_static_control_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_tel_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_time_picker_input.rb +1 -1
- data/{app/models → lib/effective_form_inputs}/inputs/effective_url_input.rb +1 -1
- data/lib/effective_form_inputs/version.rb +1 -1
- data/{app → lib}/validators/effective_email_validator.rb +0 -0
- data/{app → lib}/validators/effective_tel_validator.rb +0 -0
- data/{app → lib}/validators/effective_url_validator.rb +0 -0
- metadata +52 -38
- data/app/models/effective/form_builder_inputs.rb +0 -50
- data/app/models/inputs/effective_ckeditor_text_area/input.rb +0 -37
- data/app/models/inputs/effective_select_input.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b4624dad3afab2b66e41bd59e747a041b09b33004ca7f692ac945214e1aef533
|
4
|
+
data.tar.gz: 2845abc1b9c2cec8b2e4b714fe809950c4ecd8a8e934156cf430e5b849c92251
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5f663aae4e0285161fa166cc2e670b84459164ef6b8a8e32549c8773abedf5215379ccaf5e89a863dee6b62504cbd85d1d7e8c285e410e8c1bee9ff9e953332
|
7
|
+
data.tar.gz: 1304cfc00aa446928924977e8c883bd260b7b665c6309f5b1f8209f1491f5c6b451410349eec88ed108b5474d5ca238cffa6e89286a096aa58d62b0548435d93
|
@@ -63,12 +63,15 @@ initCkeditor = (textarea) ->
|
|
63
63
|
filebrowserBrowseUrl: '/effective/assets'
|
64
64
|
filebrowserImageBrowseUrl: '/effective/assets?only=images'
|
65
65
|
toolbar_full: [
|
66
|
-
{ name: 'definedstyles', items: ['Format'] },
|
67
66
|
{ name: 'html', items: ['ShowBlocks'] },
|
68
67
|
{ name: 'justify', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight']}
|
69
|
-
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline'] },
|
68
|
+
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'] },
|
70
69
|
{ name: 'insert', items: ['Link', 'Table', '-', 'Image', 'oembed', 'EffectiveAssets'] },
|
71
70
|
{ name: 'lists', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'] },
|
71
|
+
'/'
|
72
|
+
{ name: 'definedstyles', items: ['Format'] },
|
73
|
+
{ name: 'styles', items: ['Styles', 'RemoveFormat'] },
|
74
|
+
{ name: 'colors', items: ['TextColor', 'BGColor'] }
|
72
75
|
],
|
73
76
|
toolbar_simple: [
|
74
77
|
{ name: 'definedstyles', items: ['Format'] },
|
File without changes
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveCkeditorTextArea < Effective::FormBuilderInput
|
4
|
+
delegate :content_tag, :text_area_tag, :asset_path, :to => :@template
|
5
|
+
|
6
|
+
def default_input_js
|
7
|
+
{
|
8
|
+
effective_assets: defined?(EffectiveAssets).present?,
|
9
|
+
effective_ckeditor_js_path: asset_path('effective_ckeditor.js'),
|
10
|
+
effective_ckeditor_css_path: asset_path('effective_ckeditor.css'),
|
11
|
+
contentsCss: (
|
12
|
+
case options[:contentsCss]
|
13
|
+
when :bootstrap
|
14
|
+
'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'
|
15
|
+
when false
|
16
|
+
nil
|
17
|
+
else
|
18
|
+
options[:contentsCss] || asset_path('application.css')
|
19
|
+
end
|
20
|
+
),
|
21
|
+
toolbar: options[:toolbar],
|
22
|
+
height: options[:height],
|
23
|
+
width: options[:width]
|
24
|
+
}.compact
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_input_html
|
28
|
+
{class: 'effective_ckeditor_text_area text'}
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_html
|
32
|
+
text_area_tag(field_name, value, tag_options)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveDatePicker < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :text_field_tag, :to => :@template
|
5
5
|
|
6
6
|
def default_input_js
|
@@ -65,4 +65,3 @@ module Inputs
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveDateTimePicker < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :text_field_tag, :to => :@template
|
5
5
|
|
6
6
|
def default_input_js
|
@@ -59,4 +59,3 @@ module Inputs
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
data/app/models/{inputs/effective_email/input.rb → effective/form_builder_inputs/effective_email.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveEmail < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :email_field_tag, :to => :@template
|
5
5
|
|
6
6
|
def default_input_html
|
@@ -25,4 +25,3 @@ module Inputs
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
@@ -4,9 +4,9 @@
|
|
4
4
|
# Only supports one category, and one kind of objects
|
5
5
|
# No polymorphic stuff
|
6
6
|
|
7
|
-
module
|
8
|
-
module
|
9
|
-
class
|
7
|
+
module Effective
|
8
|
+
module FormBuilderInputs
|
9
|
+
class EffectivePanelSelect < Effective::FormBuilderInput
|
10
10
|
delegate :grouped_collection_select, :hidden_field_tag, :text_field_tag, :render, to: :@template
|
11
11
|
|
12
12
|
def default_options
|
data/app/models/{inputs/effective_price/input.rb → effective/form_builder_inputs/effective_price.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectivePrice < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :number_to_currency, :text_field_tag, :hidden_field_tag, :to => :@template
|
5
5
|
|
6
6
|
def default_options
|
@@ -53,4 +53,3 @@ module Inputs
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveRadioButtons < Effective::FormBuilderInput
|
4
4
|
delegate :collection_radio_buttons, :content_tag, :label_tag, :radio_button_tag, :image_tag, :to => :@template
|
5
5
|
|
6
6
|
BOOLEAN_COLLECTION = [['Yes', true], ['No', false]]
|
@@ -113,4 +113,3 @@ module Inputs
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
116
|
-
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveSelect < Effective::FormBuilderInput
|
4
4
|
delegate :collection_select, :grouped_collection_select, :hidden_field, :to => :@template
|
5
5
|
|
6
6
|
def default_options
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveStaticControl < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :to => :@template
|
5
5
|
|
6
6
|
def default_input_html
|
@@ -25,4 +25,3 @@ module Inputs
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
data/app/models/{inputs/effective_tel/input.rb → effective/form_builder_inputs/effective_tel.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveTel < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :telephone_field_tag, :to => :@template
|
5
5
|
|
6
6
|
DEFAULT_TEL_MASK = '(999) 999-9999? x99999'
|
@@ -62,4 +62,3 @@ module Inputs
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveTimePicker < Effective::FormBuilderInput
|
4
4
|
delegate :content_tag, :text_field_tag, :to => :@template
|
5
5
|
|
6
6
|
def default_input_js
|
@@ -44,4 +44,3 @@ module Inputs
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
data/app/models/{inputs/effective_url/input.rb → effective/form_builder_inputs/effective_url.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
class
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
class EffectiveUrl < Effective::FormBuilderInput
|
4
4
|
FA_FIELD_NAMES = ['facebook', 'google', 'linkedin', 'twitter', 'vimeo', 'youtube']
|
5
5
|
|
6
6
|
delegate :content_tag, :url_field_tag, :to => :@template
|
@@ -84,4 +84,3 @@ module Inputs
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
@@ -2,22 +2,24 @@ module EffectiveFormInputs
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
engine_name 'effective_form_inputs'
|
4
4
|
|
5
|
-
config.autoload_paths += Dir[
|
5
|
+
config.autoload_paths += Dir[
|
6
|
+
"#{config.root}/lib/validators/",
|
7
|
+
"#{config.root}/lib/effective_form_inputs/inputs",
|
8
|
+
|
9
|
+
]
|
10
|
+
|
11
|
+
config.eager_load_paths += Dir[
|
12
|
+
"#{config.root}/lib/validators/",
|
13
|
+
"#{config.root}/lib/effective_form_inputs/inputs",
|
14
|
+
]
|
6
15
|
|
7
16
|
initializer 'effective_form_inputs.action_view' do |app|
|
8
17
|
Rails.application.config.to_prepare do
|
9
18
|
ActiveSupport.on_load :action_view do
|
10
|
-
ActionView::Helpers::FormBuilder.send(:include, Effective::FormBuilderInputs)
|
19
|
+
ActionView::Helpers::FormBuilder.send(:include, ::Effective::FormBuilderInputs)
|
11
20
|
end
|
12
21
|
end
|
13
22
|
end
|
14
23
|
|
15
|
-
initializer 'effective_form_inputs.check_for_effective_bootstrap' do |app|
|
16
|
-
Rails.application.config.to_prepare do
|
17
|
-
if defined?(EffectiveBootstrap)
|
18
|
-
raise 'effective_form_inputs and effective_bootstrap cannot be run alongside eachother. Sorry.'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
24
|
end
|
23
25
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Effective
|
2
|
+
module FormBuilderInputs
|
3
|
+
def effective_ckeditor_text_area(method, options_tag = nil, options = {}, html_options = {})
|
4
|
+
EffectiveCkeditorTextArea.new(@object, @object_name, @template, method, options, html_options).to_html
|
5
|
+
end
|
6
|
+
|
7
|
+
def effective_date_time_picker(method, options = {})
|
8
|
+
EffectiveDateTimePicker.new(@object, @object_name, @template, method, options, options).to_html
|
9
|
+
end
|
10
|
+
|
11
|
+
def effective_date_picker(method, options = {})
|
12
|
+
EffectiveDatePicker.new(@object, @object_name, @template, method, options, options).to_html
|
13
|
+
end
|
14
|
+
|
15
|
+
def effective_panel_select(method, options_tag = nil, options = {}, html_options = {})
|
16
|
+
options[:collection] = options_tag
|
17
|
+
EffectivePanelSelect.new(@object, @object_name, @template, method, options, html_options).to_html
|
18
|
+
end
|
19
|
+
|
20
|
+
def effective_price(method, options = {})
|
21
|
+
EffectivePrice.new(@object, @object_name, @template, method, options, options).to_html
|
22
|
+
end
|
23
|
+
|
24
|
+
def effective_radio_buttons(method, options = {})
|
25
|
+
EffectiveRadioButtons.new(@object, @object_name, @template, method, options, options).to_html
|
26
|
+
end
|
27
|
+
|
28
|
+
def effective_static_control(method, options = {})
|
29
|
+
EffectiveStaticControl.new(@object, @object_name, @template, method, options, options).to_html
|
30
|
+
end
|
31
|
+
|
32
|
+
def effective_select(method, options_tag = nil, options = {}, html_options = {})
|
33
|
+
options[:collection] = options_tag
|
34
|
+
EffectiveSelect.new(@object, @object_name, @template, method, options, html_options).to_html
|
35
|
+
end
|
36
|
+
|
37
|
+
def effective_tel(method, options_tag = nil, options = {}, html_options = {})
|
38
|
+
EffectiveTel.new(@object, @object_name, @template, method, options, html_options).to_html
|
39
|
+
end
|
40
|
+
|
41
|
+
def effective_time_picker(method, options = {})
|
42
|
+
EffectiveTimePicker.new(@object, @object_name, @template, method, options, options).to_html
|
43
|
+
end
|
44
|
+
|
45
|
+
def effective_url(method, options_tag = nil, options = {}, html_options = {})
|
46
|
+
EffectiveUrl.new(@object, @object_name, @template, method, options, html_options).to_html
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveCkeditorTextAreaInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveCkeditorTextArea.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveDatePickerInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveDatePicker.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveDateTimePickerInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveDateTimePicker.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveEmailInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveEmail.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -11,7 +11,7 @@ if defined?(SimpleForm)
|
|
11
11
|
options[:label_method] = label_method unless options[:polymorphic]
|
12
12
|
options[:value_method] = value_method unless options[:polymorphic]
|
13
13
|
|
14
|
-
|
14
|
+
Effective::FormBuilderInputs::EffectivePanelSelect.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectivePriceInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectivePrice.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -31,7 +31,7 @@ if defined?(SimpleForm)
|
|
31
31
|
|
32
32
|
options[:wrapper_html][:class] = options[:wrapper_html][:class].join(' ')
|
33
33
|
|
34
|
-
|
34
|
+
Effective::FormBuilderInputs::EffectiveRadioButtons.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# = simple_form_for @thing do |f|
|
2
|
+
# = f.input :category, :as => :effective_select
|
3
|
+
|
4
|
+
if defined?(SimpleForm)
|
5
|
+
|
6
|
+
class EffectiveSelectInput < SimpleForm::Inputs::CollectionSelectInput
|
7
|
+
def input(wrapper_options = nil)
|
8
|
+
label_method, value_method = (detect_collection_methods rescue [:to_s, :to_s])
|
9
|
+
|
10
|
+
options[:collection] = collection
|
11
|
+
options[:label_method] = label_method unless options[:polymorphic]
|
12
|
+
options[:value_method] = value_method unless options[:polymorphic]
|
13
|
+
|
14
|
+
Effective::FormBuilderInputs::EffectiveSelect.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
15
|
+
end
|
16
|
+
|
17
|
+
# Apply ActsAsArchived behavior.
|
18
|
+
def collection
|
19
|
+
@collection ||= begin
|
20
|
+
collection = translate(options.delete(:collection)) || self.class.boolean_collection
|
21
|
+
collection.respond_to?(:call) ? collection.call : collection.to_a
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def translate(collection)
|
26
|
+
return collection unless object.respond_to?(:new_record?)
|
27
|
+
return collection unless collection.respond_to?(:klass) && collection.klass.respond_to?(:acts_as_archived?)
|
28
|
+
|
29
|
+
if object.new_record?
|
30
|
+
collection.unarchived
|
31
|
+
else
|
32
|
+
collection.unarchived.or(collection.archived.where(collection.klass.primary_key => object.send(attribute_name)))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveStaticControlInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveStaticControl.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveTelInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveTel.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -5,7 +5,7 @@ if defined?(SimpleForm)
|
|
5
5
|
|
6
6
|
class EffectiveTimePickerInput < SimpleForm::Inputs::StringInput
|
7
7
|
def input(wrapper_options = nil)
|
8
|
-
|
8
|
+
Effective::FormBuilderInputs::EffectiveTimePicker.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -7,7 +7,7 @@ if defined?(SimpleForm)
|
|
7
7
|
|
8
8
|
class EffectiveUrlInput < SimpleForm::Inputs::StringInput
|
9
9
|
def input(wrapper_options = nil)
|
10
|
-
|
10
|
+
Effective::FormBuilderInputs::EffectiveUrl.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_form_inputs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sassc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Collection of Form Inputs
|
42
56
|
email:
|
43
57
|
- info@codeandeffect.com
|
@@ -47,6 +61,7 @@ extra_rdoc_files: []
|
|
47
61
|
files:
|
48
62
|
- MIT-LICENSE
|
49
63
|
- README.md
|
64
|
+
- app/assets/config/effective_form_inputs_manifest.js
|
50
65
|
- app/assets/javascripts/effective_ckeditor_text_area/initialize.js.coffee
|
51
66
|
- app/assets/javascripts/effective_ckeditor_text_area/input.js
|
52
67
|
- app/assets/javascripts/effective_date_picker/initialize.js.coffee
|
@@ -82,52 +97,52 @@ files:
|
|
82
97
|
- app/assets/stylesheets/effective_form_inputs.scss
|
83
98
|
- app/assets/stylesheets/effective_panel_select/input.scss
|
84
99
|
- app/assets/stylesheets/effective_radio_buttons/input.scss
|
85
|
-
- app/assets/stylesheets/effective_select/bootstrap-theme.
|
100
|
+
- app/assets/stylesheets/effective_select/bootstrap-theme.scss
|
86
101
|
- app/assets/stylesheets/effective_select/input.scss
|
87
102
|
- app/assets/stylesheets/effective_select/overrides.scss
|
88
|
-
- app/assets/stylesheets/effective_select/select2.
|
103
|
+
- app/assets/stylesheets/effective_select/select2.scss
|
89
104
|
- app/assets/stylesheets/effective_time_picker/input.scss
|
90
105
|
- app/helpers/effective_bootstrap3_helper.rb
|
91
106
|
- app/helpers/effective_form_inputs_helper.rb
|
92
|
-
- app/models/effective/
|
93
|
-
- app/models/effective/
|
94
|
-
- app/models/
|
95
|
-
- app/models/
|
96
|
-
- app/models/
|
97
|
-
- app/models/
|
98
|
-
- app/models/
|
99
|
-
- app/models/
|
100
|
-
- app/models/
|
101
|
-
- app/models/
|
102
|
-
- app/models/
|
103
|
-
- app/models/
|
104
|
-
- app/models/
|
105
|
-
- app/models/inputs/effective_price_input.rb
|
106
|
-
- app/models/inputs/effective_radio_buttons/input.rb
|
107
|
-
- app/models/inputs/effective_radio_buttons_input.rb
|
108
|
-
- app/models/inputs/effective_select/input.rb
|
109
|
-
- app/models/inputs/effective_select_input.rb
|
110
|
-
- app/models/inputs/effective_static_control/input.rb
|
111
|
-
- app/models/inputs/effective_static_control_input.rb
|
112
|
-
- app/models/inputs/effective_tel/input.rb
|
113
|
-
- app/models/inputs/effective_tel_input.rb
|
114
|
-
- app/models/inputs/effective_time_picker/input.rb
|
115
|
-
- app/models/inputs/effective_time_picker_input.rb
|
116
|
-
- app/models/inputs/effective_url/input.rb
|
117
|
-
- app/models/inputs/effective_url_input.rb
|
118
|
-
- app/validators/effective_email_validator.rb
|
119
|
-
- app/validators/effective_tel_validator.rb
|
120
|
-
- app/validators/effective_url_validator.rb
|
107
|
+
- app/models/effective/form_builder_input.rb
|
108
|
+
- app/models/effective/form_builder_inputs/effective_ckeditor_text_area.rb
|
109
|
+
- app/models/effective/form_builder_inputs/effective_date_picker.rb
|
110
|
+
- app/models/effective/form_builder_inputs/effective_date_time_picker.rb
|
111
|
+
- app/models/effective/form_builder_inputs/effective_email.rb
|
112
|
+
- app/models/effective/form_builder_inputs/effective_panel_select.rb
|
113
|
+
- app/models/effective/form_builder_inputs/effective_price.rb
|
114
|
+
- app/models/effective/form_builder_inputs/effective_radio_buttons.rb
|
115
|
+
- app/models/effective/form_builder_inputs/effective_select.rb
|
116
|
+
- app/models/effective/form_builder_inputs/effective_static_control.rb
|
117
|
+
- app/models/effective/form_builder_inputs/effective_tel.rb
|
118
|
+
- app/models/effective/form_builder_inputs/effective_time_picker.rb
|
119
|
+
- app/models/effective/form_builder_inputs/effective_url.rb
|
121
120
|
- app/views/effective/effective_panel_select/_input.html.haml
|
122
121
|
- app/views/effective/style_guide/_effective_form_inputs.html.haml
|
123
122
|
- lib/effective_form_inputs.rb
|
124
123
|
- lib/effective_form_inputs/engine.rb
|
124
|
+
- lib/effective_form_inputs/form_builder_inputs.rb
|
125
|
+
- lib/effective_form_inputs/inputs/effective_ckeditor_text_area_input.rb
|
126
|
+
- lib/effective_form_inputs/inputs/effective_date_picker_input.rb
|
127
|
+
- lib/effective_form_inputs/inputs/effective_date_time_picker_input.rb
|
128
|
+
- lib/effective_form_inputs/inputs/effective_email_input.rb
|
129
|
+
- lib/effective_form_inputs/inputs/effective_panel_select_input.rb
|
130
|
+
- lib/effective_form_inputs/inputs/effective_price_input.rb
|
131
|
+
- lib/effective_form_inputs/inputs/effective_radio_buttons_input.rb
|
132
|
+
- lib/effective_form_inputs/inputs/effective_select_input.rb
|
133
|
+
- lib/effective_form_inputs/inputs/effective_static_control_input.rb
|
134
|
+
- lib/effective_form_inputs/inputs/effective_tel_input.rb
|
135
|
+
- lib/effective_form_inputs/inputs/effective_time_picker_input.rb
|
136
|
+
- lib/effective_form_inputs/inputs/effective_url_input.rb
|
125
137
|
- lib/effective_form_inputs/version.rb
|
138
|
+
- lib/validators/effective_email_validator.rb
|
139
|
+
- lib/validators/effective_tel_validator.rb
|
140
|
+
- lib/validators/effective_url_validator.rb
|
126
141
|
homepage: https://github.com/code-and-effect/effective_form_inputs
|
127
142
|
licenses:
|
128
143
|
- MIT
|
129
144
|
metadata: {}
|
130
|
-
post_install_message:
|
145
|
+
post_install_message:
|
131
146
|
rdoc_options: []
|
132
147
|
require_paths:
|
133
148
|
- lib
|
@@ -142,9 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
157
|
- !ruby/object:Gem::Version
|
143
158
|
version: '0'
|
144
159
|
requirements: []
|
145
|
-
|
146
|
-
|
147
|
-
signing_key:
|
160
|
+
rubygems_version: 3.1.2
|
161
|
+
signing_key:
|
148
162
|
specification_version: 4
|
149
163
|
summary: Collection of Form Inputs
|
150
164
|
test_files: []
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Effective
|
2
|
-
module FormBuilderInputs
|
3
|
-
def effective_ckeditor_text_area(method, options_tag = nil, options = {}, html_options = {})
|
4
|
-
Inputs::EffectiveCkeditorTextArea::Input.new(@object, @object_name, @template, method, options, html_options).to_html
|
5
|
-
end
|
6
|
-
|
7
|
-
def effective_date_time_picker(method, options = {})
|
8
|
-
Inputs::EffectiveDateTimePicker::Input.new(@object, @object_name, @template, method, options, options).to_html
|
9
|
-
end
|
10
|
-
|
11
|
-
def effective_date_picker(method, options = {})
|
12
|
-
Inputs::EffectiveDatePicker::Input.new(@object, @object_name, @template, method, options, options).to_html
|
13
|
-
end
|
14
|
-
|
15
|
-
def effective_panel_select(method, options_tag = nil, options = {}, html_options = {})
|
16
|
-
options[:collection] = options_tag
|
17
|
-
Inputs::EffectivePanelSelect::Input.new(@object, @object_name, @template, method, options, html_options).to_html
|
18
|
-
end
|
19
|
-
|
20
|
-
def effective_price(method, options = {})
|
21
|
-
Inputs::EffectivePrice::Input.new(@object, @object_name, @template, method, options, options).to_html
|
22
|
-
end
|
23
|
-
|
24
|
-
def effective_radio_buttons(method, options = {})
|
25
|
-
Inputs::EffectiveRadioButtons::Input.new(@object, @object_name, @template, method, options, options).to_html
|
26
|
-
end
|
27
|
-
|
28
|
-
def effective_static_control(method, options = {})
|
29
|
-
Inputs::EffectiveStaticControl::Input.new(@object, @object_name, @template, method, options, options).to_html
|
30
|
-
end
|
31
|
-
|
32
|
-
def effective_select(method, options_tag = nil, options = {}, html_options = {})
|
33
|
-
options[:collection] = options_tag
|
34
|
-
Inputs::EffectiveSelect::Input.new(@object, @object_name, @template, method, options, html_options).to_html
|
35
|
-
end
|
36
|
-
|
37
|
-
def effective_tel(method, options_tag = nil, options = {}, html_options = {})
|
38
|
-
Inputs::EffectiveTel::Input.new(@object, @object_name, @template, method, options, html_options).to_html
|
39
|
-
end
|
40
|
-
|
41
|
-
def effective_time_picker(method, options = {})
|
42
|
-
Inputs::EffectiveTimePicker::Input.new(@object, @object_name, @template, method, options, options).to_html
|
43
|
-
end
|
44
|
-
|
45
|
-
def effective_url(method, options_tag = nil, options = {}, html_options = {})
|
46
|
-
Inputs::EffectiveUrl::Input.new(@object, @object_name, @template, method, options, html_options).to_html
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Inputs
|
2
|
-
module EffectiveCkeditorTextArea
|
3
|
-
class Input < Effective::FormInput
|
4
|
-
delegate :content_tag, :text_area_tag, :asset_path, :to => :@template
|
5
|
-
|
6
|
-
def default_input_js
|
7
|
-
{
|
8
|
-
effective_assets: defined?(EffectiveAssets).present?,
|
9
|
-
effective_ckeditor_js_path: asset_path('effective_ckeditor.js'),
|
10
|
-
effective_ckeditor_css_path: asset_path('effective_ckeditor.css'),
|
11
|
-
contentsCss: (
|
12
|
-
case options[:contentsCss]
|
13
|
-
when :bootstrap
|
14
|
-
'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'
|
15
|
-
when false
|
16
|
-
nil
|
17
|
-
else
|
18
|
-
options[:contentsCss] || asset_path('application.css')
|
19
|
-
end
|
20
|
-
),
|
21
|
-
toolbar: options[:toolbar],
|
22
|
-
height: options[:height],
|
23
|
-
width: options[:width]
|
24
|
-
}.compact
|
25
|
-
end
|
26
|
-
|
27
|
-
def default_input_html
|
28
|
-
{class: 'effective_ckeditor_text_area text'}
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_html
|
32
|
-
text_area_tag(field_name, value, tag_options)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# = simple_form_for @thing do |f|
|
2
|
-
# = f.input :category, :as => :effective_select
|
3
|
-
|
4
|
-
if defined?(SimpleForm)
|
5
|
-
|
6
|
-
class EffectiveSelectInput < SimpleForm::Inputs::CollectionSelectInput
|
7
|
-
def input(wrapper_options = nil)
|
8
|
-
label_method, value_method = (detect_collection_methods rescue [:to_s, :to_s])
|
9
|
-
|
10
|
-
options[:collection] = collection
|
11
|
-
options[:label_method] = label_method unless options[:polymorphic]
|
12
|
-
options[:value_method] = value_method unless options[:polymorphic]
|
13
|
-
|
14
|
-
Inputs::EffectiveSelect::Input.new(object, object_name, template, attribute_name, input_options, (merge_wrapper_options(input_html_options, wrapper_options) || {})).to_html
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|