cm-admin 1.4.1 → 1.4.2

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: 71972c83f78f398ea36d7ebcff092bd08d6ebaed009bbd7cd4a7157932b37798
4
- data.tar.gz: 43da1cdbad06a71d04357c6f63d9a2c16b9459c04dcabeb6b8e264c90187af73
3
+ metadata.gz: c4b058ca1f32279400f2104a7f08d34530b85ef2626554c51ca4c9ef37a0751a
4
+ data.tar.gz: cdd8426486024c7cc1cac97cbc82301ba85fd89babaa5551dfcc67d84fdbc790
5
5
  SHA512:
6
- metadata.gz: fc28d6cebd0d4c19193922677bfa2ad13fe384d3453bd31fce263d32bfe79a6f8a48344a36874bc3f002b25c441d532e95557b1f565a932d7a688f54145971b0
7
- data.tar.gz: 68b1596bb461e543f11591d3b969162e7f6465e7cf44ad24225b3191dc9256ccb579173a138e11f8ecc4256a0a1cd15ec4c3316d99c4f87f28f028ccf64ac9f6
6
+ metadata.gz: 3702d39e7faec73a45ab2ed4d890ede66c6260a5255d9401e326a1f08efd1d7b6ada253a97a3fbe5037a2f406aa26b1409acd55da0f5e3ba6d6eddfe9bbbb164
7
+ data.tar.gz: d87c2cbcd760bec066da60339ff88afbdff412a26508083c0d02a6eb5dc5ad630bf53f369506aa6e0adca730d45beaa8192f6fb316aad372ad1161e5eee5422a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (1.4.1)
4
+ cm-admin (1.4.2)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -9,7 +9,7 @@
9
9
  width: 100%;
10
10
  height: 100%;
11
11
  z-index: 5;
12
- background-color: rgba(0, 0, 0, .7);
12
+ background-color: rgba(0, 0, 0, 0.7);
13
13
  &__container {
14
14
  position: relative;
15
15
  width: 360px;
@@ -52,32 +52,32 @@
52
52
  }
53
53
 
54
54
  .drawer-slide-in {
55
- animation: slideInLeft .3s ease-in forwards;
55
+ animation: slideInLeft 0.3s ease-in forwards;
56
56
  }
57
57
 
58
58
  .drawer-slide-out {
59
- animation: slideOutLeft .3s ease-in forwards;
59
+ animation: slideOutLeft 0.3s ease-in forwards;
60
60
  }
61
61
 
62
62
  @keyframes slideInLeft {
63
63
  0% {
64
- left: -400px;
65
- opacity: 0;
64
+ left: -400px;
65
+ opacity: 0;
66
66
  }
67
67
  100% {
68
- left: 0;
69
- opacity: 1;
68
+ left: 0;
69
+ opacity: 1;
70
70
  }
71
71
  }
72
72
 
73
73
  @keyframes slideOutLeft {
74
74
  0% {
75
- left: 0;
76
- opacity: 1;
75
+ left: 0;
76
+ opacity: 1;
77
77
  }
78
78
  100% {
79
- left: -400px;
80
- opacity: 0;
79
+ left: -400px;
80
+ opacity: 0;
81
81
  }
82
82
  }
83
83
 
@@ -86,3 +86,22 @@
86
86
  margin-left: 8px;
87
87
  @include font($size: $t4-text, $color: $brand-color);
88
88
  }
89
+
90
+ //Kanban drawer styles
91
+ .kanban-drawer {
92
+ .cm-drawer {
93
+ display: flex;
94
+ justify-content: flex-end;
95
+ &__actions {
96
+ display: flex;
97
+ flex-direction: column;
98
+ margin: 16px;
99
+ }
100
+ &__container {
101
+ width: 624px;
102
+ [class^="col-"] {
103
+ width: 100% !important;
104
+ }
105
+ }
106
+ }
107
+ }
@@ -10,7 +10,9 @@ module CmAdmin
10
10
  # Based on the params the filter and pagination object to be set
11
11
  records = "CmAdmin::#{@model.name}Policy::Scope".constantize.new(Current.user, @model.name.constantize).resolve
12
12
  records = apply_scopes(records)
13
- if (request.xhr? && params[:view_type] == 'kanban') || @current_action.view_type == :kanban
13
+ if (['table', 'card'].include?(params[:view_type]) || [:table, :card].include?(@current_action.view_type))
14
+ @ar_object = filter_by(params, records, @model.filter_params(params))
15
+ elsif (request.xhr? && params[:view_type] == 'kanban') || @current_action.view_type == :kanban
14
16
  @ar_object = kanban_filter_by(params, records, @model.filter_params(params))
15
17
  else
16
18
  @ar_object = filter_by(params, records, @model.filter_params(params))
@@ -32,7 +34,11 @@ module CmAdmin
32
34
  @ar_object = scoped_model.find(params[:id])
33
35
  resource_identifier
34
36
  respond_to do |format|
35
- format.html { render '/cm_admin/main/' + action_name }
37
+ if request.xhr?
38
+ format.html { render partial: '/cm_admin/main/show_content' }
39
+ else
40
+ format.html { render '/cm_admin/main/' + action_name }
41
+ end
36
42
  end
37
43
  end
38
44
 
@@ -278,14 +284,14 @@ module CmAdmin
278
284
  filtered_result.data = {}
279
285
  filtered_result.paging = {}
280
286
  filtered_result.paging['next_page'] = true
281
- group_record_count = final_data.group(@current_action.kanban_attr[:column_name]).count
287
+ group_record_count = final_data.group(params[:kanban_column_name] || @current_action.kanban_attr[:column_name]).count
282
288
  per_page = params[:per_page] || 20
283
289
  page = params[:page] || 1
284
290
  max_page = (group_record_count.values.max.to_i / per_page.to_f).ceil
285
291
  filtered_result.paging['next_page'] = (page.to_i < max_page)
286
292
  filtered_result.column_count = group_record_count.reject {|key, value| key.blank? }
287
293
 
288
- column_names = @model.ar_model.send(@current_action.kanban_attr[:column_name].pluralize).keys
294
+ column_names = @model.ar_model.send(params[:kanban_column_name]&.pluralize || @current_action.kanban_attr[:column_name].pluralize).keys
289
295
  if @current_action.kanban_attr[:only].present?
290
296
  column_names &= @current_action.kanban_attr[:only]
291
297
  elsif @current_action.kanban_attr[:exclude].present?
@@ -1,2 +1,11 @@
1
- .cm-drawer.batch-order-item.hidden
2
- .cm-drawer__container
1
+ .kanban-drawer
2
+ .cm-drawer.show-as-drawer.hidden
3
+ .cm-drawer__actions
4
+ a.btn-ghost.mb-2 data-behaviour="show-drawer-close"
5
+ span
6
+ i.fa.fa-xmark
7
+ a.btn-ghost data-behaviour="show-drawer-redirect"
8
+ span
9
+ i.fa.fa-up-right-and-down-left-from-center
10
+ .cm-drawer__container
11
+
@@ -0,0 +1,14 @@
1
+ .show-page__header.page-top-bar
2
+ == render 'cm_admin/main/top_navbar'
3
+ == render 'cm_admin/main/tabs'
4
+ .show-page__inner
5
+ - if @action.partial
6
+ == render @action.partial
7
+ - else
8
+ - @model.available_fields[:show].each do |entity|
9
+ .row
10
+ - if entity.class == CmAdmin::Models::Row
11
+ - entity.sections.each do |section|
12
+ = render partial: 'cm_admin/main/show_section', locals: { section: section }
13
+ - elsif entity.class == CmAdmin::Models::Section
14
+ = render partial: 'cm_admin/main/show_section', locals: { section: entity }
@@ -9,12 +9,12 @@
9
9
  .cm-index-page__table-container
10
10
  - if @action.partial
11
11
  == render @action.partial
12
- - elsif params[:view_type] == 'card' || @current_action.view_type == :card_view
13
- == render 'cm_admin/main/card'
12
+ - elsif params[:view_type] == 'table' || @current_action.view_type == :table
13
+ == render 'cm_admin/main/table'
14
+ - elsif params[:view_type] == 'card' || @current_action.view_type == :card
15
+ == render "cm_admin/#{@model.name.underscore}/card"
14
16
  - elsif params[:view_type] == 'kanban' || @current_action.view_type == :kanban
15
17
  == render 'cm_admin/main/kanban'
16
- - else
17
- == render 'cm_admin/main/table'
18
18
  = column_pop_up(@model)
19
19
  = manage_column_pop_up(@model)
20
20
 
@@ -1,15 +1,2 @@
1
1
  .show-page
2
- .show-page__header.page-top-bar
3
- == render 'cm_admin/main/top_navbar'
4
- == render 'cm_admin/main/tabs'
5
- .show-page__inner
6
- - if @action.partial
7
- == render @action.partial
8
- - else
9
- - @model.available_fields[:show].each do |entity|
10
- .row
11
- - if entity.class == CmAdmin::Models::Row
12
- - entity.sections.each do |section|
13
- = render partial: 'cm_admin/main/show_section', locals: { section: section }
14
- - elsif entity.class == CmAdmin::Models::Section
15
- = render partial: 'cm_admin/main/show_section', locals: { section: entity }
2
+ = render partial: 'cm_admin/main/show_content'
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  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: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sajinmp
@@ -363,6 +363,7 @@ files:
363
363
  - app/views/cm_admin/main/_nested_table_form.html.slim
364
364
  - app/views/cm_admin/main/_nested_table_section.html.slim
365
365
  - app/views/cm_admin/main/_show_as_drawer.html.slim
366
+ - app/views/cm_admin/main/_show_content.html.slim
366
367
  - app/views/cm_admin/main/_show_section.html.slim
367
368
  - app/views/cm_admin/main/_table.html.slim
368
369
  - app/views/cm_admin/main/_tabs.html.slim