cm-admin 1.2.4 → 1.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 761f5d07363458ff70baaaf931e973f5b0b6dca0be30786ebb5ade83bb5b6934
4
- data.tar.gz: 07b19cdc0bb2d6fa6f8a87199751c0d5be4e3a0bf6da11faf7ee7e8643d5836e
3
+ metadata.gz: 3fe51e58bb1ed8522c203af90ff0d19cd547066283c748fe85abcb23c8d4daaa
4
+ data.tar.gz: 982a1b6707bbf563d7780eef2534295ea414970e76545f45df7d2878d0ed35f4
5
5
  SHA512:
6
- metadata.gz: 741d8416b844f57064606e4d7616805ab7670000dfde9a21d6b21184b55a6cf5538bd85d403e711b65d14c1118c2cf1e68daaff66f261832d57653b16111c7bb
7
- data.tar.gz: c48c03392357838aa183e10583ea6f57c7962dea1c5a05e71e66af5da2054cdef9f8fe70d8b3a01c9688a074a76a3c8573e43291d0159d10548905b8513e6fab
6
+ metadata.gz: 20bb85359b28a5457341007bd0e900bded0108375eaf43608a6f583e03651454f2f4aa163ef9ec1a8718ac73ae5b0cc500345112e53529b7e711cc9e8af1a723
7
+ data.tar.gz: 39f51179a605e5d409bdc0418eb78a0f7370f439a7bd07f34acd2f5590e5e384316e38534db728ee21a4e099985408bcdf2a4b16ed27cad973dcd0b2e9b6ae71
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (1.2.4)
4
+ cm-admin (1.2.6)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -1,4 +1,4 @@
1
- .modal.fade id="#{custom_action.name.classify}Modal-#{ar_object.id}" aria-hidden="true" aria-labelledby="#{custom_action.name.classify}ModalLabel" tabindex="1"
1
+ .modal.fade id="#{custom_action.name.classify}Modal-#{ar_object&.id}" aria-hidden="true" aria-labelledby="#{custom_action.name.classify}ModalLabel" tabindex="1"
2
2
  .modal-dialog
3
3
  .modal-content
4
4
  .modal-header
@@ -1,9 +1,11 @@
1
- - custom_action_with_modals = @model.available_actions.select{ |act| act if act.display_type == :modal }
1
+ - custom_action_with_modals = @model.available_actions.select{ |act| act if act.display_type == :modal && act.action_type == :custom }
2
+ - bulk_action_with_modals = @model.available_actions.select{ |act| act if act.display_type == :modal && act.action_type == :bulk_action }
2
3
  - destroy_action = available_actions(@model, 'destroy')
3
4
  - if @associated_model
4
5
  - custom_action_with_modals += @associated_model.available_actions.select{ |act| act if act.display_type == :modal }
5
-
6
6
  - if @current_action&.name == 'index'
7
+ - bulk_action_with_modals.each do |bulk_action|
8
+ = render partial: '/layouts/custom_action_modal', locals: { custom_action: bulk_action, ar_object: nil }
7
9
  - @ar_object.data.each do |ar_object|
8
10
  - custom_action_with_modals.each do |custom_action|
9
11
  = render partial: '/layouts/custom_action_modal', locals: { custom_action: custom_action, ar_object: ar_object }
@@ -3,6 +3,7 @@ require_relative 'actions/blocks'
3
3
  module CmAdmin
4
4
  module Models
5
5
  class BulkAction < Action
6
+ attr_accessor :modal_configuration
6
7
 
7
8
  def initialize(attributes = {}, &block)
8
9
  super
@@ -132,9 +132,9 @@ module CmAdmin
132
132
  # self.class.class_eval(&block)
133
133
  end
134
134
 
135
- def bulk_action(name: nil, display_name: nil, display_if: lambda { |arg| return true }, redirection_url: nil, icon_name: nil, verb: nil, display_type: nil, route_type: nil, partial: nil, &block)
135
+ def bulk_action(name: nil, display_name: nil, display_if: lambda { |arg| return true }, redirection_url: nil, icon_name: nil, verb: nil, display_type: nil, modal_configuration: {}, route_type: nil, partial: nil, &block)
136
136
  bulk_action = CmAdmin::Models::BulkAction.new(
137
- name: name, display_name: display_name, display_if: display_if,
137
+ name: name, display_name: display_name, display_if: display_if, modal_configuration: modal_configuration,
138
138
  redirection_url: redirection_url, icon_name: icon_name, action_type: :bulk_action,
139
139
  verb: verb, display_type: display_type, route_type: route_type, partial: partial, &block
140
140
  )
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '1.2.4'
2
+ VERSION = '1.2.6'
3
3
  end
@@ -104,13 +104,15 @@ module CmAdmin
104
104
 
105
105
  def attachment_list(form_obj, cm_field, _value, required_class, _target_action)
106
106
  attached = form_obj.object.send(cm_field.field_name)
107
+ return if attached.instance_of?(Paperclip::Attachment)
108
+
107
109
  content_tag(:div) do
108
110
  if attached.class == ActiveStorage::Attached::Many
109
111
  attached.each do |attachment|
110
112
  concat attachment_with_icon(attachment)
111
113
  end
112
114
  else
113
- concat attachment_with_icon(attached)
115
+ concat attachment_with_icon(attached) if attached
114
116
  end
115
117
  end
116
118
  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.2.4
4
+ version: 1.2.6
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-10-11 00:00:00.000000000 Z
13
+ date: 2023-10-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails