cm-admin 2.4.1 → 2.4.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: 9bcc252aa00bb8dac32547d85cf1fd53c72a4c9726b3e092389e9ad1ef464095
4
- data.tar.gz: 4c5c3d415f82750e64ab281791a90ed8a1069b52e136f399fca6baabe34a9bb0
3
+ metadata.gz: 1811b7dc704a66a4f26ec20ee3ff1a72c1cd369d19cc968d60fcfb135eab8ded
4
+ data.tar.gz: d2b62571d0a3f3205615a604bcfdaa046590621478be3aebd37be2025dac130b
5
5
  SHA512:
6
- metadata.gz: d9c004225ef93e480ff61f4f1a244639afbab8fcdd532295f4cd459b8e693429f6a62810871a0f3a7bdcba67c42883c6fdf069b983ccd2e8ffc244af536212b6
7
- data.tar.gz: f49305ebbc5e40be87ab257273e26a2c51fffa497f6dd9ae4831cfb17d6c07f1a4e98ce629337b0ce0e8925d10a4c8147a0079f8b86b380c96860722507e023b
6
+ metadata.gz: ee0549268bffe487c3eeabea14b127ea036b71ffbf18fbcdca944832c42558fb121f11cb4b4e7f5eb1baa9153614e588e92c21b295efce2511c06c7cfcd414a8
7
+ data.tar.gz: da4a8ab490c02decefe6597d8937da700762e91171af8859ee246e8cf769dab48356c292c750e26f111891496cf4100b865dd728cb750f7e979d0d90c10e9676
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (2.4.1)
4
+ cm-admin (2.4.3)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -47,7 +47,8 @@ $(document).on("click", '[data-behaviour="form_submit"]', function (e) {
47
47
  });
48
48
  if (submit.length === 0) {
49
49
  $("." + form_class).submit();
50
- return $('[data-behaviour="form_submit"]').button("loading");
50
+ $('[data-behaviour="form_submit_spinner"]').removeClass("visually-hidden");
51
+ return $('[data-behaviour="form_submit"]').addClass("visually-hidden");
51
52
  }
52
53
  });
53
54
 
@@ -36,6 +36,10 @@
36
36
  text-decoration: underline;
37
37
  }
38
38
 
39
+ .cm-admin .btn-loading {
40
+ @extend .btn, .btn-primary, .btn-sm, .btn-icon-spacing, .disabled;
41
+ }
42
+
39
43
  // button mixin - We can use if needed
40
44
  // @include button-variant($background: #6554e0, $border: #6554e0);
41
45
 
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '2.4.1'
2
+ VERSION = '2.4.3'
3
3
  end
@@ -142,9 +142,14 @@ module CmAdmin
142
142
  ar_object = model_name.constantize.new if model_name.present?
143
143
  return unless field.input_type.to_s == 'single_select' && model_name.present? && has_valid_policy(ar_object, 'new')
144
144
 
145
+ entity_formatted_name = if field.can_create_new_entity.is_a?(Hash) && field.can_create_new_entity[:display_name].present?
146
+ field.can_create_new_entity[:display_name]
147
+ else
148
+ CmAdmin::Model.find_by(name: model_name)&.formatted_name
149
+ end
145
150
  field_id = form_obj.field_id(field.field_name.to_sym)
146
151
  drawer_fetch_url = "#{CmAdmin::Engine.mount_path}/#{model_name.tableize}/fetch_drawer?from_field_id=#{field_id}"
147
- tag.div 'New Entity', class: 'drawer-btn', data: { behaviour: 'offcanvas', drawer_fetch_url: }
152
+ tag.div "New #{entity_formatted_name}", class: 'drawer-btn', data: { behaviour: 'offcanvas', drawer_fetch_url: }
148
153
  end
149
154
 
150
155
  def set_nested_section_form_fields(resource, form_obj, nested_sections)
@@ -180,7 +185,11 @@ module CmAdmin
180
185
 
181
186
  concat split_form_into_section(resource, form_obj, entities)
182
187
  concat tag.br
183
- concat form_obj.submit 'Save', class: 'btn-cta', data: { behaviour: 'form_submit', form_class: "cm_#{form_obj.object.class.name.downcase}_form" }
188
+ concat form_obj.submit 'Save', class: 'btn-cta', data: { behaviour: 'form_submit', form_class: "cm_#{form_obj.object.class.name.downcase}_form", turbo_submits_with: 'Submitting...' }
189
+ concat (button_tag(type: 'button', class: 'btn-loading visually-hidden', data: { behaviour: 'form_submit_spinner' }) do
190
+ concat content_tag(:span, '', class: 'spinner-border spinner-border-sm', role: 'status')
191
+ concat ' Submitting...'
192
+ end)
184
193
  concat button_tag 'Discard', class: 'btn-secondary discard-form', data: { behaviour: 'discard_form' } unless @is_drawer_form
185
194
  end
186
195
  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: 2.4.1
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael
@@ -11,10 +11,10 @@ authors:
11
11
  - Pranav
12
12
  - Mahaveer
13
13
  - Austin
14
- autorequire:
14
+ autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2024-10-15 00:00:00.000000000 Z
17
+ date: 2024-10-17 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: caxlsx_rails
@@ -507,7 +507,7 @@ licenses:
507
507
  metadata:
508
508
  homepage_uri: https://github.com/commutatus/cm-admin
509
509
  source_code_uri: https://github.com/commutatus/cm-admin
510
- post_install_message:
510
+ post_install_message:
511
511
  rdoc_options: []
512
512
  require_paths:
513
513
  - lib
@@ -523,7 +523,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
523
523
  version: '0'
524
524
  requirements: []
525
525
  rubygems_version: 3.5.16
526
- signing_key:
526
+ signing_key:
527
527
  specification_version: 4
528
528
  summary: CmAdmin is a robust gem designed to assist in creating admin panels for Rails
529
529
  applications