cm-admin 1.4.5 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/app/assets/javascripts/cm_admin/scaffolds.js +20 -3
- data/app/controllers/cm_admin/resource_controller.rb +15 -12
- data/app/javascript/packs/cm_admin/scaffolds.js +1 -1
- data/app/views/cm_admin/main/_actions_dropdown.html.slim +4 -4
- data/app/views/cm_admin/main/_associated_table.html.slim +1 -1
- data/app/views/cm_admin/main/_table.html.slim +1 -1
- data/app/views/cm_admin/main/_tabs.html.slim +3 -3
- data/app/views/layouts/_destroy_action_modal.html.slim +4 -5
- data/lib/cm_admin/models/form_field.rb +1 -1
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers/field_display_helper.rb +2 -2
- data/lib/cm_admin/view_helpers/form_field_helper.rb +16 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0616f7649aac8382d9b74d034ff4bb55287f911cdfc5316be4fa9f33ccfc26a5
|
4
|
+
data.tar.gz: 02ea79e4c6e59777013276da852a30e476a5e847ff7eac90702908dc4c759656
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f68ebbb03c82e19b7f262c70006f4edf096073013e6c422eb20b43096fbdda004d37e537fd0ffe46c0f8f376442b0c3314b32d0227c21bc0bd5377b4a6e848
|
7
|
+
data.tar.gz: f836df493c54f15c8267b8a9458c67a7844489539274655648aef4cde0caf1250e12f1a9bb6b889a7244d21e21579908f0de7e75f5091f0643f6a294281a7e4f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cm-admin (1.4.
|
4
|
+
cm-admin (1.4.7)
|
5
5
|
caxlsx_rails
|
6
6
|
cocoon (~> 1.2.15)
|
7
7
|
csv-importer (~> 0.8.2)
|
@@ -87,7 +87,7 @@ GEM
|
|
87
87
|
ice_nine (~> 0.11.0)
|
88
88
|
thread_safe (~> 0.3, >= 0.3.1)
|
89
89
|
builder (3.2.4)
|
90
|
-
caxlsx (4.
|
90
|
+
caxlsx (4.1.0)
|
91
91
|
htmlentities (~> 4.3, >= 4.3.4)
|
92
92
|
marcel (~> 1.0)
|
93
93
|
nokogiri (~> 1.10, >= 1.10.4)
|
@@ -127,11 +127,11 @@ GEM
|
|
127
127
|
net-imap
|
128
128
|
net-pop
|
129
129
|
net-smtp
|
130
|
-
marcel (1.0.
|
130
|
+
marcel (1.0.4)
|
131
131
|
method_source (1.0.0)
|
132
132
|
mini_mime (1.1.5)
|
133
133
|
minitest (5.18.1)
|
134
|
-
net-imap (0.4.
|
134
|
+
net-imap (0.4.10)
|
135
135
|
date
|
136
136
|
net-protocol
|
137
137
|
net-pop (0.1.2)
|
@@ -140,8 +140,8 @@ GEM
|
|
140
140
|
timeout
|
141
141
|
net-smtp (0.4.0.1)
|
142
142
|
net-protocol
|
143
|
-
nio4r (2.7.
|
144
|
-
nokogiri (1.16.
|
143
|
+
nio4r (2.7.1)
|
144
|
+
nokogiri (1.16.3-arm64-darwin)
|
145
145
|
racc (~> 1.4)
|
146
146
|
pagy (4.11.0)
|
147
147
|
parallel (1.22.1)
|
@@ -226,7 +226,7 @@ GEM
|
|
226
226
|
temple (>= 0.7.6, < 0.9)
|
227
227
|
tilt (>= 2.0.6, < 2.1)
|
228
228
|
temple (0.8.2)
|
229
|
-
thor (1.3.
|
229
|
+
thor (1.3.1)
|
230
230
|
thread_safe (0.3.6)
|
231
231
|
tilt (2.0.10)
|
232
232
|
timeout (0.4.1)
|
@@ -245,7 +245,7 @@ GEM
|
|
245
245
|
websocket-driver (0.7.6)
|
246
246
|
websocket-extensions (>= 0.1.0)
|
247
247
|
websocket-extensions (0.1.5)
|
248
|
-
zeitwerk (2.6.
|
248
|
+
zeitwerk (2.6.13)
|
249
249
|
|
250
250
|
PLATFORMS
|
251
251
|
arm64-darwin-20
|
@@ -18,7 +18,6 @@ import 'flatpickr'
|
|
18
18
|
import 'jgrowl'
|
19
19
|
import Select2 from "select2"
|
20
20
|
Select2()
|
21
|
-
jqueryJgrowl()
|
22
21
|
|
23
22
|
// import '@nathanvda/cocoon'
|
24
23
|
import 'daterangepicker'
|
@@ -39,7 +38,8 @@ document.addEventListener("turbo:load", function () {
|
|
39
38
|
$('.select-2').select2({
|
40
39
|
theme: "bootstrap-5",
|
41
40
|
});
|
42
|
-
|
41
|
+
jqueryJgrowl()
|
42
|
+
setup_select_2_ajax();
|
43
43
|
});
|
44
44
|
|
45
45
|
$(document).on('click', '.menu-item', function(e) {
|
@@ -52,4 +52,21 @@ $(document).on('click', '.destroy-attachment', function(e) {
|
|
52
52
|
$(this).append('<input type="text" name="attachment_destroy_ids[]" value="' + ar_id + '"/>')
|
53
53
|
})
|
54
54
|
|
55
|
-
window.addEventListener('popstate', e => window.location.reload() );
|
55
|
+
window.addEventListener('popstate', e => window.location.reload() );
|
56
|
+
|
57
|
+
function setup_select_2_ajax(){
|
58
|
+
$(".select-2-ajax").each(function(index, element){
|
59
|
+
$(element).select2({
|
60
|
+
ajax: {
|
61
|
+
url: $(element)[0]['dataset'].ajaxUrl,
|
62
|
+
dataType: 'json',
|
63
|
+
processResults: (data, params) => {
|
64
|
+
return {
|
65
|
+
results: data.results,
|
66
|
+
}
|
67
|
+
},
|
68
|
+
},
|
69
|
+
minimumInputLength: 0
|
70
|
+
});
|
71
|
+
});
|
72
|
+
}
|
@@ -31,7 +31,7 @@ module CmAdmin
|
|
31
31
|
def cm_show(params)
|
32
32
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: 'show')
|
33
33
|
scoped_model = "CmAdmin::#{@model.name}Policy::Scope".constantize.new(Current.user, @model.name.constantize).resolve
|
34
|
-
@ar_object = scoped_model
|
34
|
+
@ar_object = fetch_ar_object(scoped_model, params[:id])
|
35
35
|
resource_identifier
|
36
36
|
respond_to do |format|
|
37
37
|
if request.xhr?
|
@@ -53,7 +53,7 @@ module CmAdmin
|
|
53
53
|
|
54
54
|
def cm_edit(params)
|
55
55
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: 'edit')
|
56
|
-
@ar_object = @model.ar_model.name.classify.constantize
|
56
|
+
@ar_object = fetch_ar_object(@model.ar_model.name.classify.constantize, params[:id])
|
57
57
|
resource_identifier
|
58
58
|
respond_to do |format|
|
59
59
|
format.html { render '/cm_admin/main/' + action_name }
|
@@ -61,7 +61,7 @@ module CmAdmin
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def cm_update(params)
|
64
|
-
@ar_object = @model.ar_model.name.classify.constantize
|
64
|
+
@ar_object = fetch_ar_object(@model.ar_model.name.classify.constantize, params[:id])
|
65
65
|
@ar_object.assign_attributes(resource_params(params))
|
66
66
|
resource_identifier
|
67
67
|
resource_responder
|
@@ -74,7 +74,7 @@ module CmAdmin
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def cm_destroy(params)
|
77
|
-
@ar_object = @model.ar_model.name.classify.constantize
|
77
|
+
@ar_object = fetch_ar_object(@model.ar_model.name.classify.constantize, params[:id])
|
78
78
|
redirect_url = request.referrer || cm_admin.send("#{@model.name.underscore}_index_path")
|
79
79
|
respond_to do |format|
|
80
80
|
if @ar_object.destroy
|
@@ -185,7 +185,7 @@ module CmAdmin
|
|
185
185
|
@ar_object, @associated_model, @associated_ar_object = custom_controller_action(action_name, params.permit!) if !@ar_object.present? && params[:id].present?
|
186
186
|
authorize @ar_object, policy_class: "CmAdmin::#{controller_name.classify}Policy".constantize if defined? "CmAdmin::#{controller_name.classify}Policy".constantize
|
187
187
|
aar_model = request.url.split('/')[-2].classify.constantize if params[:aar_id]
|
188
|
-
@associated_ar_object = aar_model
|
188
|
+
@associated_ar_object = fetch_ar_object(aar_model, params[:aar_id]) if params[:aar_id]
|
189
189
|
nested_fields = get_nested_table_fields(@model.available_fields[:new])
|
190
190
|
nested_fields += get_nested_table_fields(@model.available_fields[:edit])
|
191
191
|
@reflections = @model.ar_model.reflect_on_all_associations
|
@@ -202,12 +202,12 @@ module CmAdmin
|
|
202
202
|
|
203
203
|
def resource_responder
|
204
204
|
respond_to do |format|
|
205
|
-
if params["referrer"]
|
206
|
-
redirect_url = params["referrer"]
|
207
|
-
else
|
208
|
-
redirect_url = CmAdmin::Engine.mount_path + "/#{@model.name.underscore.pluralize}/#{@ar_object.id}"
|
209
|
-
end
|
210
205
|
if @ar_object.save
|
206
|
+
redirect_url = if params['referrer']
|
207
|
+
params['referrer']
|
208
|
+
else
|
209
|
+
cm_admin.send("#{@model.name.underscore}_show_path", @ar_object)
|
210
|
+
end
|
211
211
|
if params['attachment_destroy_ids'].present?
|
212
212
|
ActiveStorage::Attachment.where(id: params['attachment_destroy_ids']).destroy_all
|
213
213
|
end
|
@@ -222,7 +222,7 @@ module CmAdmin
|
|
222
222
|
@current_action = CmAdmin::Models::Action.find_by(@model, name: action_name.to_s)
|
223
223
|
return unless @current_action
|
224
224
|
|
225
|
-
@ar_object = @model.ar_model.name.classify.constantize
|
225
|
+
@ar_object = fetch_ar_object(@model.ar_model.name.classify.constantize, params[:id])
|
226
226
|
return @ar_object unless @current_action.child_records
|
227
227
|
|
228
228
|
child_records = @ar_object.send(@current_action.child_records)
|
@@ -353,7 +353,10 @@ module CmAdmin
|
|
353
353
|
params.require(@model.name.underscore.to_sym).permit(*permittable_fields)
|
354
354
|
end
|
355
355
|
|
356
|
-
|
356
|
+
def fetch_ar_object(model_object, id)
|
357
|
+
return model_object.friendly.find(id) if model_object.respond_to?(:friendly)
|
357
358
|
|
359
|
+
model_object.find(id)
|
360
|
+
end
|
358
361
|
end
|
359
362
|
end
|
@@ -11,9 +11,9 @@
|
|
11
11
|
.popup-card.table-export-popup.hidden
|
12
12
|
- if edit_action.present?
|
13
13
|
- if @associated_model
|
14
|
-
- path = cm_admin.send("#{current_model.name.underscore}_edit_path", ar_object
|
14
|
+
- path = cm_admin.send("#{current_model.name.underscore}_edit_path", ar_object, referrer: request.path)
|
15
15
|
- else
|
16
|
-
- path = cm_admin.send("#{current_model.name.underscore}_edit_path", ar_object
|
16
|
+
- path = cm_admin.send("#{current_model.name.underscore}_edit_path", ar_object)
|
17
17
|
= link_to path do
|
18
18
|
.popup-option
|
19
19
|
span
|
@@ -21,13 +21,13 @@
|
|
21
21
|
| Edit
|
22
22
|
- if destroy_action.present?
|
23
23
|
- if @associated_model
|
24
|
-
= button_to cm_admin.send("#{current_model.name.underscore}_destroy_path", ar_object
|
24
|
+
= button_to cm_admin.send("#{current_model.name.underscore}_destroy_path", ar_object, referrer: request.path), method: :delete, form: { data: { turbo_confirm: 'Are you sure?' } } do
|
25
25
|
.popup-option
|
26
26
|
span
|
27
27
|
i.fa.fa-trash
|
28
28
|
| Destroy
|
29
29
|
- else
|
30
|
-
= link_to '', data: { bs_toggle: 'modal', bs_target: "##{@model.name.classify}DestroyModal-#{ar_object.id.to_s}" } do
|
30
|
+
= link_to '', data: { bs_toggle: 'modal', bs_target: "##{@model.name.classify}DestroyModal-#{ar_object.id.to_s}" } do
|
31
31
|
.popup-option
|
32
32
|
span
|
33
33
|
i.fa.fa-trash
|
@@ -5,7 +5,7 @@
|
|
5
5
|
p.table-top__total-count = "#{humanized_ar_collection_count(@associated_ar_object.pagy.count, @action.child_records.to_s)}"
|
6
6
|
.table-top__column-action
|
7
7
|
- if @associated_model && @associated_model.available_actions.map(&:name).include?('new') && has_valid_policy(@associated_ar_object, 'new')
|
8
|
-
- association = @ar_object.class.reflect_on_all_associations.select{|x| x.name == @associated_model.name.tableize.to_sym }.first
|
8
|
+
- association = @ar_object.class.reflect_on_all_associations.select{|x| x.name == @associated_model.name.tableize.to_sym }.first
|
9
9
|
- polymorphic_name = (association && association.inverse_of && association.inverse_of.options[:polymorphic]) ? association.inverse_of.name : ''
|
10
10
|
a href="#{CmAdmin::Engine.mount_path}/#{@associated_model.name.tableize}/new?associated_id=#{@ar_object.id}&associated_class=#{@ar_object.class.name.underscore}&polymorphic_name=#{polymorphic_name}&referrer=#{request.path}"
|
11
11
|
button.btn-secondary Add
|
@@ -45,7 +45,7 @@
|
|
45
45
|
- if column.display_if.call(Current.user) && column.viewable
|
46
46
|
td.text-ellipsis data-field-type="#{column.field_type || 'string'}"
|
47
47
|
- if index == 0 && is_show_action_available(@model, ar_object) && !([:link, :custom, :attachment, :drawer, :image].include?(column.field_type))
|
48
|
-
= link_to ar_object.send(column.field_name), cm_admin.send("#{ar_object.model_name.singular}_show_path", ar_object
|
48
|
+
= link_to ar_object.send(column.field_name), cm_admin.send("#{ar_object.model_name.singular}_show_path", ar_object)
|
49
49
|
- else
|
50
50
|
= show_field_value(ar_object, column)
|
51
51
|
- if column.field_type == :drawer
|
@@ -5,10 +5,10 @@ ul.tabs
|
|
5
5
|
li.nav-item
|
6
6
|
- nav_item_action_name = nav_item.custom_action.present? ? nav_item.custom_action : 'show'
|
7
7
|
- if via_xhr
|
8
|
-
= link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("#{@ar_object.model_name.singular}_#{nav_item_action_name}_path", @ar_object
|
8
|
+
= link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("#{@ar_object.model_name.singular}_#{nav_item_action_name}_path", @ar_object), class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}", target: '_blank'
|
9
9
|
- else
|
10
|
-
= link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("#{@ar_object.model_name.singular}_#{nav_item_action_name}_path", @ar_object
|
10
|
+
= link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("#{@ar_object.model_name.singular}_#{nav_item_action_name}_path", @ar_object), class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}"
|
11
11
|
// current_action_name is defined when action trail is added to that model
|
12
12
|
- if policy([:cm_admin, @model.name.classify.constantize]).send(:history?)
|
13
13
|
li.nav-item
|
14
|
-
= link_to 'History', cm_admin.send("#{@ar_object.model_name.singular}_history_path", @ar_object
|
14
|
+
= link_to 'History', cm_admin.send("#{@ar_object.model_name.singular}_history_path", @ar_object), class: "nav-link #{ action_name == 'history' ? 'active' : ''}"
|
@@ -1,16 +1,15 @@
|
|
1
|
-
.modal.fade id="#{@model.name.classify}DestroyModal-#{ar_object.id}" aria-hidden="true" aria-labelledby="#{@model.name.classify}DestroyModalLabel" tabindex="1"
|
1
|
+
.modal.fade id="#{@model.name.classify}DestroyModal-#{ar_object.id}" aria-hidden="true" aria-labelledby="#{@model.name.classify}DestroyModalLabel" tabindex="1"
|
2
2
|
.modal-dialog
|
3
3
|
.modal-content
|
4
4
|
.modal-header
|
5
5
|
h5.modal-title id="#{@model.name.classify}DestroyModalLabel" = "#{@model.name.classify} Destroy"
|
6
|
-
button.btn-close aria-label="Close" data-bs-dismiss="modal" type="button"
|
6
|
+
button.btn-close aria-label="Close" data-bs-dismiss="modal" type="button"
|
7
7
|
.modal-body
|
8
8
|
.custom-modal-body
|
9
9
|
.modal-info data-section="bulk-action"
|
10
10
|
| Are you sure you want to delete this #{@model.name.classify}
|
11
11
|
.modal-footer
|
12
|
-
= button_to cm_admin.send("#{@model.name.underscore}_destroy_path", ar_object
|
12
|
+
= button_to cm_admin.send("#{@model.name.underscore}_destroy_path", ar_object), method: :delete, class: "btn btn-primary" do
|
13
13
|
span
|
14
14
|
i.fa.fa-trash
|
15
|
-
| Destroy
|
16
|
-
|
15
|
+
| Destroy
|
@@ -6,7 +6,7 @@ module CmAdmin
|
|
6
6
|
include Utils::Helpers
|
7
7
|
|
8
8
|
attr_accessor :field_name, :label, :header, :input_type, :collection, :disabled, :helper_method,
|
9
|
-
:placeholder, :display_if, :html_attr, :target, :col_size
|
9
|
+
:placeholder, :display_if, :html_attr, :target, :col_size, :ajax_url
|
10
10
|
|
11
11
|
VALID_INPUT_TYPES = %i[
|
12
12
|
integer decimal string single_select multi_select date date_time text
|
data/lib/cm_admin/version.rb
CHANGED
@@ -102,9 +102,9 @@ module CmAdmin
|
|
102
102
|
if field.association_type.to_s == 'polymorphic'
|
103
103
|
association_name = ar_object.send(field.association_name).class.to_s.underscore
|
104
104
|
field_name = find_field_name(field, association_name)
|
105
|
-
link_to ar_object.send(field.association_name).send(field_name), cm_admin.send("#{association_name}_show_path", ar_object.send(field.association_name)
|
105
|
+
link_to ar_object.send(field.association_name).send(field_name), cm_admin.send("#{association_name}_show_path", ar_object.send(field.association_name))
|
106
106
|
elsif ['belongs_to', 'has_one'].include? field.association_type.to_s
|
107
|
-
link_to ar_object.send(field.association_name).send(field.field_name), cm_admin.send("#{field.association_name}_show_path", ar_object.send(field.association_name)
|
107
|
+
link_to ar_object.send(field.association_name).send(field.field_name), cm_admin.send("#{field.association_name}_show_path", ar_object.send(field.association_name))
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -14,10 +14,10 @@ module CmAdmin
|
|
14
14
|
is_required = form_obj.object._validators[cm_field.field_name].map(&:kind).include?(:presence)
|
15
15
|
required_class = is_required ? 'required' : ''
|
16
16
|
target_action = @model.available_actions.select { |x| x.name == cm_field.target[:action_name].to_s }.first if cm_field.target.present?
|
17
|
-
send("cm_#{cm_field.input_type}_field", form_obj, cm_field, value, required_class, target_action)
|
17
|
+
send("cm_#{cm_field.input_type}_field", form_obj, cm_field, value, required_class, target_action, cm_field.ajax_url)
|
18
18
|
end
|
19
19
|
|
20
|
-
def cm_integer_field(form_obj, cm_field, value, required_class, _target_action)
|
20
|
+
def cm_integer_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
21
21
|
form_obj.text_field cm_field.field_name,
|
22
22
|
class: "field-control #{required_class}",
|
23
23
|
disabled: cm_field.disabled.call(form_obj.object),
|
@@ -26,7 +26,7 @@ module CmAdmin
|
|
26
26
|
data: { behaviour: 'integer-only' }
|
27
27
|
end
|
28
28
|
|
29
|
-
def cm_decimal_field(form_obj, cm_field, value, required_class, _target_action)
|
29
|
+
def cm_decimal_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
30
30
|
form_obj.text_field cm_field.field_name,
|
31
31
|
class: "field-control #{required_class}",
|
32
32
|
disabled: cm_field.disabled.call(form_obj.object),
|
@@ -35,7 +35,7 @@ module CmAdmin
|
|
35
35
|
data: { behaviour: 'decimal-only' }
|
36
36
|
end
|
37
37
|
|
38
|
-
def cm_string_field(form_obj, cm_field, value, required_class, _target_action)
|
38
|
+
def cm_string_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
39
39
|
form_obj.text_field cm_field.field_name,
|
40
40
|
class: "field-control #{required_class}",
|
41
41
|
disabled: cm_field.disabled.call(form_obj.object),
|
@@ -50,16 +50,18 @@ module CmAdmin
|
|
50
50
|
placeholder: cm_field.placeholder
|
51
51
|
end
|
52
52
|
|
53
|
-
def cm_single_select_field(form_obj, cm_field, value, required_class, target_action)
|
53
|
+
def cm_single_select_field(form_obj, cm_field, value, required_class, target_action, ajax_url)
|
54
|
+
class_name = ajax_url.present? ? 'select-2-ajax' : 'select-2'
|
54
55
|
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)),
|
55
56
|
{ include_blank: cm_field.placeholder },
|
56
|
-
class: "field-control #{required_class}
|
57
|
+
class: "field-control #{required_class} #{class_name}",
|
57
58
|
disabled: cm_field.disabled.call(form_obj.object),
|
58
59
|
data: {
|
59
60
|
field_name: cm_field.field_name,
|
60
61
|
field_type: 'linked-field',
|
61
62
|
target_action: target_action&.name,
|
62
|
-
target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
|
63
|
+
target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : '',
|
64
|
+
ajax_url: ajax_url
|
63
65
|
}
|
64
66
|
end
|
65
67
|
|
@@ -87,7 +89,7 @@ module CmAdmin
|
|
87
89
|
disabled: cm_field.disabled.call(form_obj.object), multiple: true
|
88
90
|
end
|
89
91
|
|
90
|
-
def cm_date_field(form_obj, cm_field, value, required_class, _target_action)
|
92
|
+
def cm_date_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
91
93
|
form_obj.text_field cm_field.field_name,
|
92
94
|
class: "field-control #{required_class}",
|
93
95
|
disabled: cm_field.disabled.call(form_obj.object),
|
@@ -105,7 +107,7 @@ module CmAdmin
|
|
105
107
|
data: { behaviour: 'date-only' }
|
106
108
|
end
|
107
109
|
|
108
|
-
def cm_date_time_field(form_obj, cm_field, value, required_class, _target_action)
|
110
|
+
def cm_date_time_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
109
111
|
form_obj.text_field cm_field.field_name,
|
110
112
|
class: "field-control #{required_class}",
|
111
113
|
disabled: cm_field.disabled.call(form_obj.object),
|
@@ -114,13 +116,13 @@ module CmAdmin
|
|
114
116
|
data: { behaviour: 'date-time' }
|
115
117
|
end
|
116
118
|
|
117
|
-
def cm_text_field(form_obj, cm_field, value, required_class, _target_action)
|
119
|
+
def cm_text_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
118
120
|
form_obj.text_area cm_field.field_name,
|
119
121
|
class: "field-control #{required_class}",
|
120
122
|
placeholder: cm_field.placeholder
|
121
123
|
end
|
122
124
|
|
123
|
-
def cm_rich_text_field(form_obj, cm_field, value, required_class, _target_action)
|
125
|
+
def cm_rich_text_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
124
126
|
form_obj.rich_text_area cm_field.field_name,
|
125
127
|
class: "field-control #{required_class}",
|
126
128
|
placeholder: cm_field.placeholder
|
@@ -164,15 +166,15 @@ module CmAdmin
|
|
164
166
|
end
|
165
167
|
end
|
166
168
|
|
167
|
-
def cm_check_box_field(form_obj, cm_field, value, required_class, target_action)
|
169
|
+
def cm_check_box_field(form_obj, cm_field, value, required_class, target_action, _ajax_url)
|
168
170
|
format_check_box_options(value, form_obj, cm_field, required_class, target_action)
|
169
171
|
end
|
170
172
|
|
171
|
-
def cm_radio_button_field(form_obj, cm_field, value, required_class, _target_action)
|
173
|
+
def cm_radio_button_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
172
174
|
format_radio_button_options(value, form_obj)
|
173
175
|
end
|
174
176
|
|
175
|
-
def cm_hidden_field(form_obj, cm_field, value, required_class, _target_action)
|
177
|
+
def cm_hidden_field(form_obj, cm_field, value, required_class, _target_action, _ajax_url)
|
176
178
|
form_obj.hidden_field cm_field.field_name,
|
177
179
|
value: value,
|
178
180
|
name: cm_field.html_attr[:name] || "#{form_obj.object_name}[#{cm_field.field_name}]"
|
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.4.
|
4
|
+
version: 1.4.7
|
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: 2024-
|
13
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: caxlsx_rails
|