cm-admin 1.4.9 → 1.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3bdeb9aab9e5eb7d88bfa184cf5fdd2282650bbc065e1f5139b3c417f3fed34
4
- data.tar.gz: 228f5e430f7066eb1c1db1a83ddd21700e9ca7030bffef76cbd45c87ac543680
3
+ metadata.gz: 4ff4795451733611c79424a5a0ac4aaacd838b34c8d7aea5fdfe6cb127367a97
4
+ data.tar.gz: 4f856a769adc82e99b13a243973906ef387cb00fe892eec14422286f622e80b7
5
5
  SHA512:
6
- metadata.gz: 50a43eb5dbc704f6b7018260d3d844ba6f7ba9cf2d465cfc16b72d594b879883a90615ef5985df225d6db54315b449cb2edfbebb4c26392770ca7864a8dfbf47
7
- data.tar.gz: c91fc2f56e355271d49009e991e00156b29e5d8ccab21d64b0fe787595c88d12a0a1eb8b83ea874014b1f7c6a5f8a4d4199b87ecac6bec26dc74c9bdf7efee0a
6
+ metadata.gz: faa21284eae53b8fe3a1834bf6a27d0820197e714da9e23d6243d14ed54d94db314260da3db6893dba3dff37ec1e8e377af27eb668a98fa5de513b94edb1c29f
7
+ data.tar.gz: ad2570287ad72e499c468e9006720022fe67d1a1f98d10ab60c88cbdeaccf0d1f6fd0c492f5141ad08b3de745bb2d1373797b6af1343b721fbdec121404e9fd8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (1.4.8)
4
+ cm-admin (1.5.1)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -128,7 +128,7 @@ GEM
128
128
  net-pop
129
129
  net-smtp
130
130
  marcel (1.0.4)
131
- method_source (1.0.0)
131
+ method_source (1.1.0)
132
132
  mini_mime (1.1.5)
133
133
  minitest (5.18.1)
134
134
  net-imap (0.4.10)
@@ -138,10 +138,10 @@ GEM
138
138
  net-protocol
139
139
  net-protocol (0.2.2)
140
140
  timeout
141
- net-smtp (0.4.0.1)
141
+ net-smtp (0.5.0)
142
142
  net-protocol
143
143
  nio4r (2.7.1)
144
- nokogiri (1.16.3-arm64-darwin)
144
+ nokogiri (1.16.4-arm64-darwin)
145
145
  racc (~> 1.4)
146
146
  pagy (4.11.0)
147
147
  parallel (1.22.1)
@@ -42,7 +42,9 @@ var getFilteredData = function(filterType, filterValue, filterColumn=null) {
42
42
  // Generate the queryString by concatenating the filterParams and
43
43
  // searchParams that are already applied, if searchParams are present.
44
44
  var searchParams = window.location.search
45
- if (searchParams.length > 0) {
45
+ var searchParamshash = getParamsAsObject(searchParams)
46
+ var tempsearchParamshash = delete searchParamshash['page']
47
+ if (tempsearchParamshash.length > 0) {
46
48
  // Delete the previous applied value for multi_select filter from the
47
49
  // searchParams as altering the array with new and old value will create
48
50
  // more complicated logic. The new value is passed and structured in
@@ -214,6 +216,7 @@ var unhideClearFilterBtn = function(filterValue) {
214
216
 
215
217
  // Selecting options for single and multi select filters
216
218
  $(document).on('click', '[data-behaviour="select-option"]', function(e) {
219
+ debugger
217
220
  var filterType = $(this).data('filter-type')
218
221
  var filterColumn = $(this).data('db-column')
219
222
 
@@ -326,7 +329,6 @@ $(document).on('click', '[data-behaviour="selected-chip"]', function(e) {
326
329
  var filterType = $(this).parents(':nth(5)').find('.filter-chip').data('filter-type')
327
330
  var filterColumn = $(this).parents(':nth(5)').find('.filter-chip').data('db-column')
328
331
  var filterValue = $(this).siblings().text()
329
-
330
332
  var selectElement = $('[data-behaviour="select-option"][data-filter-type=' + filterType + '][data-db-column=' + filterColumn + ']')
331
333
  $(this).parent().remove()
332
334
 
@@ -1,8 +1,8 @@
1
- $(document).on('click', '.form_submit', function(e) {
1
+ $(document).on('click', '.form_submit', function (e) {
2
2
  e.preventDefault();
3
3
  var submit = [];
4
4
  var form_class = $(this).data('form-class');
5
- $("." + form_class + " input.required, ." + form_class + " textarea.required").each(function() {
5
+ $("." + form_class + " input.required, ." + form_class + " textarea.required").each(function () {
6
6
  $(this).removeClass('is-invalid');
7
7
  if ($(this).val().trim().length === 0) {
8
8
  $(this).addClass('is-invalid');
@@ -10,15 +10,15 @@ $(document).on('click', '.form_submit', function(e) {
10
10
  submit.push(true);
11
11
  }
12
12
  });
13
- $("." + form_class + " select.required").each(function() {
13
+ $("." + form_class + " select.required").each(function () {
14
14
  $(this).removeClass('is-invalid');
15
15
  if ($(this).val().trim().length === 0) {
16
- $(this).parent().find('.select2').addClass('is-invalid');
16
+ $(this).parent().find('select').addClass('is-invalid');
17
17
  $(this)[0].scrollIntoView(true);
18
18
  submit.push(true);
19
19
  }
20
20
  });
21
- $('.nested_input_validation').each(function() {
21
+ $('.nested_input_validation').each(function () {
22
22
  var class_name;
23
23
  class_name = $(this).data('class-name');
24
24
  $(this).parents(':nth(1)').find('.' + class_name).addClass('hidden');
@@ -42,8 +42,16 @@ document.addEventListener("turbo:load", function () {
42
42
  setup_select_2_ajax();
43
43
  });
44
44
 
45
- $(document).on('click', '.menu-item', function(e) {
46
- $('.profile-popup').toggleClass('hidden');
45
+ $(document).on('click', '[data-behaviour="toggle-profile-popup"]', function(e) {
46
+ e.stopPropagation();
47
+ $('[data-behaviour="profile-popup"]').toggleClass('hidden');
48
+ });
49
+
50
+ $(document).on('click', function(e) {
51
+ var popup = $('[data-behaviour="profile-popup"]');
52
+ if (!popup.is(e.target) && popup.has(e.target).length === 0) {
53
+ popup.addClass('hidden');
54
+ }
47
55
  });
48
56
 
49
57
  $(document).on('click', '.destroy-attachment', function(e) {
@@ -1,4 +1,4 @@
1
- @import '../helpers/index.scss';
1
+ @import "../helpers/index.scss";
2
2
 
3
3
  .auth {
4
4
  display: flex;
@@ -66,7 +66,8 @@
66
66
  &:focus {
67
67
  border-color: #66afe9 !important;
68
68
  outline: 0 !important;
69
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6) !important;
69
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
70
+ 0 0 8px rgba(102, 175, 233, 0.6) !important;
70
71
  }
71
72
  }
72
73
  }
@@ -101,8 +102,9 @@
101
102
  height: 22px;
102
103
  margin-right: 8px;
103
104
  @include font($size: 10px, $color: $white, $weight: 900);
105
+ line-height: 24px;
104
106
  background-color: $brand-color;
105
- vertical-align: middle;
107
+ vertical-align: middle;
106
108
  border-radius: 50%;
107
109
  img {
108
110
  width: 22px;
@@ -188,4 +190,4 @@
188
190
  }
189
191
  }
190
192
  }
191
- }
193
+ }
@@ -3,7 +3,6 @@
3
3
 
4
4
  .entity-header {
5
5
  @extend .d-flex.justify-content-between.align-items-start.p-4;
6
- // min-height: 109px; // Height needs to be removed once all the layouts are revamped
7
6
  background-color: var(--bs-white);
8
7
  &__info {
9
8
  .breadcrumb {
@@ -1,4 +1,5 @@
1
1
  @import "../helpers/index.scss";
2
+ @import "../dependency/bootstrap/scss/bootstrap";
2
3
 
3
4
  .quick-search-modal {
4
5
  .modal-dialog {
@@ -11,12 +12,17 @@
11
12
  }
12
13
  }
13
14
  .quick-search-field {
15
+ @extend .input-group;
16
+ .search-input {
17
+ @extend .form-control;
18
+ }
14
19
  .clear-search {
15
20
  position: absolute;
16
21
  top: 8px;
17
22
  right: 16px;
18
23
  @include font($size: $t4-text, $color: $ink-lighter-clr);
19
24
  line-height: 22px;
25
+ z-index: 9;
20
26
  cursor: pointer;
21
27
  }
22
28
  }
@@ -172,8 +172,8 @@
172
172
  display: inline-flex;
173
173
  align-items: center;
174
174
  justify-content: center;
175
- width: 32px;
176
- height: 32px;
175
+ width: 22px;
176
+ height: 22px;
177
177
  @include font($size: $t3-text, $color: $white, $weight: 600);
178
178
  background-color: $brand-color;
179
179
  border-radius: $circle;
@@ -216,5 +216,3 @@
216
216
  }
217
217
  }
218
218
  }
219
-
220
-
@@ -1,7 +1,8 @@
1
1
  - if nested_table_field.display_type == :table
2
2
  tr.nested-fields
3
3
  td.item-delete-cell
4
- = link_to_remove_association "", f, class: 'fa-regular fa-trash-can btn-ghost'
4
+ - if nested_table_field.is_deletable.call(f.object)
5
+ = link_to_remove_association "", f, class: 'fa-regular fa-trash-can btn-ghost'
5
6
  - nested_table_field.fields.each do |field|
6
7
  td data-field-type="#{field.input_type}"
7
8
  = input_field_for_column(f, field)
@@ -9,11 +10,12 @@
9
10
  .form-card.nested-fields
10
11
  .card-body
11
12
  .card-item data-card-name=assoc_name
12
- .card-title-wrapper
13
- h6.card-title
14
- | Title 1
15
- .card-delete
16
- = link_to_remove_association "", f, class: 'fa-regular fa-trash-can btn-ghost'
13
+ - if nested_table_field.is_deletable.call(f.object)
14
+ .card-title-wrapper
15
+ h6.card-title
16
+ | Title 1
17
+ .card-delete
18
+ = link_to_remove_association "", f, class: 'fa-regular fa-trash-can btn-ghost'
17
19
  div
18
20
  - nested_table_field.fields.each do |field|
19
21
  .form-field
@@ -17,7 +17,7 @@
17
17
  = f.fields_for table_name do |record|
18
18
  - if record.object.persisted? || @ar_object.errors.present?
19
19
  = render partial: '/cm_admin/main/nested_fields', locals: { f: record, assoc_name: assoc_name, nested_table_field: nested_table_field }
20
- - if f.object._reflections[assoc_name.to_s]&.macro == :has_many
20
+ - if f.object._reflections[assoc_name.to_s]&.macro == :has_many && nested_table_field.is_creatable.call(f.object)
21
21
  .nested-table-footer
22
22
  = link_to_add_association "#{nested_table_field.submit_text}", f, table_name, partial: '/cm_admin/main/nested_fields', render_options: {locals: { assoc_name: assoc_name, nested_table_field: nested_table_field }}, data: { association_insertion_node: ".insert-cocoon-position-#{uniq_no}", association_insertion_method: 'append' }, class: 'btn-primary'
23
23
  - else
@@ -13,10 +13,10 @@
13
13
  / span
14
14
  / i.fa.fa-angle-down
15
15
  - if flash[:alert].present?
16
- .alert.alert-danger role="alert"
16
+ .alert.alert-danger.me-4 role="alert"
17
17
  = flash[:alert].html_safe
18
18
  - elsif flash[:notice].present?
19
- .alert.alert-success
19
+ .alert.alert-success.me-4
20
20
  = flash[:notice].html_safe
21
21
 
22
22
  - bulk_actions = actions_filter(@model, @ar_object, :bulk_action)
@@ -4,8 +4,8 @@
4
4
  .breadcrumb
5
5
  = link_to "#{@model.name.titleize.pluralize} /", cm_admin.send(:"#{@model.name.underscore}_index_path"), class: 'text-reset'
6
6
  h4 = action_title
7
- - if @model.current_action.page_description
8
- p.mb-0.text-body-secondary = @model.current_action.page_description
7
+ / - if @model.current_action.page_description
8
+ / p.mb-0.text-body-secondary = @model.current_action.page_description
9
9
  .entity-header__actions
10
10
  - if @model.current_action.name == 'index'
11
11
  - if has_valid_policy(@ar_object, :exportable)
@@ -14,16 +14,16 @@
14
14
 
15
15
  - if defined?(user_full_name)
16
16
  .sidebar__footer
17
- .menu-item
17
+ .menu-item data-behaviour="toggle-profile-popup"
18
18
  .profile-name
19
19
  span.profile-avatar #{user_full_name.first.titleize}
20
20
  | #{user_full_name.titleize}
21
- .profile-popup.hidden
21
+ .profile-popup.hidden data-behaviour="profile-popup"
22
22
  .profile-info
23
23
  .profile-info__left
24
24
  p.name-text = user_full_name
25
25
  p.email-text = current_user.email
26
- .profile-info__right
26
+ .profile-info__right #{user_full_name.first.titleize}
27
27
  .auth-option
28
28
  = button_to destroy_user_session_path, method: :delete, class: 'auth-link', data: { turbo: :false }
29
29
  | Logout
@@ -3,13 +3,11 @@
3
3
  .modal-content
4
4
  .modal-body
5
5
  .quick-search-field
6
- .form-field
7
- .field-input-wrapper
8
- input#quick-search-input.search-input placeholder="Search" data-behaviour="quick-input-search" autocomplete="off"
9
- span.search-input-icon
10
- i.fa.fa-search
11
- span.clear-search.hidden
12
- i.fa.fa-times
6
+ span.input-group-text
7
+ i.fa.fa-search
8
+ input#quick-search-input.search-input placeholder="Search" data-behaviour="quick-input-search" autocomplete="off"
9
+ span.clear-search.hidden
10
+ i.fa.fa-times
13
11
  .search-results-container.list-area
14
12
  = navigation_links('quick_links')
15
13
  .results-action
@@ -4,7 +4,7 @@ module CmAdmin
4
4
 
5
5
  # NestedField is like a container to hold Field and FormField object
6
6
 
7
- attr_accessor :field_name, :display_type, :fields, :associated_fields, :parent_field, :header, :label, :submit_text
7
+ attr_accessor :field_name, :display_type, :fields, :associated_fields, :parent_field, :header, :label, :submit_text, :is_deletable, :is_creatable
8
8
 
9
9
  def initialize(field_name, attributes={})
10
10
  @field_name = field_name
@@ -19,6 +19,8 @@ module CmAdmin
19
19
  self.fields = []
20
20
  self.associated_fields = []
21
21
  self.submit_text = "+ Add #{@field_name.to_s.titleize}"
22
+ self.is_deletable = lambda { |arg| return true }
23
+ self.is_creatable = lambda { |arg| return true }
22
24
  end
23
25
 
24
26
  end
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '1.4.9'
2
+ VERSION = '1.5.1'
3
3
  end
@@ -198,7 +198,7 @@ module CmAdmin
198
198
  else
199
199
  form_obj.check_box cm_field.field_name,
200
200
  {
201
- class: "field-control cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
201
+ class: "cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
202
202
  disabled: cm_field.disabled.call(form_obj.object),
203
203
  data: {
204
204
  field_name: cm_field.field_name,
@@ -228,7 +228,7 @@ module CmAdmin
228
228
  content_tag :div, class: 'cm-radio-tag' do
229
229
  concat form_obj.check_box cm_field.field_name,
230
230
  {
231
- class: "field-control cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
231
+ class: "cm-checkbox #{required_class} #{target_action.present? ? 'linked-field-request' : ''}",
232
232
  disabled: cm_field.disabled.call(form_obj.object),
233
233
  name: "#{@model.name.underscore}[#{cm_field.field_name}][]",
234
234
  data: {
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: 1.4.9
4
+ version: 1.5.1
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: 2024-04-05 00:00:00.000000000 Z
13
+ date: 2024-05-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: caxlsx_rails
@@ -498,7 +498,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
498
498
  - !ruby/object:Gem::Version
499
499
  version: '0'
500
500
  requirements: []
501
- rubygems_version: 3.5.4
501
+ rubygems_version: 3.2.3
502
502
  signing_key:
503
503
  specification_version: 4
504
504
  summary: CmAdmin is a robust gem designed to assist in creating admin panels for Rails