cm-admin 2.4.6 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73688c5bd0feeb5e298c38aff4f27bfd25713415fe1966e3ceb4aa0904d0626d
4
- data.tar.gz: 1e8159e651b679a797a8b22c7041ca042290b19f9e8bee708e123b57cde0734b
3
+ metadata.gz: 68baa7f041a506418c1caa2423b44126590de6b5bd4796df6d79cb5723dc4272
4
+ data.tar.gz: db12d5bd371bcd73d8bc95ec0194fe7aa04fb101052f90aad12f3c1ee6160df5
5
5
  SHA512:
6
- metadata.gz: f83a656a89400a1cf26767d3eccdc79fc7f19af1c88cdcc24b408a9e8be33e0e66580594361a4bbee5009f2b56e717e250efcef813b3ddc24a7c961c6226633e
7
- data.tar.gz: e0c9ebf9c99e8fee1524dc580eda47073c75e17dedb6620fe24d26ae11c86cef424501d57645fbf363ce8bc9947e64d97f45a9c530232743fa78e8e75fe449ff
6
+ metadata.gz: 6cdc4b1adf109bfc4ce7208e9ce82cc0ee6094a71de89410931171ae16413d617263639f25c06c645f60772e6ef01b5606fac59b4ac865cb605170ffe5098c51
7
+ data.tar.gz: 53940ca38471e4102c6ed6bdb33ae83d90c7a788a21cb02fee369a685a8fc64f1ab90cb004117d11fe5dab9313218f2e0ca33dd6cdaff66844765c7256d9e41b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (2.4.6)
4
+ cm-admin (3.0.0)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -82,12 +82,16 @@ module CmAdmin
82
82
 
83
83
  def cm_destroy(params)
84
84
  @ar_object = fetch_ar_object(@model.ar_model.name.classify.constantize, params[:id])
85
- redirect_url = request.referrer || cm_admin.send("#{@model.name.underscore}_index_path")
85
+ redirect_url = if params[:from_action] == 'show'
86
+ cm_admin.send("cm_index_#{@model.name.underscore}_path")
87
+ else
88
+ request.referrer || cm_admin.send("cm_index_#{@model.name.underscore}_path")
89
+ end
86
90
  respond_to do |format|
87
91
  if @ar_object.destroy
88
- format.html { redirect_back fallback_location: redirect_url, notice: "#{@model.formatted_name} was deleted" }
92
+ format.html { redirect_to redirect_url, notice: "#{@model.formatted_name} was deleted" }
89
93
  else
90
- format.html { redirect_back fallback_location: redirect_url, alert: "#{@model.formatted_name} could not be deleted" }
94
+ format.html { redirect_to redirect_url, alert: "#{@model.formatted_name} could not be deleted" }
91
95
  end
92
96
  end
93
97
  end
@@ -98,7 +102,7 @@ module CmAdmin
98
102
  file_import = ::FileImport.new(allowed_params[:file_import])
99
103
  file_import.added_by = Current.user
100
104
  respond_to do |format|
101
- format.html { redirect_back fallback_location: cm_admin.send("#{@model.name.underscore}_index_path"), notice: 'Your import is successfully queued.' } if file_import.save!
105
+ format.html { redirect_back fallback_location: cm_admin.send("cm_index_#{@model.name.underscore}_path"), notice: 'Your import is successfully queued.' } if file_import.save!
102
106
  end
103
107
  end
104
108
 
@@ -200,7 +204,7 @@ module CmAdmin
200
204
  scoped_model = "CmAdmin::#{@model.name}Policy::#{params[:action_name].classify}Scope".constantize.new(Current.user, @model.name.constantize).resolve
201
205
  @ar_object = fetch_ar_object(scoped_model, params[:id])
202
206
  if params[:action_name] == 'destroy'
203
- render partial: '/layouts/destroy_action_modal', locals: { ar_object: @ar_object }
207
+ render partial: '/layouts/destroy_action_modal', locals: { ar_object: @ar_object, from_action: 'custom_action_modal' }
204
208
  else
205
209
  custom_action = @model.available_actions.select { |x| x.name == params[:action_name].to_s }.first
206
210
  render partial: '/layouts/custom_action_modal', locals: { custom_action:, ar_object: @ar_object }
@@ -262,7 +266,7 @@ module CmAdmin
262
266
  elsif @current_action.redirect_to.present?
263
267
  @current_action.redirect_to.call(@ar_object)
264
268
  else
265
- cm_admin.send("#{@model.name.underscore}_show_path", @ar_object)
269
+ cm_admin.send("cm_show_#{@model.name.underscore}_path", @ar_object)
266
270
  end
267
271
  ActiveStorage::Attachment.where(id: params['attachment_destroy_ids']).destroy_all if params['attachment_destroy_ids'].present?
268
272
  notice = if @current_action&.name == 'new'
@@ -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, referrer: request.path)
14
+ - path = cm_admin.send("cm_edit_#{current_model.name.underscore}_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("cm_edit_#{current_model.name.underscore}_path", ar_object)
17
17
  = link_to path do
18
18
  .popup-option
19
19
  span
@@ -21,7 +21,7 @@
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, referrer: request.path), method: :delete, form: { data: { turbo_confirm: 'Are you sure?' } } do
24
+ = button_to cm_admin.send("cm_destroy_#{current_model.name.underscore}_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
@@ -36,7 +36,7 @@
36
36
  - if custom_action.display_if.call(ar_object)
37
37
  - case custom_action.display_type
38
38
  - when :button
39
- = button_to cm_admin.send("#{cm_model.name.underscore}_index_path") + '/' + custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb do
39
+ = button_to cm_admin.send("cm_index_#{cm_model.name.underscore}_path") + '/' + custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb do
40
40
  .popup-option
41
41
  span
42
42
  i class="#{custom_action.icon_name}"
@@ -4,9 +4,9 @@
4
4
  p.table-top__total-count = "#{humanized_ar_collection_count(@ar_object.pagy.count, @model.formatted_name)}"
5
5
  .table-top__column-action
6
6
  .btn-group[role="group" aria-label="Basic example"]
7
- a.btn.btn-ghost href="#{cm_admin.send("#{@model.name.underscore}_index_path")}?page=#{params[:page] || 1}"
7
+ a.btn.btn-ghost href="#{cm_admin.send("cm_index_#{@model.name.underscore}_path")}?page=#{params[:page] || 1}"
8
8
  i.fa.fa-table
9
- a.btn.btn-ghost href="#{cm_admin.send("#{@model.name.underscore}_index_path")}?page=#{params[:page] || 1}&view_type=card"
9
+ a.btn.btn-ghost href="#{cm_admin.send("cm_index_#{@model.name.underscore}_path")}?page=#{params[:page] || 1}&view_type=card"
10
10
  i.fa.fa-table-cells
11
11
 
12
12
  - bulk_actions = actions_filter(@model, @ar_object, :bulk_action)
@@ -37,8 +37,6 @@
37
37
  | Table
38
38
  p.m-0
39
39
  | Nadim
40
- / h6.card-title
41
- / = link_to ar_object.send(column.field_name), cm_admin.send("#{ar_object.model_name.singular}_show_path", ar_object.id)
42
40
  - else
43
41
  p.card-text
44
42
  = show_field_value(ar_object, column)
@@ -2,5 +2,5 @@
2
2
  .modal-info data-section="bulk-action"
3
3
  = custom_action.modal_configuration[:description]
4
4
  .modal-footer
5
- = simple_form_for(ar_object, url: cm_admin.send("#{ar_object.class.name.underscore}_#{custom_action.name}_path", ar_object.id), method: custom_action.verb) do |f|
6
- = f.button :submit, custom_action.modal_configuration[:confirmation_text] || 'Update', class: "btn btn-primary"
5
+ = simple_form_for(ar_object, url: cm_admin.send("cm_#{custom_action.name}_#{ar_object.class.name.underscore}_path", ar_object.id), method: custom_action.verb) do |f|
6
+ = f.button :submit, custom_action.modal_configuration[:confirmation_text] || 'Update', class: "btn btn-primary"
@@ -3,9 +3,9 @@
3
3
  .table-top__column-action
4
4
  - if @current_action.view_type == :card_view
5
5
  .btn-group[role="group" aria-label="Card Toggle"]
6
- a.btn.btn-ghost href="#{cm_admin.send("#{@model.name.underscore}_index_path")}?page=#{params[:page] || 1}"
6
+ a.btn.btn-ghost href="#{cm_admin.send("cm_index_#{@model.name.underscore}_path")}?page=#{params[:page] || 1}"
7
7
  i.fa.fa-table
8
- a.btn.btn-ghost href="#{cm_admin.send("#{@model.name.underscore}_index_path")}?page=#{params[:page] || 1}&view_type=card"
8
+ a.btn.btn-ghost href="#{cm_admin.send("cm_index_#{@model.name.underscore}_path")}?page=#{params[:page] || 1}&view_type=card"
9
9
  i.fa.fa-table-cells
10
10
  - if @model.sort_columns.present?
11
11
  = render 'cm_admin/main/sort', model: @model, ar_object: @ar_object
@@ -42,7 +42,7 @@
42
42
  - if column.display_if.call(Current.user) && column.viewable
43
43
  td.text-ellipsis data-field-type="#{column.field_type || 'string'}"
44
44
  - if index == 0 && is_show_action_available(@model, ar_object) && !([:link, :custom, :attachment, :drawer, :image].include?(column.field_type))
45
- = link_to ar_object.send(column.field_name), cm_admin.send("#{ar_object.model_name.singular}_show_path", ar_object)
45
+ = link_to ar_object.send(column.field_name), cm_admin.send("cm_show_#{ar_object.model_name.singular}_path", ar_object)
46
46
  - else
47
47
  = show_field_value(ar_object, column)
48
48
  - 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), class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}", target: '_blank'
8
+ = link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("cm_#{nav_item_action_name}_#{@ar_object.model_name.singular}_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), class: "nav-link #{ nav_item_action_name == action_name ? 'active' : ''}"
10
+ = link_to tab_display_name(nav_item.nav_item_name), cm_admin.send("cm_#{nav_item_action_name}_#{@ar_object.model_name.singular}_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
- - if policy([:cm_admin, @model.name.classify.constantize]).send(:history?) && cm_admin.respond_to?("#{@ar_object.model_name.singular}_history_path".to_sym)
12
+ - if policy([:cm_admin, @model.name.classify.constantize]).send(:history?) && cm_admin.respond_to?("cm_history_#{@ar_object.model_name.singular}_path".to_sym)
13
13
  li.nav-item
14
- = link_to 'History', cm_admin.send("#{@ar_object.model_name.singular}_history_path", @ar_object), class: "nav-link #{ action_name == 'history' ? 'active' : ''}"
14
+ = link_to 'History', cm_admin.send("cm_history_#{@ar_object.model_name.singular}_path", @ar_object), class: "nav-link #{ action_name == 'history' ? 'active' : ''}"
@@ -1,8 +1,8 @@
1
1
  .entity-header
2
2
  .entity-header__info
3
- - if cm_admin.method_defined?(:"#{@model.name.underscore}_index_path") && (@model.current_action.name == 'show'|| @model.current_action.name == 'history' || @model.current_action.layout_type.present?)
3
+ - if cm_admin.method_defined?(:"cm_index_#{@model.name.underscore}_path") && (@model.current_action.name == 'show'|| @model.current_action.name == 'history' || @model.current_action.layout_type.present?)
4
4
  .breadcrumb
5
- = link_to "#{@model.model_name.titleize.pluralize} /", cm_admin.send(:"#{@model.name.underscore}_index_path"), class: 'text-reset'
5
+ = link_to "#{@model.model_name.titleize.pluralize} /", cm_admin.send(:"cm_index_#{@model.name.underscore}_path"), class: 'text-reset'
6
6
  h4 = action_title
7
7
  / - if @model.current_action.page_description
8
8
  / p.mb-0.text-body-secondary = @model.current_action.page_description
@@ -19,10 +19,10 @@
19
19
  .popup-option.pointer data-bs-toggle='modal' data-bs-target='#exportmodal'
20
20
  span Export
21
21
  - if @model.importer && has_valid_policy(@ar_object, :importable)
22
- = link_to 'Import', cm_admin.send(:"#{@model.name.underscore}_import_path"), class: 'btn-primary ms-2'
22
+ = link_to 'Import', cm_admin.send(:"cm_import_#{@model.name.underscore}_path"), class: 'btn-primary ms-2'
23
23
  - new_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('new')}
24
24
  - if new_action.any? && has_valid_policy(@ar_object, 'new')
25
- = link_to 'Add', cm_admin.send(:"#{@model.name.underscore}_new_path"), class: 'btn-primary ms-2'
25
+ = link_to 'Add', cm_admin.send(:"cm_new_#{@model.name.underscore}_path"), class: 'btn-primary ms-2'
26
26
  - @model.available_actions.select{|act| act if act.route_type == 'collection'}.each do |custom_action|
27
27
  = custom_action_items(custom_action, 'index')
28
28
  - elsif @model.current_action.name == 'show'
@@ -32,7 +32,7 @@
32
32
  - edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
33
33
  - destroy_action = available_actions(@model, @ar_object, 'destroy')
34
34
  - if edit_action.any? && has_valid_policy(@ar_object, 'edit')
35
- = link_to cm_admin.send(:"#{@model.name.underscore}_edit_path", @ar_object), class: 'btn-primary ms-2' do
35
+ = link_to cm_admin.send(:"cm_edit_#{@model.name.underscore}_path", @ar_object), class: 'btn-primary ms-2' do
36
36
  span
37
37
  i.fa.fa-edit
38
38
  | Edit
@@ -12,10 +12,10 @@
12
12
  p.success-msg Your file has been uploaded and it will be processed soon.
13
13
  / p.success-msg-info An email will be sent once the process is completed. If there are any problems with the import, we'll let you know through an email.
14
14
  .actions-wrapper
15
- a.btn-secondary href="#{cm_admin.send(:"#{@model.name.underscore}_import_path")}" Import new data
15
+ a.btn-secondary href="#{cm_admin.send(:"cm_import_#{@model.name.underscore}_path")}" Import new data
16
16
  / button.cta-btn.ms-2 Back to Page_Name
17
17
  - else
18
- = simple_form_for(FileImport.new, url: "#{cm_admin.send(:"#{@model.name.underscore}_import_path")}", method: :post, html: { class: "csv-import-form" }) do |f|
18
+ = simple_form_for(FileImport.new, url: "#{cm_admin.send(:"cm_import_#{@model.name.underscore}_path")}", method: :post, html: { class: "csv-import-form" }) do |f|
19
19
  .form-card
20
20
  = f.input :associated_model_name, as: :hidden, placeholder: 'Enter product title', label: false, input_html: { value: @model.name }
21
21
  = f.input :import_file, as: :file, placeholder: 'Enter product title', label: false
@@ -1,7 +1,7 @@
1
1
  .form-page.permission-form
2
2
  .form-page__body
3
3
  .form-container
4
- = form_for CmPermission.new, url: cm_admin.send('cm_role_create_role_permission_path', @ar_object), method: :post do |f|
4
+ = form_for CmPermission.new, url: cm_admin.send('cm_create_role_permission_cm_role_path', @ar_object), method: :post do |f|
5
5
  - cm_models = CmAdmin.config.cm_admin_models.sort_by{|k, v| k.display_name}
6
6
  - cm_models.each do |model|
7
7
  - next if model.override_policy == true
@@ -35,4 +35,4 @@
35
35
  = select_tag(:policy_scope_name, options_for_select(model.policy_scopes.map{|policy_hash| [policy_hash[:display_name], policy_hash[:scope_name]]}, permission&.scope_name), {name: "role_permission[#{model.name}][#{action.name}][scope_name]", class: 'select-2', id: "policy-scope-#{model.name}-#{action.name}"})
36
36
  div
37
37
  = f.submit 'Save Changes', class: "btn-cta"
38
- = link_to 'Discard', cm_admin.send('cm_role_index_path'), class: "btn-secondary ml-10"
38
+ = link_to 'Discard', cm_admin.send('cm_index_cm_role_path'), class: "btn-secondary ml-10"
@@ -15,11 +15,11 @@ div[data-behaviour="custom-action-modal-container"]
15
15
  - custom_action_with_modals.each do |custom_action|
16
16
  = render partial: '/layouts/custom_action_modal', locals: { custom_action: custom_action, ar_object: @ar_object }
17
17
  - if destroy_action
18
- = render partial: '/layouts/destroy_action_modal', locals: { ar_object: @ar_object }
18
+ = render partial: '/layouts/destroy_action_modal', locals: { ar_object: @ar_object, from_action: @current_action&.name }
19
19
 
20
20
  - elsif @current_action&.action_type == :custom && @associated_ar_object&.data.present?
21
21
  - @associated_ar_object.data.each do |ar_object|
22
22
  - custom_action_with_modals.select{|custom_action| custom_action.model_name == @current_action.child_records.to_s.classify}.each do |custom_action|
23
23
  = render partial: '/layouts/custom_action_modal', locals: { custom_action: custom_action, ar_object: ar_object }
24
24
  - if destroy_action
25
- = render partial: '/layouts/destroy_action_modal', locals: { ar_object: ar_object }
25
+ = render partial: '/layouts/destroy_action_modal', locals: { ar_object: ar_object, from_action: @current_action&.name }
@@ -9,7 +9,7 @@
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), method: :delete, class: "btn btn-primary" do
12
+ = button_to cm_admin.send("cm_destroy_#{@model.name.underscore}_path", ar_object, from_action:), method: :delete, class: "btn btn-primary" do
13
13
  span
14
14
  i.fa.fa-trash
15
15
  |  Destroy
data/config/routes.rb CHANGED
@@ -12,14 +12,14 @@ CmAdmin::Engine.routes.draw do
12
12
  CmAdmin.config.cm_admin_models.each do |model|
13
13
  if model.importer
14
14
  scope model.name.tableize do
15
- send(:get, 'import', to: "#{model.name.underscore}#import_form", as: "#{model.name.underscore}_import_form")
16
- send(:post, 'import', to: "#{model.name.underscore}#import", as: "#{model.name.underscore}_import")
15
+ send(:get, 'import', to: "#{model.name.underscore}#import_form", as: "cm_import_form_#{model.name.underscore}")
16
+ send(:post, 'import', to: "#{model.name.underscore}#import", as: "cm_import_#{model.name.underscore}")
17
17
  end
18
18
  end
19
19
 
20
20
  if model.sort_columns.present?
21
21
  scope model.name.tableize do
22
- send(:post, 'reset_sort_columns', to: "#{model.name.underscore}#reset_sort_columns", as: "#{model.name.underscore}_reset_sort_columns")
22
+ send(:post, 'reset_sort_columns', to: "#{model.name.underscore}#reset_sort_columns", as: "cm_reset_sort_columns_#{model.name.underscore}")
23
23
  end
24
24
  end
25
25
 
@@ -31,9 +31,9 @@ CmAdmin::Engine.routes.draw do
31
31
  scope model.name.tableize do
32
32
  # Define route only when action trail related field is present
33
33
  if act.name == 'history'
34
- send(:get, ':id/history', to: "#{model.name.underscore}#history", as: "#{model.name.underscore}_history")
34
+ send(:get, ':id/history', to: "#{model.name.underscore}#history", as: "cm_history_#{model.name.underscore}")
35
35
  else
36
- send(act.verb, act.path.present? ? act.path : act.name, to: "#{model.name.underscore}##{act.name}", as: "#{model.name.underscore}_#{act.name}")
36
+ send(act.verb, act.path.present? ? act.path : act.name, to: "#{model.name.underscore}##{act.name}", as: "cm_#{act.name}_#{model.name.underscore}")
37
37
  end
38
38
  end
39
39
  end
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '2.4.6'
2
+ VERSION = '3.0.0'
3
3
  end
@@ -140,10 +140,10 @@ module CmAdmin
140
140
  if field.association_type.to_s == 'polymorphic'
141
141
  association_name = ar_object.send(field.association_name).class.to_s.underscore
142
142
  field_name = find_field_name(field, association_name)
143
- link_to ar_object.send(field.association_name).send(field_name), cm_admin.send("#{association_name}_show_path", ar_object.send(field.association_name))
143
+ link_to ar_object.send(field.association_name).send(field_name), cm_admin.send("cm_show_#{association_name}_path", ar_object.send(field.association_name))
144
144
  elsif ['belongs_to', 'has_one'].include? field.association_type.to_s
145
145
  if ar_object.send(field.association_name)
146
- 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))
146
+ link_to ar_object.send(field.association_name).send(field.field_name), cm_admin.send("cm_show_#{field.association_name}_path", ar_object.send(field.association_name))
147
147
  end
148
148
  end
149
149
  end
@@ -92,7 +92,7 @@ module CmAdmin
92
92
  field_name: cm_field.field_name,
93
93
  field_type: 'linked-field',
94
94
  target_action: target_action&.name,
95
- target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : '',
95
+ target_url: target_action&.name ? cm_admin.send("cm_#{target_action&.name}_#{@model.name.underscore}_path") : '',
96
96
  ajax_url:
97
97
  }
98
98
  }, cm_field.html_attrs
@@ -111,7 +111,7 @@ module CmAdmin
111
111
  field_name: cm_field.field_name,
112
112
  field_type: 'linked-field',
113
113
  target_action: target_action&.name,
114
- target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
114
+ target_url: target_action&.name ? cm_admin.send("cm_#{target_action&.name}_#{@model.name.underscore}_path") : ''
115
115
  }
116
116
  }, cm_field.html_attrs
117
117
  )
@@ -254,7 +254,7 @@ module CmAdmin
254
254
  data: {
255
255
  field_name: cm_field.field_name,
256
256
  target_action: target_action&.name,
257
- target_url: target_action&.name ? cm_admin.send("#{@model.name.underscore}_#{target_action&.name}_path") : ''
257
+ target_url: target_action&.name ? cm_admin.send("cm_#{target_action&.name}_#{@model.name.underscore}_path") : ''
258
258
  }
259
259
  }, cm_field.html_attrs
260
260
  )
@@ -56,13 +56,13 @@ module CmAdmin
56
56
  when :modal
57
57
  custom_modal_button(custom_action)
58
58
  when :page
59
- path = cm_admin.send("#{@model.name.underscore}_#{custom_action.name}_path", @ar_object.id, custom_action.url_params)
59
+ path = cm_admin.send("cm_#{custom_action.name}_#{@model.name.underscore}_path", @ar_object.id, custom_action.url_params)
60
60
  link_to custom_action_title(custom_action), path, class: 'btn-secondary ms-2', method: custom_action.verb
61
61
  end
62
62
  end
63
63
 
64
64
  def custom_action_icon(custom_action, current_action_name)
65
- button_to cm_admin.send("#{@model.name.underscore}_#{custom_action.name}_path"), method: :post, params: {selected_ids: ''} do
65
+ button_to cm_admin.send("cm_#{custom_action.name}_#{@model.name.underscore}_path"), method: :post, params: {selected_ids: ''} do
66
66
  content_tag(:span) do
67
67
  content_tag(:i, '', class: custom_action.icon_name)
68
68
  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: 2.4.6
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2024-10-18 00:00:00.000000000 Z
17
+ date: 2024-10-21 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: caxlsx_rails