cm-admin 1.1.7 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.vscode/settings.json +3 -0
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/cm_admin/scaffolds.js +1 -1
- data/app/assets/stylesheets/cm_admin/base/navbar.scss +13 -39
- data/app/assets/stylesheets/cm_admin/base/quicksearch.scss +3 -4
- data/app/assets/stylesheets/cm_admin/base/show.scss +4 -15
- data/app/assets/stylesheets/cm_admin/base/table.scss +2 -14
- data/app/assets/stylesheets/cm_admin/cm_admin.css.scss +1 -0
- data/app/assets/stylesheets/cm_admin/components/_buttons.scss +29 -135
- data/app/assets/stylesheets/cm_admin/dependency/bootstrap.min.css +4 -5
- data/app/assets/stylesheets/cm_admin/dependency/jquery-jgrowl.min.css +1 -0
- data/app/assets/stylesheets/cm_admin/helpers/_variable.scss +31 -30
- data/app/assets/stylesheets/cm_admin/pages/import_page.scss +3 -10
- data/app/controllers/cm_admin/resource_controller.rb +13 -9
- data/app/views/cm_admin/main/_actions_dropdown.html.slim +1 -3
- data/app/views/cm_admin/main/_associated_table.html.slim +1 -1
- data/app/views/cm_admin/main/_nested_fields.html.slim +2 -1
- data/app/views/cm_admin/main/_nested_table_form.html.slim +1 -1
- data/app/views/cm_admin/main/_tabs.html.slim +1 -1
- data/app/views/cm_admin/main/_top_navbar.html.slim +11 -17
- data/app/views/cm_admin/main/history.html.slim +3 -4
- data/app/views/cm_admin/main/import_form.html.slim +2 -2
- data/app/views/cm_admin/main/new.html.slim +1 -1
- data/app/views/cm_admin/main/show.html.slim +3 -4
- data/app/views/layouts/_cm_flash_message.html.slim +3 -3
- data/app/views/layouts/_quick_links.html.slim +2 -2
- data/app/views/layouts/cm_admin.html.slim +10 -12
- data/lib/cm_admin/models/filter.rb +55 -29
- data/lib/cm_admin/models/form_field.rb +18 -3
- data/lib/cm_admin/models/utils/helpers.rb +14 -0
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/filter_helper.rb +1 -1
- data/lib/cm_admin/view_helpers/form_field_helper.rb +16 -17
- data/lib/cm_admin/view_helpers/form_helper.rb +2 -1
- data/lib/cm_admin/view_helpers/manage_column_popup_helper.rb +2 -2
- data/lib/cm_admin/view_helpers/page_info_helper.rb +4 -4
- data/lib/cm_admin/view_helpers.rb +2 -1
- metadata +5 -2
@@ -7,7 +7,7 @@ module CmAdmin
|
|
7
7
|
value = cm_field.helper_method ? send(cm_field.helper_method, form_obj.object, cm_field.field_name) : form_obj.object.send(cm_field.field_name)
|
8
8
|
is_required = form_obj.object._validators[cm_field.field_name].map(&:kind).include?(:presence)
|
9
9
|
required_class = is_required ? 'required' : ''
|
10
|
-
target_action = @model.available_actions.select{|x| x.name == cm_field.target[:action_name].to_s}.first if cm_field.target.present?
|
10
|
+
target_action = @model.available_actions.select { |x| x.name == cm_field.target[:action_name].to_s }.first if cm_field.target.present?
|
11
11
|
send("cm_#{cm_field.input_type}_field", form_obj, cm_field, value, required_class, target_action)
|
12
12
|
end
|
13
13
|
|
@@ -16,7 +16,7 @@ module CmAdmin
|
|
16
16
|
class: "normal-input #{required_class}",
|
17
17
|
disabled: cm_field.disabled,
|
18
18
|
value: value,
|
19
|
-
placeholder:
|
19
|
+
placeholder: cm_field.placeholder,
|
20
20
|
data: { behaviour: 'integer-only' }
|
21
21
|
end
|
22
22
|
|
@@ -25,7 +25,7 @@ module CmAdmin
|
|
25
25
|
class: "normal-input #{required_class}",
|
26
26
|
disabled: cm_field.disabled,
|
27
27
|
value: value,
|
28
|
-
placeholder:
|
28
|
+
placeholder: cm_field.placeholder,
|
29
29
|
data: { behaviour: 'decimal-only' }
|
30
30
|
end
|
31
31
|
|
@@ -34,12 +34,12 @@ module CmAdmin
|
|
34
34
|
class: "normal-input #{required_class}",
|
35
35
|
disabled: cm_field.disabled,
|
36
36
|
value: value,
|
37
|
-
placeholder:
|
37
|
+
placeholder: cm_field.placeholder
|
38
38
|
end
|
39
39
|
|
40
40
|
def cm_single_select_field(form_obj, cm_field, value, required_class, target_action)
|
41
41
|
form_obj.select cm_field.field_name, options_for_select(select_collection_value(form_obj.object, cm_field), form_obj.object.send(cm_field.field_name)),
|
42
|
-
{ include_blank: cm_field.placeholder
|
42
|
+
{ include_blank: cm_field.placeholder },
|
43
43
|
class: "normal-input #{required_class} select-2",
|
44
44
|
disabled: cm_field.disabled,
|
45
45
|
data: {
|
@@ -53,7 +53,7 @@ module CmAdmin
|
|
53
53
|
def cm_multi_select_field(form_obj, cm_field, value, required_class, target_action)
|
54
54
|
form_obj.select cm_field.field_name,
|
55
55
|
options_for_select(select_collection_value(form_obj.object, cm_field), form_obj.object.send(cm_field.field_name)),
|
56
|
-
{ include_blank: cm_field.placeholder
|
56
|
+
{ include_blank: cm_field.placeholder },
|
57
57
|
class: "normal-input #{required_class} select-2",
|
58
58
|
disabled: cm_field.disabled, multiple: true
|
59
59
|
end
|
@@ -63,7 +63,7 @@ module CmAdmin
|
|
63
63
|
class: "normal-input #{required_class}",
|
64
64
|
disabled: cm_field.disabled,
|
65
65
|
value: value&.strftime('%d-%m-%Y'),
|
66
|
-
placeholder:
|
66
|
+
placeholder: cm_field.placeholder,
|
67
67
|
data: { behaviour: 'date-only' }
|
68
68
|
end
|
69
69
|
|
@@ -72,20 +72,20 @@ module CmAdmin
|
|
72
72
|
class: "normal-input #{required_class}",
|
73
73
|
disabled: cm_field.disabled,
|
74
74
|
value: value,
|
75
|
-
placeholder:
|
75
|
+
placeholder: cm_field.placeholder,
|
76
76
|
data: { behaviour: 'date-time' }
|
77
77
|
end
|
78
78
|
|
79
79
|
def cm_text_field(form_obj, cm_field, value, required_class, _target_action)
|
80
80
|
form_obj.text_area cm_field.field_name,
|
81
81
|
class: "normal-input #{required_class}",
|
82
|
-
placeholder:
|
82
|
+
placeholder: cm_field.placeholder
|
83
83
|
end
|
84
84
|
|
85
85
|
def cm_rich_text_field(form_obj, cm_field, value, required_class, _target_action)
|
86
86
|
form_obj.rich_text_area cm_field.field_name,
|
87
87
|
class: "normal-input #{required_class}",
|
88
|
-
placeholder:
|
88
|
+
placeholder: cm_field.placeholder
|
89
89
|
end
|
90
90
|
|
91
91
|
def cm_single_file_upload_field(form_obj, cm_field, _value, required_class, _target_action)
|
@@ -114,16 +114,16 @@ module CmAdmin
|
|
114
114
|
# helper_method argument will accept a method where value can be passed.
|
115
115
|
def select_collection_value(object, cm_field)
|
116
116
|
if cm_field.helper_method
|
117
|
-
|
117
|
+
send(cm_field.helper_method, object, cm_field.field_name)
|
118
118
|
elsif cm_field.collection
|
119
|
-
|
119
|
+
cm_field.collection
|
120
120
|
else
|
121
|
-
|
121
|
+
[]
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
125
|
def format_check_box_options(value, form_obj, cm_field, required_class, target_action)
|
126
|
-
if value.
|
126
|
+
if value.instance_of?(Array)
|
127
127
|
format_check_box_array(value, form_obj, cm_field, required_class, target_action)
|
128
128
|
else
|
129
129
|
form_obj.check_box cm_field.field_name,
|
@@ -131,7 +131,7 @@ module CmAdmin
|
|
131
131
|
class: "normal-input cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
|
132
132
|
disabled: cm_field.disabled,
|
133
133
|
data: {
|
134
|
-
field_name: cm_field.field_name,
|
134
|
+
field_name: cm_field.field_name,
|
135
135
|
target_action: target_action&.name,
|
136
136
|
target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
|
137
137
|
}
|
@@ -169,7 +169,6 @@ module CmAdmin
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
-
|
173
172
|
def format_radio_button_options(options, form_obj)
|
174
173
|
content_tag :div do
|
175
174
|
options.each do |val, key|
|
@@ -177,7 +176,7 @@ module CmAdmin
|
|
177
176
|
end
|
178
177
|
end
|
179
178
|
end
|
180
|
-
|
179
|
+
|
181
180
|
def format_radio_option(val, key, form_obj)
|
182
181
|
content_tag :div, class: 'cm-radio-section' do
|
183
182
|
concat format_radio_button(val, form_obj)
|
@@ -94,7 +94,8 @@ module CmAdmin
|
|
94
94
|
end
|
95
95
|
concat split_form_into_section(resource, form_obj, sections_array)
|
96
96
|
concat tag.br
|
97
|
-
|
97
|
+
# TODO: form_submit class is used for JS functionality, Have to remove
|
98
|
+
concat form_obj.submit 'Save', class: 'btn-cta mt-3 form_submit', data: {form_class: "cm_#{form_obj.object.class.name.downcase}_form"}
|
98
99
|
end
|
99
100
|
end
|
100
101
|
end
|
@@ -65,8 +65,8 @@ module CmAdmin
|
|
65
65
|
|
66
66
|
def manage_column_footer
|
67
67
|
concat(content_tag(:div, class: 'modal-footer') do
|
68
|
-
concat tag.button 'Close', class: '
|
69
|
-
concat tag.button 'Save', class: 'cta
|
68
|
+
concat tag.button 'Close', class: 'btn-secondary', data: {bs_dismiss: 'modal'}
|
69
|
+
concat tag.button 'Save', class: 'btn-cta'
|
70
70
|
end)
|
71
71
|
return
|
72
72
|
end
|
@@ -67,7 +67,7 @@ module CmAdmin
|
|
67
67
|
when :modal
|
68
68
|
custom_modal_button(custom_action)
|
69
69
|
when :page
|
70
|
-
link_to custom_action_title(custom_action), "#{@model.ar_model.table_name}/#{custom_action.path}", class: 'secondary
|
70
|
+
link_to custom_action_title(custom_action), "#{@model.ar_model.table_name}/#{custom_action.path}", class: 'btn-secondary ml-2', method: custom_action.verb
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -83,14 +83,14 @@ module CmAdmin
|
|
83
83
|
|
84
84
|
def custom_action_button(custom_action, current_action_name)
|
85
85
|
if current_action_name == "index"
|
86
|
-
button_to custom_action_title(custom_action), @model.ar_model.table_name + '/' + custom_action.path, class: 'secondary
|
86
|
+
button_to custom_action_title(custom_action), @model.ar_model.table_name + '/' + custom_action.path, class: 'btn-secondary ml-2', method: custom_action.verb
|
87
87
|
elsif current_action_name == "show"
|
88
|
-
button_to custom_action_title(custom_action), custom_action.path.gsub(':id', params[:id]), class: 'secondary
|
88
|
+
button_to custom_action_title(custom_action), custom_action.path.gsub(':id', params[:id]), class: 'btn-secondary ml-2', method: custom_action.verb
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
92
|
def custom_modal_button(custom_action)
|
93
|
-
link_to custom_action_title(custom_action), '', class: 'secondary
|
93
|
+
link_to custom_action_title(custom_action), '', class: 'btn-secondary ml-2', data: { bs_toggle: "modal", bs_target: "##{custom_action.name.classify}Modal" }
|
94
94
|
end
|
95
95
|
|
96
96
|
def custom_action_title(custom_action)
|
@@ -53,7 +53,8 @@ module CmAdmin
|
|
53
53
|
concat hidden_field_tag 'class_name', klass.name.to_s, id: 'export-to-file-klass'
|
54
54
|
concat checkbox_row(klass)
|
55
55
|
concat tag.hr
|
56
|
-
|
56
|
+
# TODO: export-to-file-btn class is used for JS functionality, Have to remove
|
57
|
+
concat submit_tag 'Export', class: 'btn-primary export-to-file-btn'
|
57
58
|
end
|
58
59
|
end
|
59
60
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cm-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sajinmp
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-08-
|
13
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- ".rubocop.yml"
|
173
173
|
- ".stylelintrc.json"
|
174
174
|
- ".travis.yml"
|
175
|
+
- ".vscode/settings.json"
|
175
176
|
- CODE_OF_CONDUCT.md
|
176
177
|
- Gemfile
|
177
178
|
- Gemfile.lock
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- app/assets/stylesheets/cm_admin/dependency/bootstrap.min.css
|
225
226
|
- app/assets/stylesheets/cm_admin/dependency/flatpickr.min.css
|
226
227
|
- app/assets/stylesheets/cm_admin/dependency/fontawesome.all.css
|
228
|
+
- app/assets/stylesheets/cm_admin/dependency/jquery-jgrowl.min.css
|
227
229
|
- app/assets/stylesheets/cm_admin/helpers/_mixins.scss
|
228
230
|
- app/assets/stylesheets/cm_admin/helpers/_variable.scss
|
229
231
|
- app/assets/stylesheets/cm_admin/helpers/index.scss
|
@@ -310,6 +312,7 @@ files:
|
|
310
312
|
- lib/cm_admin/models/section.rb
|
311
313
|
- lib/cm_admin/models/tab.rb
|
312
314
|
- lib/cm_admin/models/utils/associations.rb
|
315
|
+
- lib/cm_admin/models/utils/helpers.rb
|
313
316
|
- lib/cm_admin/utils.rb
|
314
317
|
- lib/cm_admin/version.rb
|
315
318
|
- lib/cm_admin/version_manager.rb
|