ez-resources 0.1.2 → 0.1.3
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: faeed954e2b59068bceac5d87b8d94029e8ee5c75ee32831c1daf539a8c8ef5f
|
4
|
+
data.tar.gz: 9341e3858d0273d8afae03827f7b541462c47668eeb7fba2a572087b2774d2db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77ee0e92778121182d86b24788a37d6572b5ebe1511f0e137298f1556ad6a9e4979dd25045fb9ce401da04388b8a8de1c55a79e62e72e88a89b20e7b9de32b13
|
7
|
+
data.tar.gz: 36a4a91698f181fae7e04141c15a08a13adcd746f1eb29005a75aa55e765adcd418e5c6f79ccd9f4ff795e0cd3c14bba04100950cd01b5ee4dc55335456f52ab
|
@@ -81,7 +81,12 @@ module Ez
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def remove_link(record)
|
84
|
-
|
84
|
+
return unless model.actions.include?(:destroy)
|
85
|
+
return unless Manager::Hooks.can?(:can_destroy?, model, record)
|
86
|
+
|
87
|
+
link_to t('actions.remove'), model.path_for(action: :destroy, id: record.id),
|
88
|
+
method: :delete,
|
89
|
+
class: css_for('collection-table-td-action-item')
|
85
90
|
end
|
86
91
|
|
87
92
|
def pagination
|
data/lib/ez/resources/manager.rb
CHANGED
@@ -89,8 +89,16 @@ module Ez
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
|
93
|
-
|
92
|
+
def destroy
|
93
|
+
Manager::Hooks.can?(:can_destroy?, ez_resource_config, ez_resource_config.data)
|
94
|
+
ez_resource_config.data.delete
|
95
|
+
|
96
|
+
flash[:notice] = t('messages.removed',
|
97
|
+
resource_name: ez_resource_config.resource_name,
|
98
|
+
scope: Ez::Resources.config.i18n_scope)
|
99
|
+
|
100
|
+
redirect_to ez_resource_config.path_for(action: :index)
|
101
|
+
end
|
94
102
|
|
95
103
|
private
|
96
104
|
|
@@ -18,11 +18,12 @@ module Ez
|
|
18
18
|
|
19
19
|
def data
|
20
20
|
@data ||= case controller.action_name
|
21
|
-
when 'index'
|
22
|
-
when 'new'
|
23
|
-
when 'show'
|
24
|
-
when 'edit'
|
25
|
-
when 'update'
|
21
|
+
when 'index' then collection
|
22
|
+
when 'new' then new_resource
|
23
|
+
when 'show' then resource
|
24
|
+
when 'edit' then resource
|
25
|
+
when 'update' then resource
|
26
|
+
when 'destroy' then resource
|
26
27
|
else
|
27
28
|
raise ConfigurationError, "Invalid action #{controller.action_name}"
|
28
29
|
end
|
data/lib/ez/resources/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volodya Sveredyuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cells-rails
|