effective_bootstrap 1.26.3 → 1.27.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.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/app/assets/javascripts/effective_bootstrap/base.js.coffee +2 -0
- data/app/assets/javascripts/effective_bootstrap/form.js.coffee +3 -1
- data/app/assets/javascripts/effective_bootstrap/tabs.js +71 -21
- data/app/assets/javascripts/effective_has_many/initialize.js.coffee +7 -5
- data/app/assets/stylesheets/effective_bootstrap/overrides.scss +5 -0
- data/app/controllers/concerns/effective_bootstrap/save_tabs.rb +2 -5
- data/app/helpers/effective_article_editor_helper.rb +0 -1
- data/app/helpers/effective_bootstrap_helper.rb +103 -86
- data/app/helpers/effective_editor_helper.rb +0 -2
- data/app/helpers/effective_form_builder_helper.rb +0 -1
- data/app/helpers/effective_icons_helper.rb +0 -2
- data/app/helpers/effective_iframe_helper.rb +1 -3
- data/app/helpers/effective_table_builder_helper.rb +0 -2
- data/app/models/effective/form_builder.rb +0 -2
- data/app/models/effective/form_input.rb +3 -4
- data/app/models/effective/form_inputs/article_editor.rb +6 -8
- data/app/models/effective/form_inputs/check_box.rb +0 -2
- data/app/models/effective/form_inputs/checks.rb +0 -4
- data/app/models/effective/form_inputs/ck_editor.rb +0 -2
- data/app/models/effective/form_inputs/clear.rb +0 -2
- data/app/models/effective/form_inputs/collection_input.rb +3 -4
- data/app/models/effective/form_inputs/date_field.rb +2 -4
- data/app/models/effective/form_inputs/datetime_field.rb +0 -2
- data/app/models/effective/form_inputs/delete.rb +0 -2
- data/app/models/effective/form_inputs/editor.rb +3 -5
- data/app/models/effective/form_inputs/email_cc_field.rb +0 -2
- data/app/models/effective/form_inputs/email_field.rb +0 -2
- data/app/models/effective/form_inputs/error_field.rb +0 -2
- data/app/models/effective/form_inputs/file_field.rb +13 -9
- data/app/models/effective/form_inputs/float_field.rb +0 -2
- data/app/models/effective/form_inputs/form_group.rb +0 -2
- data/app/models/effective/form_inputs/has_many.rb +6 -7
- data/app/models/effective/form_inputs/hidden_field.rb +0 -2
- data/app/models/effective/form_inputs/integer_field.rb +0 -1
- data/app/models/effective/form_inputs/number_text_field.rb +0 -2
- data/app/models/effective/form_inputs/password_field.rb +0 -2
- data/app/models/effective/form_inputs/percent_field.rb +0 -2
- data/app/models/effective/form_inputs/phone_field.rb +0 -2
- data/app/models/effective/form_inputs/price_field.rb +0 -2
- data/app/models/effective/form_inputs/radios.rb +2 -4
- data/app/models/effective/form_inputs/remote_link_to.rb +0 -2
- data/app/models/effective/form_inputs/reset.rb +0 -2
- data/app/models/effective/form_inputs/rich_text_area.rb +0 -2
- data/app/models/effective/form_inputs/save.rb +0 -2
- data/app/models/effective/form_inputs/search_field.rb +0 -2
- data/app/models/effective/form_inputs/select.rb +2 -3
- data/app/models/effective/form_inputs/select_or_text.rb +9 -10
- data/app/models/effective/form_inputs/static_field.rb +3 -3
- data/app/models/effective/form_inputs/submit.rb +1 -3
- data/app/models/effective/form_inputs/text_area.rb +0 -2
- data/app/models/effective/form_inputs/text_field.rb +0 -2
- data/app/models/effective/form_inputs/time_field.rb +0 -2
- data/app/models/effective/form_inputs/time_zone_select.rb +0 -2
- data/app/models/effective/form_inputs/url_field.rb +0 -2
- data/app/models/effective/form_logic.rb +1 -2
- data/app/models/effective/form_logics/hide_if.rb +0 -2
- data/app/models/effective/form_logics/show_if.rb +0 -2
- data/app/models/effective/form_logics/show_if_any.rb +0 -2
- data/app/models/effective/table_builder.rb +3 -2
- data/app/models/effective/table_row.rb +0 -1
- data/app/models/effective/table_rows/article_editor.rb +0 -2
- data/app/models/effective/table_rows/belongs_to.rb +2 -2
- data/app/models/effective/table_rows/boolean.rb +0 -2
- data/app/models/effective/table_rows/collection.rb +0 -2
- data/app/models/effective/table_rows/content_for.rb +0 -2
- data/app/models/effective/table_rows/date_field.rb +1 -3
- data/app/models/effective/table_rows/datetime_field.rb +1 -3
- data/app/models/effective/table_rows/effective_address.rb +0 -2
- data/app/models/effective/table_rows/email_field.rb +0 -2
- data/app/models/effective/table_rows/file_field.rb +0 -2
- data/app/models/effective/table_rows/has_many_card.rb +0 -1
- data/app/models/effective/table_rows/percent_field.rb +0 -1
- data/app/models/effective/table_rows/phone_field.rb +0 -2
- data/app/models/effective/table_rows/price_field.rb +0 -2
- data/app/models/effective/table_rows/text_area.rb +0 -2
- data/app/models/effective/table_rows/url_field.rb +0 -2
- data/lib/effective_bootstrap/engine.rb +0 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- data/lib/effective_bootstrap.rb +0 -2
- data/lib/generators/effective_bootstrap/install_generator.rb +0 -1
- metadata +57 -1
|
@@ -12,7 +12,7 @@ module Effective
|
|
|
12
12
|
|
|
13
13
|
DEFAULT_INPUT_GROUP_OPTIONS = { input_group: { class: 'input-group' }, prepend: false, append: false }
|
|
14
14
|
|
|
15
|
-
HORIZONTAL_LABEL_OPTIONS = { class: 'col-sm-2 col-form-label'}
|
|
15
|
+
HORIZONTAL_LABEL_OPTIONS = { class: 'col-sm-2 col-form-label' }
|
|
16
16
|
INLINE_LABEL_OPTIONS = { class: 'sr-only' }
|
|
17
17
|
|
|
18
18
|
DEFAULT_FEEDBACK_OPTIONS = { valid: { class: 'valid-feedback' }, invalid: { class: 'invalid-feedback' } }
|
|
@@ -194,7 +194,7 @@ module Effective
|
|
|
194
194
|
return nil if key.blank?
|
|
195
195
|
|
|
196
196
|
hint = ::I18n.t(key)
|
|
197
|
-
return nil if hint.include?(key) # missing translation
|
|
197
|
+
return nil if hint.include?(key) # missing translation
|
|
198
198
|
|
|
199
199
|
hint
|
|
200
200
|
end
|
|
@@ -259,7 +259,7 @@ module Effective
|
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
def required_options?(opts)
|
|
262
|
-
return true unless
|
|
262
|
+
return true unless opts.key?(:if) || opts.key?(:unless)
|
|
263
263
|
|
|
264
264
|
# if opts[:if].respond_to?(:call)
|
|
265
265
|
# return object.instance_exec(object, &opts[:if])
|
|
@@ -482,6 +482,5 @@ module Effective
|
|
|
482
482
|
def input_js_options_method_name
|
|
483
483
|
{ method_name: "effective_#{self.class.name.split('::').last.underscore.chomp('_field')}" }
|
|
484
484
|
end
|
|
485
|
-
|
|
486
485
|
end
|
|
487
486
|
end
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class ArticleEditor < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
# https://imperavi.com/article/docs/settings/
|
|
8
7
|
def self.defaults
|
|
9
8
|
{
|
|
10
|
-
|
|
9
|
+
# This is overridden by the active_storage() method below
|
|
11
10
|
active_storage: nil,
|
|
12
11
|
|
|
13
12
|
# This is overridden by the css() method below
|
|
@@ -50,7 +49,7 @@ module Effective
|
|
|
50
49
|
gutter: '1px',
|
|
51
50
|
offset: {
|
|
52
51
|
left: '15px',
|
|
53
|
-
right: '15px'
|
|
52
|
+
right: '15px'
|
|
54
53
|
},
|
|
55
54
|
patterns: {
|
|
56
55
|
'6|6': 'col-md-6|col-md-6',
|
|
@@ -111,13 +110,13 @@ module Effective
|
|
|
111
110
|
'bordered': { title: 'Bordered', classname: 'table-bordered' },
|
|
112
111
|
'responsive': { title: 'Responsive', classname: 'table-responsive' },
|
|
113
112
|
'small': { title: 'Small', classname: 'table-sm' },
|
|
114
|
-
'striped': { title: 'Striped', classname: 'table-striped' }
|
|
113
|
+
'striped': { title: 'Striped', classname: 'table-striped' }
|
|
115
114
|
}
|
|
116
115
|
},
|
|
117
116
|
topbar: {
|
|
118
117
|
undoredo: true,
|
|
119
118
|
shortcuts: true
|
|
120
|
-
}
|
|
119
|
+
}
|
|
121
120
|
}
|
|
122
121
|
end
|
|
123
122
|
|
|
@@ -209,16 +208,15 @@ module Effective
|
|
|
209
208
|
|
|
210
209
|
def build_human_label
|
|
211
210
|
name = self.name.to_s
|
|
212
|
-
|
|
211
|
+
|
|
213
212
|
label = if object
|
|
214
213
|
object.class.human_attribute_name(name).sub(/^Rich text /, '').capitalize
|
|
215
214
|
else
|
|
216
215
|
BLANK
|
|
217
216
|
end
|
|
218
|
-
|
|
217
|
+
|
|
219
218
|
label
|
|
220
219
|
end
|
|
221
|
-
|
|
222
220
|
end
|
|
223
221
|
end
|
|
224
222
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class CheckBox < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def to_html(&block)
|
|
8
7
|
case layout
|
|
9
8
|
when :horizontal
|
|
@@ -66,7 +65,6 @@ module Effective
|
|
|
66
65
|
return @custom unless @custom.nil?
|
|
67
66
|
@custom = (options.delete(:custom) != false)
|
|
68
67
|
end
|
|
69
|
-
|
|
70
68
|
end
|
|
71
69
|
end
|
|
72
70
|
end
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Effective
|
|
4
|
-
|
|
5
4
|
module FormInputs
|
|
6
5
|
class Checks < CollectionInput
|
|
7
|
-
|
|
8
6
|
def build_input(&block)
|
|
9
7
|
html = @builder.collection_check_boxes(name, options_collection, value_method, label_method, collection_options, item_input_options) { |builder| build_item(builder) }
|
|
10
8
|
|
|
@@ -75,7 +73,6 @@ module Effective
|
|
|
75
73
|
content_tag(:label, options[:label]) do
|
|
76
74
|
[text, actions].compact.join.html_safe
|
|
77
75
|
end
|
|
78
|
-
|
|
79
76
|
end
|
|
80
77
|
|
|
81
78
|
def build_item(builder)
|
|
@@ -107,7 +104,6 @@ module Effective
|
|
|
107
104
|
return @actions unless @actions.nil?
|
|
108
105
|
@actions = (options[:input].delete(:actions) != false)
|
|
109
106
|
end
|
|
110
|
-
|
|
111
107
|
end
|
|
112
108
|
end
|
|
113
109
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class CkEditor < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
content = value.presence || (capture(&block) if block_given?)
|
|
9
8
|
@builder.super_text_area(name, (options[:input] || {}).merge(autocomplete: 'off'))
|
|
@@ -44,7 +43,6 @@ module Effective
|
|
|
44
43
|
def width
|
|
45
44
|
@width ||= options.delete(:width)
|
|
46
45
|
end
|
|
47
|
-
|
|
48
46
|
end
|
|
49
47
|
end
|
|
50
48
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class Clear < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def to_html(&block)
|
|
8
7
|
content_tag(:button, options[:input]) do
|
|
9
8
|
icon_name.present? ? (icon(icon_name) + name) : name
|
|
@@ -18,7 +17,6 @@ module Effective
|
|
|
18
17
|
return @icon unless @icon.nil?
|
|
19
18
|
@icon = options[:input].delete(:icon) || ''.html_safe
|
|
20
19
|
end
|
|
21
|
-
|
|
22
20
|
end
|
|
23
21
|
end
|
|
24
22
|
end
|
|
@@ -96,7 +96,7 @@ module Effective
|
|
|
96
96
|
collection.inject({}) { |h, (k, group)| h[k] = translate(group).map { |obj| [obj.to_s, "#{obj.class.model_name}_#{obj.id}"] }; h }
|
|
97
97
|
elsif grouped
|
|
98
98
|
collection.inject({}) { |h, (k, group)| h[k] = translate(group).map { |obj| obj }; h }
|
|
99
|
-
elsif
|
|
99
|
+
elsif collection == :boolean || collection == :booleans || collection == :boolean_collection
|
|
100
100
|
EffectiveBootstrap.boolean_collection
|
|
101
101
|
else
|
|
102
102
|
translate(collection).map { |obj| obj }
|
|
@@ -132,8 +132,8 @@ module Effective
|
|
|
132
132
|
first = Array(options_collection.values.first).first
|
|
133
133
|
|
|
134
134
|
string_of_strings = (
|
|
135
|
-
options_collection.kind_of?(Hash) &&
|
|
136
|
-
options_collection.keys.all? { |key| key.kind_of?(String) } &&
|
|
135
|
+
options_collection.kind_of?(Hash) &&
|
|
136
|
+
options_collection.keys.all? { |key| key.kind_of?(String) } &&
|
|
137
137
|
options_collection.values.all? { |values| values.kind_of?(Array) && values.all? { |value| value.kind_of?(String) } }
|
|
138
138
|
)
|
|
139
139
|
|
|
@@ -174,7 +174,6 @@ module Effective
|
|
|
174
174
|
def polymorphic_id_value
|
|
175
175
|
value.try(:id)
|
|
176
176
|
end
|
|
177
|
-
|
|
178
177
|
end
|
|
179
178
|
end
|
|
180
179
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class DateField < DatetimeField
|
|
6
|
-
|
|
7
6
|
def input_html_options
|
|
8
7
|
{
|
|
9
8
|
class: ['form-control', 'effective_date_time_picker', 'effective_date', ('not-date-linked' if not_date_linked?)].compact.join(' '),
|
|
@@ -17,8 +16,8 @@ module Effective
|
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
def input_group_options
|
|
20
|
-
{
|
|
21
|
-
input_group: { class: 'input-group effective_date_time_picker_input_group' },
|
|
19
|
+
{
|
|
20
|
+
input_group: { class: 'input-group effective_date_time_picker_input_group' },
|
|
22
21
|
prepend: (content_tag(:span, icon('calendar'), class: 'input-group-text') unless readonly?)
|
|
23
22
|
}
|
|
24
23
|
end
|
|
@@ -34,7 +33,6 @@ module Effective
|
|
|
34
33
|
def format # moment.js
|
|
35
34
|
'YYYY-MM-DD'
|
|
36
35
|
end
|
|
37
|
-
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class DatetimeField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def input_html_options
|
|
8
7
|
{
|
|
9
8
|
class: ['form-control', 'effective_date_time_picker', 'effective_datetime', ('not-date-linked' if not_date_linked?)].compact.join(' '),
|
|
@@ -80,7 +79,6 @@ module Effective
|
|
|
80
79
|
raise "unexpected date object #{obj}. Expected a DateTime, Range of DateTimes or String"
|
|
81
80
|
end
|
|
82
81
|
end
|
|
83
|
-
|
|
84
82
|
end
|
|
85
83
|
end
|
|
86
84
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class Editor < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
content = value.presence || (capture(&block) if block_given?)
|
|
9
8
|
|
|
@@ -39,8 +38,8 @@ module Effective
|
|
|
39
38
|
# [{'header': [1, 2, 3, 4, false] }],
|
|
40
39
|
['bold', 'italic', 'underline'],
|
|
41
40
|
['link', 'image', 'video'], # also 'code-block'
|
|
42
|
-
[{'list': 'ordered'}, {'list': 'bullet'}, 'blockquote'],
|
|
43
|
-
[{'align': [] }, 'clean']
|
|
41
|
+
[{ 'list': 'ordered' }, { 'list': 'bullet' }, 'blockquote'],
|
|
42
|
+
[{ 'align': [] }, 'clean']
|
|
44
43
|
]
|
|
45
44
|
end
|
|
46
45
|
|
|
@@ -56,7 +55,7 @@ module Effective
|
|
|
56
55
|
border: 'none',
|
|
57
56
|
color: 'white'
|
|
58
57
|
},
|
|
59
|
-
modules: [
|
|
58
|
+
modules: ['Resize', 'DisplaySize']
|
|
60
59
|
}
|
|
61
60
|
end
|
|
62
61
|
|
|
@@ -89,7 +88,6 @@ module Effective
|
|
|
89
88
|
end
|
|
90
89
|
)
|
|
91
90
|
end
|
|
92
|
-
|
|
93
91
|
end
|
|
94
92
|
end
|
|
95
93
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class EmailCcField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
@builder.super_text_field(name, options[:input])
|
|
9
8
|
end
|
|
@@ -15,7 +14,6 @@ module Effective
|
|
|
15
14
|
def input_group_options
|
|
16
15
|
{ input_group: { class: 'input-group' }, prepend: content_tag(:span, icon('at-sign'), class: 'input-group-text') }
|
|
17
16
|
end
|
|
18
|
-
|
|
19
17
|
end
|
|
20
18
|
end
|
|
21
19
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class EmailField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def input_html_options
|
|
8
7
|
{ class: 'form-control effective_email', placeholder: 'someone@example.com', id: tag_id }
|
|
9
8
|
end
|
|
@@ -16,7 +15,6 @@ module Effective
|
|
|
16
15
|
def validated?(name)
|
|
17
16
|
true
|
|
18
17
|
end
|
|
19
|
-
|
|
20
18
|
end
|
|
21
19
|
end
|
|
22
20
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class ErrorField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def input_html_options
|
|
8
7
|
{ class: 'alert alert-danger', id: tag_id }
|
|
9
8
|
end
|
|
@@ -43,7 +42,6 @@ module Effective
|
|
|
43
42
|
return @include_name unless @include_name.nil?
|
|
44
43
|
@include_name = options[:input].key?(:include_name) ? options[:input].delete(:include_name) : true
|
|
45
44
|
end
|
|
46
|
-
|
|
47
45
|
end
|
|
48
46
|
end
|
|
49
47
|
end
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class FileField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
7
|
+
@attachment_url = options[:input].delete(:attachment_url)
|
|
8
8
|
case attachments_style
|
|
9
9
|
when :card
|
|
10
10
|
build_existing_attachments + build_attachments + build_uploads_and_purge(super)
|
|
@@ -23,7 +23,7 @@ module Effective
|
|
|
23
23
|
direct_upload: true,
|
|
24
24
|
'data-direct-upload-url': (@template.main_app.rails_direct_uploads_url unless options[:direct_upload] == false),
|
|
25
25
|
'data-progress-template': progress_template,
|
|
26
|
-
'data-click-submit': (true if click_submit?)
|
|
26
|
+
'data-click-submit': (true if click_submit?)
|
|
27
27
|
}.compact
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -46,7 +46,7 @@ module Effective
|
|
|
46
46
|
|
|
47
47
|
# This has the affect of appending files to the has_many. Which usually isnt what we want
|
|
48
48
|
def build_existing_attachments
|
|
49
|
-
attachments = Array(object.send(name))
|
|
49
|
+
attachments = Array(object.send(name)).select { |attachment| attachment.blob&.persisted? }
|
|
50
50
|
|
|
51
51
|
attachments.map.with_index do |attachment, index|
|
|
52
52
|
if multiple?
|
|
@@ -60,7 +60,7 @@ module Effective
|
|
|
60
60
|
def build_attachments
|
|
61
61
|
return ''.html_safe unless object.respond_to?(name) && object.send(name).respond_to?(:attached?) && object.send(name).attached?
|
|
62
62
|
|
|
63
|
-
attachments = object.send(name).
|
|
63
|
+
attachments = Array(object.send(name)).select { |attachment| attachment.blob&.persisted? }
|
|
64
64
|
|
|
65
65
|
case attachments_style
|
|
66
66
|
when :card
|
|
@@ -90,9 +90,15 @@ module Effective
|
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
# Encrypted attachments can supply an authorized decrypted preview URL.
|
|
94
|
+
def attachment_url(attachment)
|
|
95
|
+
return @attachment_url.call(attachment) if @attachment_url.respond_to?(:call)
|
|
96
|
+
(@template.url_for(attachment) rescue false) ||
|
|
97
|
+
(Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true) rescue false)
|
|
98
|
+
end
|
|
99
|
+
|
|
93
100
|
def build_table_attachment(attachment)
|
|
94
|
-
url = (
|
|
95
|
-
url ||= (Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true) rescue false)
|
|
101
|
+
url = attachment_url(attachment)
|
|
96
102
|
|
|
97
103
|
return unless url
|
|
98
104
|
|
|
@@ -118,8 +124,7 @@ module Effective
|
|
|
118
124
|
end
|
|
119
125
|
|
|
120
126
|
def build_card_attachment(attachment)
|
|
121
|
-
url = (
|
|
122
|
-
url ||= (Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true) rescue false)
|
|
127
|
+
url = attachment_url(attachment)
|
|
123
128
|
|
|
124
129
|
return unless url
|
|
125
130
|
|
|
@@ -189,7 +194,6 @@ module Effective
|
|
|
189
194
|
def attachments_style
|
|
190
195
|
@attachments_style ||= (options[:input].delete(:attachments_style) || options[:input].delete(:attachment_style) || :card)
|
|
191
196
|
end
|
|
192
|
-
|
|
193
197
|
end
|
|
194
198
|
end
|
|
195
199
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class FloatField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
@builder.super_number_field(name, options[:input])
|
|
9
8
|
end
|
|
@@ -21,7 +20,6 @@ module Effective
|
|
|
21
20
|
def validated?(name)
|
|
22
21
|
true
|
|
23
22
|
end
|
|
24
|
-
|
|
25
23
|
end
|
|
26
24
|
end
|
|
27
25
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class FormGroup < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
content_tag(:label, (name || ' ').html_safe) + capture(&block)
|
|
9
8
|
end
|
|
@@ -11,7 +10,6 @@ module Effective
|
|
|
11
10
|
def feedback_options
|
|
12
11
|
false
|
|
13
12
|
end
|
|
14
|
-
|
|
15
13
|
end
|
|
16
14
|
end
|
|
17
15
|
end
|
|
@@ -167,7 +167,7 @@ module Effective
|
|
|
167
167
|
else
|
|
168
168
|
{ class: ['has-many-fields', "has-many-fields-#{display}"].join(' ') }
|
|
169
169
|
end
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
content_tag(:div, insert + render_fields(content, remove + reorder), opts)
|
|
172
172
|
end
|
|
173
173
|
|
|
@@ -195,7 +195,7 @@ module Effective
|
|
|
195
195
|
end
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
def render_insert
|
|
198
|
+
def render_insert
|
|
199
199
|
content_tag(:div, link_to_insert(), class: 'has-many-actions')
|
|
200
200
|
end
|
|
201
201
|
|
|
@@ -248,7 +248,7 @@ module Effective
|
|
|
248
248
|
class: 'has-many-insert ' + (html_class || 'btn btn-sm btn-secondary'),
|
|
249
249
|
title: (title || 'Insert Another'),
|
|
250
250
|
data: {
|
|
251
|
-
'effective-form-has-many-insert': true
|
|
251
|
+
'effective-form-has-many-insert': true
|
|
252
252
|
}
|
|
253
253
|
)
|
|
254
254
|
end
|
|
@@ -260,7 +260,7 @@ module Effective
|
|
|
260
260
|
class: 'has-many-reorder btn btn-sm btn-secondary',
|
|
261
261
|
title: 'Reorder',
|
|
262
262
|
data: {
|
|
263
|
-
'effective-form-has-many-reorder': true
|
|
263
|
+
'effective-form-has-many-reorder': true
|
|
264
264
|
}
|
|
265
265
|
)
|
|
266
266
|
end
|
|
@@ -280,7 +280,7 @@ module Effective
|
|
|
280
280
|
title: (title || 'Remove'),
|
|
281
281
|
data: {
|
|
282
282
|
'confirm': "Remove #{resource}?",
|
|
283
|
-
'effective-form-has-many-remove': true
|
|
283
|
+
'effective-form-has-many-remove': true
|
|
284
284
|
}
|
|
285
285
|
)
|
|
286
286
|
end
|
|
@@ -292,7 +292,7 @@ module Effective
|
|
|
292
292
|
class: 'has-many-remove-disabled btn btn-sm btn-danger',
|
|
293
293
|
title: 'Remove',
|
|
294
294
|
data: {
|
|
295
|
-
'effective-form-has-many-remove-disabled': true
|
|
295
|
+
'effective-form-has-many-remove-disabled': true
|
|
296
296
|
}
|
|
297
297
|
)
|
|
298
298
|
end
|
|
@@ -307,7 +307,6 @@ module Effective
|
|
|
307
307
|
object.send(name).delete(resource)
|
|
308
308
|
end
|
|
309
309
|
end
|
|
310
|
-
|
|
311
310
|
end
|
|
312
311
|
end
|
|
313
312
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class NumberTextField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
@builder.super_text_field(name, options[:input])
|
|
9
8
|
end
|
|
@@ -11,7 +10,6 @@ module Effective
|
|
|
11
10
|
def input_html_options
|
|
12
11
|
{ class: 'form-control effective_number_text', autocomplete: 'off', id: tag_id }
|
|
13
12
|
end
|
|
14
|
-
|
|
15
13
|
end
|
|
16
14
|
end
|
|
17
15
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class PasswordField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def input_html_options
|
|
8
7
|
{ class: 'form-control effective_password', id: tag_id }
|
|
9
8
|
end
|
|
@@ -34,7 +33,6 @@ module Effective
|
|
|
34
33
|
{ valid: { class: 'valid-feedback' }, invalid: { class: 'invalid-feedback' }, reset: true }
|
|
35
34
|
end
|
|
36
35
|
end
|
|
37
|
-
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class PercentField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
@builder.hidden_field(name, value: percent_to_integer, id: tag_id + '_value_as_integer') +
|
|
9
8
|
@template.text_field_tag(name, percent_to_s, options[:input].merge(id: tag_id, name: nil))
|
|
@@ -34,7 +33,6 @@ module Effective
|
|
|
34
33
|
str = value.kind_of?(Integer) ? ('%.3f' % (value / 1000.0)) : value.to_s
|
|
35
34
|
str.gsub('.000', '')
|
|
36
35
|
end
|
|
37
|
-
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class PhoneField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
DEFAULT_TEL_MASK = '(999) 999-9999? x99999'
|
|
8
7
|
DEFAULT_CELL_MASK = '(999) 999-9999'
|
|
9
8
|
|
|
@@ -35,7 +34,6 @@ module Effective
|
|
|
35
34
|
return @cell unless @cell.nil?
|
|
36
35
|
@cell = options.key?(:cell) ? options.delete(:cell) : name.to_s.include?('cell')
|
|
37
36
|
end
|
|
38
|
-
|
|
39
37
|
end
|
|
40
38
|
end
|
|
41
39
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class PriceField < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
@builder.hidden_field(name, value: price, id: tag_id + '_value_as_integer') +
|
|
9
8
|
@template.text_field_tag(name, @template.number_to_currency(currency, unit: ''), options[:input].merge(id: tag_id, name: nil))
|
|
@@ -28,7 +27,6 @@ module Effective
|
|
|
28
27
|
return nil unless value
|
|
29
28
|
value.kind_of?(Integer) ? ('%.2f' % (value / 100.0)) : value
|
|
30
29
|
end
|
|
31
|
-
|
|
32
30
|
end
|
|
33
31
|
end
|
|
34
32
|
end
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
module Effective
|
|
15
15
|
module FormInputs
|
|
16
16
|
class Radios < CollectionInput
|
|
17
|
-
|
|
18
17
|
def build_wrapper(&block)
|
|
19
18
|
tag = (buttons? || cards?) ? :div : :fieldset
|
|
20
19
|
|
|
@@ -110,12 +109,12 @@ module Effective
|
|
|
110
109
|
|
|
111
110
|
if buttons?
|
|
112
111
|
opts = item_label_options.merge(for: item_id)
|
|
113
|
-
opts[:class] = [opts[:class], ('active' if active_item?(builder)), ('first-button' if first_item?)
|
|
112
|
+
opts[:class] = [opts[:class], ('active' if active_item?(builder)), ('first-button' if first_item?)].compact.join(' ')
|
|
114
113
|
|
|
115
114
|
builder.label(opts) { builder.radio_button(id: item_id) + builder.text }
|
|
116
115
|
elsif cards?
|
|
117
116
|
opts = item_label_options.merge(for: item_id)
|
|
118
|
-
opts[:class] = [opts[:class], ('active' if active_item?(builder)), ('first-card' if first_item?)
|
|
117
|
+
opts[:class] = [opts[:class], ('active' if active_item?(builder)), ('first-card' if first_item?)].compact.join(' ')
|
|
119
118
|
|
|
120
119
|
builder.label(opts) { builder.radio_button(id: item_id) + build_item_wrap { builder.text } }
|
|
121
120
|
else
|
|
@@ -187,7 +186,6 @@ module Effective
|
|
|
187
186
|
value = self.value || collection_options[:checked]
|
|
188
187
|
value == builder.value || Array(value).map(&:to_s) == Array(builder.value).map(&:to_s)
|
|
189
188
|
end
|
|
190
|
-
|
|
191
189
|
end
|
|
192
190
|
end
|
|
193
191
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class RemoteLinkTo < Submit
|
|
6
|
-
|
|
7
6
|
def build_input(&block)
|
|
8
7
|
tags = [
|
|
9
8
|
icon('check', style: 'display: none;'),
|
|
@@ -26,7 +25,6 @@ module Effective
|
|
|
26
25
|
def confirm
|
|
27
26
|
(options.delete(:confirm) || "#{name} to<br>#{object}?").html_safe
|
|
28
27
|
end
|
|
29
|
-
|
|
30
28
|
end
|
|
31
29
|
end
|
|
32
30
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Effective
|
|
4
4
|
module FormInputs
|
|
5
5
|
class Reset < Effective::FormInput
|
|
6
|
-
|
|
7
6
|
def to_html(&block)
|
|
8
7
|
content_tag(:button, options[:input]) do
|
|
9
8
|
icon_name.present? ? (icon(icon_name) + name) : name
|
|
@@ -18,7 +17,6 @@ module Effective
|
|
|
18
17
|
return @icon unless @icon.nil?
|
|
19
18
|
@icon = options[:input].delete(:icon) || ''.html_safe
|
|
20
19
|
end
|
|
21
|
-
|
|
22
20
|
end
|
|
23
21
|
end
|
|
24
22
|
end
|