cm-admin 4.1.0 → 4.1.2
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 +4 -4
- data/.github/workflows/test.yml +46 -0
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/cm_admin/form_validation.js +5 -0
- data/app/assets/stylesheets/cm_admin/base/table.scss +6 -3
- data/app/views/cm_admin/main/_associated_table.html.slim +1 -3
- data/app/views/cm_admin/main/_cm_pagy_nav.html.slim +2 -2
- data/app/views/cm_admin/main/_table.html.slim +1 -1
- data/app/views/cm_admin/roles/permissions.html.slim +5 -2
- data/cm_admin.gemspec +1 -1
- data/lib/cm_admin/version.rb +1 -1
- data/lib/cm_admin/view_helpers.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08cb28438df1f6c84b31f95bf13779e18a2900e4973fcd7591744284ba791b93'
|
4
|
+
data.tar.gz: 68ecf1bb6702de4a04486dd65213dd997828be32506cf9479322baf853c79fa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5fbf72b4cbef166f981864eba01a34477f72b53171b6745efdf360dacf8b5f3f5e19a4b0d57b31f5eb27d9c821bbcbc5dc750a47468528b293792d8ea435e43
|
7
|
+
data.tar.gz: cc020e41b2cd42e924bb4d2fb9410d30aab5fbcb95baf4366c48ae0ab0e64781584a901e1b83d578a4f726a8e03b7681763be8ebd5d26815d903f9d5782fe8a0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
if: "!contains(github.event.head_commit.message, '[skip-tests]')"
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
services:
|
11
|
+
postgres:
|
12
|
+
image: postgres:17
|
13
|
+
env:
|
14
|
+
POSTGRES_USER: postgres
|
15
|
+
POSTGRES_PASSWORD: postgres
|
16
|
+
ports:
|
17
|
+
- 5432:5432
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- name: Checkout code
|
21
|
+
uses: actions/checkout@v3
|
22
|
+
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: 3.3
|
27
|
+
bundler-cache: true
|
28
|
+
|
29
|
+
- name: Install dependencies
|
30
|
+
working-directory: feature-app
|
31
|
+
run: bundle install
|
32
|
+
|
33
|
+
- name: Set up database
|
34
|
+
working-directory: feature-app
|
35
|
+
run: |
|
36
|
+
cp config/database.yml.ci config/database.yml
|
37
|
+
RAILS_ENV=test bundle exec rails db:create
|
38
|
+
RAILS_ENV=test bundle exec rails db:migrate
|
39
|
+
|
40
|
+
- name: Precompile assets
|
41
|
+
working-directory: feature-app
|
42
|
+
run: RAILS_ENV=test bundle exec rails assets:precompile
|
43
|
+
|
44
|
+
- name: Run RSpec tests
|
45
|
+
working-directory: feature-app
|
46
|
+
run: bundle exec rspec
|
data/Gemfile.lock
CHANGED
@@ -58,4 +58,9 @@ $(document).on("click", '[data-behaviour="discard_form"]', function (e) {
|
|
58
58
|
const form = $(this).closest("form");
|
59
59
|
form[0].reset();
|
60
60
|
window.history.back();
|
61
|
+
});
|
62
|
+
|
63
|
+
$(document).on("turbo:submit-end", function(e){
|
64
|
+
$('[data-behaviour="form_submit_spinner"]').addClass("visually-hidden");
|
65
|
+
return $('[data-behaviour="form_submit"]').removeClass("visually-hidden");
|
61
66
|
});
|
@@ -4,6 +4,9 @@
|
|
4
4
|
|
5
5
|
&.associated-index {
|
6
6
|
background-color: transparent;
|
7
|
+
.table-wrapper {
|
8
|
+
height: calc(100vh - 290px);
|
9
|
+
}
|
7
10
|
}
|
8
11
|
|
9
12
|
.sticky-container {
|
@@ -38,7 +41,7 @@
|
|
38
41
|
.table-wrapper {
|
39
42
|
min-width: 720px;
|
40
43
|
max-width: fit-content;
|
41
|
-
|
44
|
+
height: calc(100vh - 215px);
|
42
45
|
overflow: auto;
|
43
46
|
.index-table {
|
44
47
|
@extend .table, .table-hover;
|
@@ -301,11 +304,11 @@
|
|
301
304
|
max-width: 48px;
|
302
305
|
}
|
303
306
|
[data-action-title-pad="2"] {
|
304
|
-
|
307
|
+
padding-left: 53px !important;
|
305
308
|
}
|
306
309
|
[data-action-title-pad="3"] {
|
307
310
|
padding-left: 101px !important;
|
308
|
-
|
311
|
+
}
|
309
312
|
th,
|
310
313
|
td {
|
311
314
|
min-width: 120px;
|
@@ -57,8 +57,6 @@
|
|
57
57
|
|
58
58
|
- if @associated_model
|
59
59
|
== render partial: 'cm_admin/main/actions_dropdown', locals: { cm_model: @associated_model, ar_object: ar_object }
|
60
|
-
|
61
60
|
.pagination-bar
|
62
|
-
p.count-text.m-0 Showing #{@associated_ar_object.pagy.from} to #{@associated_ar_object.pagy.to} out of #{@associated_ar_object.pagy.count}
|
61
|
+
p.count-text.m-0 Showing #{number_with_delimiter(@associated_ar_object.pagy.from.to_i)} to #{number_with_delimiter(@associated_ar_object.pagy.to.to_i)} out of #{number_with_delimiter(@associated_ar_object.pagy.count.to_i)}
|
63
62
|
== render partial: 'cm_admin/main/cm_pagy_nav', locals: { pagy: @associated_ar_object.pagy }
|
64
|
-
/ = render partial: 'cm_admin/main/member_custom_action_modal', locals: { cm_model: @associated_model, ar_collection: @associated_ar_object }
|
@@ -9,10 +9,10 @@ nav.pagination-actions role="navigation" aria-label="pager"
|
|
9
9
|
|
10
10
|
- pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
11
11
|
- if item.is_a?(Integer) # page link
|
12
|
-
span ==> link.call(item, item, 'class="btn-ghost"')
|
12
|
+
span ==> link.call(item, number_with_delimiter(item.to_i), 'class="btn-ghost"')
|
13
13
|
|
14
14
|
- elsif item.is_a?(String) # current page
|
15
|
-
span ==> link.call(item, item, 'class="btn-ghost active"')
|
15
|
+
span ==> link.call(item, number_with_delimiter(item.to_i), 'class="btn-ghost active"')
|
16
16
|
|
17
17
|
- elsif item == :gap # page gap
|
18
18
|
span.page.gap ==> pagy_t('pagy.nav.gap')
|
@@ -50,7 +50,7 @@
|
|
50
50
|
- if @model
|
51
51
|
== render partial: 'cm_admin/main/actions_dropdown', locals: { cm_model: @model, ar_object: ar_object }
|
52
52
|
.pagination-bar
|
53
|
-
p.count-text.m-0 Showing #{@ar_object.pagy.from} to #{@ar_object.pagy.to} out of #{@ar_object.pagy.count}
|
53
|
+
p.count-text.m-0 Showing #{number_with_delimiter(@ar_object.pagy.from.to_i)} to #{number_with_delimiter(@ar_object.pagy.to.to_i)} out of #{number_with_delimiter(@ar_object.pagy.count.to_i)}
|
54
54
|
== render partial: 'cm_admin/main/cm_pagy_nav', locals: { pagy: @ar_object.pagy }
|
55
55
|
|
56
56
|
= column_pop_up(@model)
|
@@ -35,5 +35,8 @@
|
|
35
35
|
.cm-select-tag class="#{permission.present? ? '' : 'hidden'}"
|
36
36
|
= 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}"})
|
37
37
|
.form-submit-button-container
|
38
|
-
= f.submit 'Save Changes', class:
|
39
|
-
=
|
38
|
+
= f.submit 'Save Changes', class: 'btn-cta', data: { behaviour: 'form_submit', form_class: "new_cm_permission", turbo_submits_with: 'Submitting...' }
|
39
|
+
= button_tag(type: 'button', class: 'btn-loading visually-hidden', data: { behaviour: 'form_submit_spinner' }) do
|
40
|
+
= content_tag(:span, '', class: 'spinner-border spinner-border-sm', role: 'status')
|
41
|
+
| Submitting...
|
42
|
+
= link_to 'Discard', cm_admin.send('cm_index_cm_role_path'), class: "btn-secondary ml-10"
|
data/cm_admin.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
25
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|feature-app)/}) }
|
27
27
|
end
|
28
28
|
spec.bindir = 'exe'
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/lib/cm_admin/version.rb
CHANGED
@@ -13,6 +13,7 @@ module CmAdmin
|
|
13
13
|
# Included Rails view helper
|
14
14
|
include ActionView::Helpers::FormTagHelper
|
15
15
|
include ActionView::Helpers::TagHelper
|
16
|
+
include ActionView::Helpers::NumberHelper
|
16
17
|
|
17
18
|
def exportable(_klass, html_class: [])
|
18
19
|
tag.a 'Export as excel', class: html_class.append('filter-btn modal-btn me-2'), data: { toggle: 'modal', target: '#exportmodal' } do
|
@@ -80,7 +81,7 @@ module CmAdmin
|
|
80
81
|
|
81
82
|
def humanized_ar_collection_count(count, model_name)
|
82
83
|
table_name = count == 1 ? model_name.singularize : model_name.pluralize
|
83
|
-
"#{count} #{table_name.humanize.downcase} found"
|
84
|
+
"#{number_with_delimiter(count.to_i)} #{table_name.humanize.downcase} found"
|
84
85
|
end
|
85
86
|
|
86
87
|
def toast_message(message, toast_type)
|
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: 4.1.
|
4
|
+
version: 4.1.2
|
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-
|
17
|
+
date: 2024-12-03 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: caxlsx_rails
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- ".github/workflows/deploy-yard-docs.yml"
|
166
166
|
- ".github/workflows/linters.yml"
|
167
167
|
- ".github/workflows/release-gem.yml"
|
168
|
+
- ".github/workflows/test.yml"
|
168
169
|
- ".gitignore"
|
169
170
|
- ".rspec"
|
170
171
|
- ".rubocop-https---raw-githubusercontent-com-commutatus-cm-linters-main-rubocop-yml"
|