cm-admin 0.5.6 → 0.5.7

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: 9e71407dad6f3a42e093faa7247489382dd4b650b3c61f85b6758286a7d2ee45
4
- data.tar.gz: e50e11e94676d06e9044a58b84f20cb416d92e8a0a92507afa5ff362b98d9640
3
+ metadata.gz: 4005c7711af2f931298a2054cd527de1a67a92a42deaecd8fb71b37fbcdc5fb2
4
+ data.tar.gz: 8fa616289069247a2418896b7ac2cb4f6ca5ec1dfc121d5a06cececb9c3a5242
5
5
  SHA512:
6
- metadata.gz: 07bf22fe0ea5157252da7a3b17b012f6842ce5da4815764fd6ace17af0203db2dd09158d97efc9f19c51e9df5529f742c7284e501b5879b3694e48aed4283cf3
7
- data.tar.gz: 9433f9fd8d71db8f7d1a95668e723cf655cc91e66df19b73d73f405336a7649e8c2a1f011c901a898990512a1e4eefe5092ed7f6502feabf75599a2e0ac0ff1d
6
+ metadata.gz: 82d898a13ff420a9c3e7b9df6f9daca9174df4bc3587c879cac1817cdbdcb5e812562f81a7e5ed8716729da466da5240037e3d7bca36900d5efb355859c4ca1a
7
+ data.tar.gz: 29a54f03bb2aaa0cec4aa0fecaef373376e94a4e6e47e67219245ae257f2f2774ad388e9a4b8b9510a23d45f130fc9a6703128403b512256525d2197dae292a0
@@ -83,4 +83,8 @@
83
83
  left: -400px;
84
84
  opacity: 0;
85
85
  }
86
+ }
87
+
88
+ .drawer {
89
+ cursor: pointer;
86
90
  }
@@ -31,21 +31,25 @@
31
31
  = show_field_value(ar_object, column)
32
32
  - if column.field_type == :drawer
33
33
  = render partial: column.drawer_partial, locals: { ar_object: ar_object}
34
- td.row-action-cell
35
- .row-action-tool
36
- button.secondary-btn.tool-btn type="button"
37
- span
38
- i.fa.fa-bars.bolder
39
- span
40
- i.fa.fa-angle-down
41
- .popup-card.table-export-popup.hidden
42
- .popup-option
43
- a href="#{page_url('edit', ar_object)}"
44
- | Edit
45
- - @model.available_actions.select{|act| act if act.route_type == 'member' && [:button, :modal].include?(act.display_type)}.each do |custom_action|
46
- - if custom_action.display_if.call(ar_object)
47
- .popup-option
48
- = link_to custom_action.name.titleize, custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb
34
+
35
+ - edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
36
+ - custom_actions = @model.available_actions.select{|act| act if act.route_type == 'member' && [:button, :modal].include?(act.display_type)}
37
+ - if custom_actions.any? || edit_action.any?
38
+ td.row-action-cell
39
+ .row-action-tool
40
+ button.secondary-btn.tool-btn type="button"
41
+ span
42
+ i.fa.fa-bars.bolder
43
+ span
44
+ i.fa.fa-angle-down
45
+ .popup-card.table-export-popup.hidden
46
+ - if edit_action.any?
47
+ = link_to "#{page_url('edit', ar_object)}" do
48
+ .popup-option Edit
49
+ - custom_actions.each do |custom_action|
50
+ - if custom_action.display_if.call(ar_object)
51
+ = link_to custom_action.path.gsub(':id', ar_object.id.to_s), method: custom_action.verb do
52
+ .popup-option = custom_action.name.titleize
49
53
 
50
54
  .cm-pagination
51
55
  .cm-pagination__lhs Showing #{@ar_object.pagy.from} to #{@ar_object.pagy.to} out of #{@ar_object.pagy.count}
@@ -20,9 +20,9 @@
20
20
  li
21
21
  .popup-option.pointer data-bs-toggle='modal' data-bs-target='#exportmodal'
22
22
  span Export
23
-
24
- a.primary-btn.ml-2 href="#{page_url('new')}"
25
- | Add
23
+ - new_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('new')}
24
+ - if new_action.any?
25
+ = link_to 'Add', "#{page_url('new')}", class: 'primary-btn ml-2'
26
26
  - @model.available_actions.select{|act| act if act.route_type == 'collection'}.each do |custom_action|
27
27
  - if custom_action.display_type == :button
28
28
  = link_to custom_action.name.titleize, @model.ar_model.table_name + '/' + custom_action.path, class: 'primary-btn ml-2', method: custom_action.verb
@@ -37,5 +37,4 @@
37
37
 
38
38
  - edit_action = @model.available_actions.select{|act| act if act.action_type.eql?(:default) && act.name.eql?('edit')}
39
39
  - if edit_action.any?
40
- a.primary-btn.ml-2 href="#{page_url('edit', @ar_object)}"
41
- = "Edit #{@model.name}"
40
+ = link_to "Edit #{@model.name}", "#{page_url('edit', @ar_object)}", class: 'primary-btn ml-2'
@@ -1,6 +1,6 @@
1
1
  .cm-index-page
2
2
  .index-page
3
- .index-page__table-container.pt-0
3
+ .index-page__table-container
4
4
  == render partial: 'cm_admin/main/associated_table'
5
5
 
6
6
  // = column_pop_up(@associated_model)
@@ -21,7 +21,8 @@ module CmAdmin
21
21
  include Models::Blocks
22
22
  include Models::DslMethod
23
23
  include Models::ControllerMethod
24
- attr_accessor :available_actions, :actions_set, :available_fields, :permitted_fields, :current_action, :params, :filters, :available_tabs
24
+ attr_accessor :available_actions, :actions_set, :available_fields, :permitted_fields,
25
+ :current_action, :params, :filters, :available_tabs, :icon_name
25
26
  attr_reader :name, :ar_model, :is_visible_on_sidebar
26
27
 
27
28
  # Class variable for storing all actions
@@ -32,6 +33,7 @@ module CmAdmin
32
33
  @name = entity.name
33
34
  @ar_model = entity
34
35
  @is_visible_on_sidebar = true
36
+ @icon_name = 'fa fa-th-large'
35
37
  @available_actions ||= []
36
38
  @current_action = nil
37
39
  @available_tabs ||= []
@@ -59,7 +61,7 @@ module CmAdmin
59
61
  current_action = CmAdmin::Models::Action.find_by(self, name: action_name.to_s)
60
62
  if current_action
61
63
  @current_action = current_action
62
- @ar_object = @ar_model.find(params[:id])
64
+ @ar_object = @ar_model.name.classify.constantize.find(params[:id])
63
65
  if @current_action.child_records
64
66
  child_records = @ar_object.send(@current_action.child_records)
65
67
  @associated_model = CmAdmin::Model.find_by(name: @ar_model.reflect_on_association(@current_action.child_records).klass.name)
@@ -90,6 +92,10 @@ module CmAdmin
90
92
  @is_visible_on_sidebar = visible_option
91
93
  end
92
94
 
95
+ def set_icon(name)
96
+ @icon_name = name
97
+ end
98
+
93
99
 
94
100
  private
95
101
 
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -43,7 +43,7 @@ module CmAdmin
43
43
  ar_object.send(field.field_name).to_s.titleize
44
44
  when :tag
45
45
  content_tag :span, class: "status-tag default-#{ar_object.send(field.field_name.to_s + '_before_type_cast')}" do
46
- ar_object.send(field.field_name).to_s.titleize
46
+ ar_object.send(field.field_name).to_s.upcase
47
47
  end
48
48
  when :attachment
49
49
  concat show_attachment_value(ar_object, field)
@@ -11,16 +11,16 @@ module CmAdmin
11
11
  content_tag(:a, href: path) do
12
12
  content_tag(:div, class: 'menu-item') do
13
13
  content_tag(:span, class: 'menu-icon') do
14
- concat tag.i class: 'fa fa-th-large'
14
+ concat tag.i class: "#{model.icon_name}"
15
15
  end +
16
- model.name
16
+ model.name.pluralize
17
17
  end
18
18
  end
19
19
  elsif navigation_type == "quick_links"
20
20
  content_tag(:a, href: path, class: 'visible') do
21
21
  content_tag(:div, class: 'result-item') do
22
22
  content_tag(:span) do
23
- concat tag.i class: 'fa fa-th-large'
23
+ concat tag.i class: "#{model.icon_name}"
24
24
  end +
25
25
  content_tag(:span) do
26
26
  model.name
@@ -1 +1 @@
1
- d5850cd60f91abe79ff8a84a45a9e24c75cb0e4b
1
+ 07d558738c316293586496817b2bccbf6430b5bd
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.5.6
4
+ version: 0.5.7
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-03-02 00:00:00.000000000 Z
13
+ date: 2022-03-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pagy
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  requirements: []
233
- rubygems_version: 3.0.3
233
+ rubygems_version: 3.2.32
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: This is an admin panel gem