cm-admin 0.7.3 → 0.7.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 810496f7dd375b4849ce820652272c6d36dec1767807beab966e4abc1a00a922
|
4
|
+
data.tar.gz: 522f04bc7abeddf95dceebfe980c3b7d955b3d3907de9060af5923803622ed59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc0a6ebd3f81ee0c8df337d630c71cff47d49bb7e422e1d39f9f5f1663c21e7714bd740cf8b1a37d37cbbc3827d18ccc58822031794a228696043633886466ec
|
7
|
+
data.tar.gz: 6a13e1994ea27658ac281f88970b1d5b471ee52982be02af9e8ce55dd1b9f6706085543a3f0cbddced246371254b8143243ed6e2756e413d6302fde891718c9d
|
data/Gemfile.lock
CHANGED
@@ -34,8 +34,9 @@
|
|
34
34
|
= render partial: column.drawer_partial, locals: { ar_object: ar_object}
|
35
35
|
|
36
36
|
- edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
|
37
|
+
- destroy_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('destroy')}
|
37
38
|
- custom_actions = @model.available_actions.select{|act| act if act.route_type == 'member' && [:button, :modal].include?(act.display_type)}
|
38
|
-
- if custom_actions.any? || edit_action.any?
|
39
|
+
- if custom_actions.any? || edit_action.any? || destroy_action.any?
|
39
40
|
td.row-action-cell
|
40
41
|
.row-action-tool
|
41
42
|
button.secondary-btn.tool-btn type="button"
|
@@ -50,6 +51,12 @@
|
|
50
51
|
span
|
51
52
|
i.fa.fa-edit
|
52
53
|
| Edit
|
54
|
+
- if destroy_action.any? && policy([:cm_admin, @model.name.classify.constantize]).destroy?
|
55
|
+
= link_to "#{page_url('destroy', ar_object)}", method: :delete do
|
56
|
+
.popup-option
|
57
|
+
span
|
58
|
+
i.fa.fa-trash
|
59
|
+
| Destroy
|
53
60
|
- custom_actions.each do |custom_action|
|
54
61
|
- if custom_action.name.present? && has_valid_policy(@model.name, custom_action.name)
|
55
62
|
- if custom_action.display_if.call(ar_object)
|
data/lib/cm_admin/model.rb
CHANGED
@@ -147,7 +147,7 @@ module CmAdmin
|
|
147
147
|
else
|
148
148
|
redirect_url = CmAdmin::Engine.mount_path + "/#{@model.name.underscore.pluralize}"
|
149
149
|
end
|
150
|
-
if @ar_object.save
|
150
|
+
if action_name.eql?('destroy') || @ar_object.save
|
151
151
|
format.html { redirect_to redirect_url, notice: "#{action_name.titleize} #{@ar_object.class.name.downcase} is successful" }
|
152
152
|
else
|
153
153
|
format.html { render '/cm_admin/main/new', notice: "#{action_name.titleize} #{@ar_object.class.name.downcase} is unsuccessful" }
|
@@ -36,6 +36,11 @@ module CmAdmin
|
|
36
36
|
@ar_object = @ar_model.name.classify.constantize.new(resource_params(params))
|
37
37
|
end
|
38
38
|
|
39
|
+
def destroy(params)
|
40
|
+
@ar_object = @ar_model.name.classify.constantize.find(params[:id])
|
41
|
+
@ar_object.destroy
|
42
|
+
end
|
43
|
+
|
39
44
|
def filter_by(params, records, filter_params={}, sort_params={})
|
40
45
|
filtered_result = OpenStruct.new
|
41
46
|
sort_column = "created_at"
|
@@ -68,9 +73,9 @@ module CmAdmin
|
|
68
73
|
x.name
|
69
74
|
elsif x.klass.name == "ActiveStorage::Attachment"
|
70
75
|
if x.class.name.include?('HasOne')
|
71
|
-
x.name
|
76
|
+
x.name.to_s.gsub('_attachment', '').to_sym
|
72
77
|
elsif x.class.name.include?('HasMany')
|
73
|
-
Hash[x.name.to_s, []]
|
78
|
+
Hash[x.name.to_s.gsub('_attachment', ''), []]
|
74
79
|
end
|
75
80
|
elsif x.klass.name == "ActionText::RichText"
|
76
81
|
x.name.to_s.gsub('rich_text_', '').to_sym
|
data/lib/cm_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cm-admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sajinmp
|
8
8
|
- anbublacky
|
9
9
|
- AdityaTiwari2102
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-06-
|
13
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pagy
|
@@ -240,7 +240,7 @@ licenses:
|
|
240
240
|
metadata:
|
241
241
|
homepage_uri: https://github.com/commutatus/cm-admin
|
242
242
|
source_code_uri: https://github.com/commutatus/cm-admin
|
243
|
-
post_install_message:
|
243
|
+
post_install_message:
|
244
244
|
rdoc_options: []
|
245
245
|
require_paths:
|
246
246
|
- lib
|
@@ -255,8 +255,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: '0'
|
257
257
|
requirements: []
|
258
|
-
rubygems_version: 3.2.
|
259
|
-
signing_key:
|
258
|
+
rubygems_version: 3.2.32
|
259
|
+
signing_key:
|
260
260
|
specification_version: 4
|
261
261
|
summary: This is an admin panel gem
|
262
262
|
test_files: []
|