cm-admin 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/javascript/packs/cm_admin/scaffolds.js +8 -5
- data/app/views/cm_admin/main/show.html.slim +9 -6
- data/lib/cm_admin/model.rb +1 -1
- data/lib/cm_admin/version.rb +1 -1
- data/lib/generators/cm_admin/install_generator.rb +1 -1
- data/lib/generators/cm_admin/policy_generator.rb +2 -0
- data/lib/generators/cm_admin/templates/cm_admin_initializer.rb +1 -1
- data/lib/generators/cm_admin/templates/policy.rb +1 -1
- 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: 0644c45e1ae1e807b94e66341d607778f8ca9fbe456a1d741d34db0cf5489550
|
4
|
+
data.tar.gz: 3cb2975b1c28a7cf6e150c16bb4e235750e02fb2ce39df110a4b2bb0b17f6a7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 412c8867112a3241b3e71b9049473f437bcc99950cf9c286495d5bd85b25459446a3465d150703cf4056c49daadfa1dd556eb0172e873cab2d665090c9d9c66c
|
7
|
+
data.tar.gz: ec362ed640f95dd335b653d6040c904d40b53fb941eeb7f0eeefe94bf3d38910fdbdf5a00fb68b5b303ab15b578b680d0ed79cd764748813ef70b3556d138666
|
@@ -1,4 +1,4 @@
|
|
1
|
-
$(document).
|
1
|
+
$(document).on('turbolinks:load', function () {
|
2
2
|
$('.select-2').select2();
|
3
3
|
flatpickr("[data-behaviour='date-only']", {})
|
4
4
|
flatpickr("[data-behaviour='date-time']", {
|
@@ -7,10 +7,13 @@ $(document).ready(function(e) {
|
|
7
7
|
flatpickr("[data-behaviour='filter'][data-filter-type='date']", {
|
8
8
|
mode: 'range'
|
9
9
|
})
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
var el = document.getElementsByClassName('columns-list')
|
11
|
+
if(el[0]) {
|
12
|
+
Sortable.create(el[0],{
|
13
|
+
handle: '.dragger',
|
14
|
+
animation: 150
|
15
|
+
});
|
16
|
+
}
|
14
17
|
});
|
15
18
|
|
16
19
|
$(document).on("keypress keyup blur", "[data-behaviour='decimal-only'], [data-behaviour='filter'][data-filter-type='range']", function (e) {
|
@@ -4,9 +4,12 @@
|
|
4
4
|
== render 'cm_admin/main/top_navbar'
|
5
5
|
== render 'cm_admin/main/tabs'
|
6
6
|
.show-page__inner.scrollable
|
7
|
-
- @
|
8
|
-
.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
- if @action.partial
|
8
|
+
== render @action.partial
|
9
|
+
- else
|
10
|
+
- @model.available_fields[:show].each do |section|
|
11
|
+
.info-section
|
12
|
+
p.section-heading = section.section_name
|
13
|
+
.paper
|
14
|
+
- section.available_section_fields.each do |field|
|
15
|
+
= show_field(@ar_object, field)
|
data/lib/cm_admin/model.rb
CHANGED
@@ -161,7 +161,7 @@ module CmAdmin
|
|
161
161
|
redirect_url = @model.current_action.redirection_url || @action.redirection_url || request.referrer || "/cm_admin/#{@model.ar_model.table_name}/#{@ar_object.id}"
|
162
162
|
format.html { redirect_to redirect_url, notice: "#{@action.name.titleize} is successful" }
|
163
163
|
else
|
164
|
-
error_messages =
|
164
|
+
error_messages = ar_object.errors.full_messages.map{|error_message| "<li>#{error_message}</li>"}.join
|
165
165
|
format.html { redirect_to request.referrer, alert: "<b>#{@action.name.titleize} is unsuccessful</b><br /><ul>#{error_messages}</ul>" }
|
166
166
|
end
|
167
167
|
end
|
data/lib/cm_admin/version.rb
CHANGED
@@ -6,7 +6,7 @@ module CmAdmin
|
|
6
6
|
source_root File.expand_path('templates', __dir__)
|
7
7
|
|
8
8
|
def copy_initializer
|
9
|
-
copy_file 'cm_admin_initializer.rb', 'config/initializers/
|
9
|
+
copy_file 'cm_admin_initializer.rb', 'config/initializers/zcm_admin.rb'
|
10
10
|
copy_file 'custom.js', 'app/assets/javascripts/cm_admin/custom.js'
|
11
11
|
copy_file 'custom.css', 'app/assets/stylesheets/cm_admin/custom.css'
|
12
12
|
copy_file 'application_policy.rb', 'app/policies/application_policy.rb'
|
@@ -6,6 +6,8 @@ module CmAdmin
|
|
6
6
|
source_root File.expand_path('templates', __dir__)
|
7
7
|
|
8
8
|
def copy_policy_files
|
9
|
+
cm_model = CmAdmin::Model.find_by({name: file_name})
|
10
|
+
raise "cm_admin is not defined inside #{file_name} model" unless cm_model.present?
|
9
11
|
template "policy.rb", "app/policies/cm_admin/#{file_name}_policy.rb"
|
10
12
|
end
|
11
13
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class CmAdmin::<%= class_name %>Policy < ApplicationPolicy
|
2
|
-
<%- available_action_names = (
|
2
|
+
<%- available_action_names = (cm_model.available_actions.map{|action| action.name}.uniq - ['custom_action', 'new', 'edit']) %>
|
3
3
|
<%- available_action_names.each do |action_name| %>
|
4
4
|
def <%= action_name %>?
|
5
5
|
<%= CmAdmin.authorized_roles.map {|role| "@user.#{role}" }.join(' && ') %>
|
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: 0.6.
|
4
|
+
version: 0.6.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: 2022-
|
13
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pagy
|