five-two-nw-olivander 0.1.2.45 → 0.1.2.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/olivander/components/resource_show_component.html.haml +9 -2
- data/app/controllers/concerns/olivander/resources/auto_form_attributes.rb +9 -2
- data/app/datatables/olivander/datatable.rb +1 -1
- data/app/helpers/olivander/application_helper.rb +8 -0
- data/app/models/olivander/application_record.rb +16 -0
- data/app/views/application/_resource_form_actions.html.haml +15 -14
- data/app/views/application/index.html.haml +1 -1
- data/app/views/effective/resource/_actions_dropleft.html.haml +18 -5
- data/app/views/layouts/olivander/adminlte/_navbar.html.haml +2 -2
- data/lib/olivander/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a38a3998950369b24606d91effaa34d2b306b9a16fcf8ef9f8ff3f91c11039a1
|
4
|
+
data.tar.gz: c5d1f30f64cd53b333e4c42c34307cc16880e42b1a836857ad7c7589ad7f6588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cdebfcdf720aeb564ae713293a4ec5fd4e31efe5fb6dbb743499ef9d2bedd08d309cbdcdea0a765c960ea042495885e7465d0194dc13a0631dc5fad34c5e1a8
|
7
|
+
data.tar.gz: f1fb914c35ddc747c5b85c41fa2f5f5c14d9dfba07a87abfc07993dee9424f285663197c804f461247afece637602f934be4838703ef006244f6ba8025c8243e
|
@@ -16,8 +16,8 @@
|
|
16
16
|
%td{ colspan: colspan }
|
17
17
|
- val = @resource.send(f.sym)
|
18
18
|
- case f.type
|
19
|
-
- when :string
|
20
|
-
= val
|
19
|
+
- when :string, :text
|
20
|
+
= simple_format(val)
|
21
21
|
- when :boolean
|
22
22
|
- icon_class = val ? 'fa-check text-success' : 'fa-times text-danger'
|
23
23
|
%i.fa{ class: icon_class }
|
@@ -29,7 +29,14 @@
|
|
29
29
|
%li= link_to val1
|
30
30
|
- else
|
31
31
|
= link_to val if val.present?
|
32
|
+
- when :file
|
33
|
+
- if val.present?
|
34
|
+
- if val.content_type.include?('image')
|
35
|
+
%img{ src: val.expiring_url }
|
36
|
+
- else
|
37
|
+
= link_to val, val.expiring_url
|
32
38
|
- else
|
39
|
+
= f.type
|
33
40
|
= val
|
34
41
|
- (section.columns-slice.size).times do
|
35
42
|
%th
|
@@ -49,16 +49,23 @@ module Olivander
|
|
49
49
|
sym = att.name.to_sym
|
50
50
|
type = att.type
|
51
51
|
next unless inc == sym
|
52
|
+
|
52
53
|
resource_field sym, type
|
53
54
|
end
|
54
55
|
|
55
56
|
reflections.map{ |x| x[1] }
|
56
|
-
|
57
|
-
|
57
|
+
.filter{ |x| x.foreign_key == inc || x.name == inc }
|
58
|
+
.each do |r|
|
58
59
|
sym = r.name
|
59
60
|
type = :association
|
60
61
|
resource_field sym, type
|
61
62
|
end
|
63
|
+
|
64
|
+
next unless respond_to?(:attachment_definitions)
|
65
|
+
|
66
|
+
attachment_definitions.filter{ |x| puts x; puts inc; x == inc }.each do |ad|
|
67
|
+
resource_field ad[0], :file
|
68
|
+
end
|
62
69
|
end
|
63
70
|
end
|
64
71
|
end
|
@@ -49,7 +49,7 @@ module Olivander
|
|
49
49
|
if ma.confirm
|
50
50
|
bulk_action ma.sym, url_for(controller: ma.controller, action: "confirm_#{ma.action}")
|
51
51
|
else
|
52
|
-
bulk_action ma.sym,
|
52
|
+
bulk_action ma.sym, send(ma.path_helper), data: { turbo_frame: ma.turbo_frame }
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -54,6 +54,14 @@ module Olivander
|
|
54
54
|
action.to_s.titleize
|
55
55
|
end
|
56
56
|
|
57
|
+
def resource_form_action_icon(resource, action)
|
58
|
+
key = resource.class.name.underscore
|
59
|
+
return I18n.t("activerecord.actions.#{key}.#{action}-icon") if I18n.exists?("activerecord.actions.#{key}.#{action}-icon")
|
60
|
+
return I18n.t("activerecord.actions.#{action}-icon") if I18n.exists?("activerecord.actions.#{action}-icon")
|
61
|
+
|
62
|
+
action.to_s.titleize
|
63
|
+
end
|
64
|
+
|
57
65
|
def resource_field_group_label(resource_class, key)
|
58
66
|
i18n_key = "activerecord.attributes.#{resource_class.name.underscore}.resource_field_groups.#{key}"
|
59
67
|
I18n.exists?(i18n_key) ? I18n.t(i18n_key) : key.to_s.titleize
|
@@ -1,5 +1,21 @@
|
|
1
1
|
module Olivander
|
2
2
|
class ApplicationRecord < ActiveRecord::Base
|
3
3
|
self.abstract_class = true
|
4
|
+
|
5
|
+
def self.audited_as klazz
|
6
|
+
Rails.logger.debug "#{self.class.name} is audited as #{klazz.name}"
|
7
|
+
|
8
|
+
@@audited_user_class = klazz
|
9
|
+
|
10
|
+
belongs_to :created_by, class_name: klazz.name
|
11
|
+
belongs_to :updated_by, class_name: klazz.name
|
12
|
+
|
13
|
+
before_validation :set_audit_user
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_audit_user
|
17
|
+
self.created_by ||= @@audited_user_class.current
|
18
|
+
self.updated_by = @@audited_user_class.current
|
19
|
+
end
|
4
20
|
end
|
5
21
|
end
|
@@ -1,15 +1,16 @@
|
|
1
|
-
- actions.
|
2
|
-
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
- actions.group_by(&:crud_action).reverse_each.with_index do |g, gidx|
|
2
|
+
- g[1].each_with_index do |a, idx|
|
3
|
+
- cf_sym = "link_inner#{gidx}-#{idx}".to_sym
|
4
|
+
= content_for cf_sym do
|
5
|
+
- icon_key = "activerecord.actions.icons.#{a.sym}"
|
6
|
+
- if I18n.exists?(icon_key)
|
7
|
+
%i.fa{ class: I18n.t(icon_key)}
|
8
|
+
= resource_form_action_label(@resource, a.sym)
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
- if a.turbo_frame.blank?
|
11
|
+
= link_to({ controller: a.controller, action: a.action }, method: a.verb, class: 'btn btn-tool') do
|
12
|
+
= yield cf_sym
|
13
|
+
- else
|
14
|
+
= link_to({ controller: a.controller, action: a.action }, class: 'btn btn-tool', data: { turbo: true, turbo_method: a.verb, turbo_frame: a.turbo_frame }) do
|
15
|
+
= yield cf_sym
|
16
|
+
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
- if @datatable
|
6
6
|
- content_for :datatable do
|
7
|
-
= render_datatable(@datatable, charts: false)
|
7
|
+
= render_datatable(@datatable, charts: false, input_js: { "stripeClasses": [] })
|
8
8
|
- content_for :datatable_charts do
|
9
9
|
- keys = @datatable._charts.keys
|
10
10
|
- ks = keys.size
|
@@ -4,10 +4,23 @@
|
|
4
4
|
-# - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id)
|
5
5
|
-# - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
|
6
6
|
-# = dropdown_link_to resource_form_action_label(resource, a.sym), path, data: data
|
7
|
-
.
|
8
|
-
|
7
|
+
- actions = authorized_resource_actions(route_builder, resource, for_action: action_name).select{ |x| x.show_in_datatable }
|
8
|
+
- crud_actions = actions.select{ |a| a.crud_action }
|
9
|
+
- non_crud_actions = actions.select{ |a| !a.crud_action }
|
10
|
+
.btn-group
|
11
|
+
- if non_crud_actions.size.positive?
|
12
|
+
.btn-group
|
13
|
+
%button.btn.btn-sm.dropdown-toggle{ type: :button, data: { toggle: 'dropdown' }}
|
14
|
+
%ul.dropdown-menu
|
15
|
+
- non_crud_actions.each do |a|
|
16
|
+
- path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id)
|
17
|
+
- data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
|
18
|
+
%li
|
19
|
+
= dropdown_link_to resource_form_action_label(resource, a.sym), path, data: data, method: a.verb
|
20
|
+
- crud_actions.each do |a|
|
9
21
|
- path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id)
|
10
22
|
- data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
|
11
|
-
=
|
12
|
-
|
13
|
-
%i
|
23
|
+
- icon_class = (a.verb == :delete ? '' : '')
|
24
|
+
= link_to path, data: data, method: a.verb, title: resource_form_action_label(resource, a.sym), class: "btn btn-sm #{icon_class}" do
|
25
|
+
%i{ class: resource_form_action_icon(resource, a.sym), style: 'display: block; font-size: 10px' }
|
26
|
+
%span{ style: 'font-size: 12px' }= resource_form_action_label(resource, a.sym)
|
@@ -101,13 +101,13 @@
|
|
101
101
|
-# %a.dropdown-item.dropdown-footer{:href => "#"} See All Notifications
|
102
102
|
%li.nav-item.dropdown.user-menu
|
103
103
|
%a.nav-link.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
|
104
|
-
%img.user-image.img-circle.elevation-2{:alt => "User Image", :src => image_path(user_image_path(
|
104
|
+
%img.user-image.img-circle.elevation-2{:alt => "User Image", :src => image_path(user_image_path(current_user))}/
|
105
105
|
|
106
106
|
%span.d-none.d-md-inline= current_user.display_name
|
107
107
|
%ul.dropdown-menu.dropdown-menu-lg.dropdown-menu-right
|
108
108
|
/ User image
|
109
109
|
%li.user-header.bg-primary
|
110
|
-
%img.img-circle.elevation-2{:alt => "User Image", src: image_path(user_image_path(
|
110
|
+
%img.img-circle.elevation-2{:alt => "User Image", src: image_path(user_image_path(current_user))}/
|
111
111
|
%p= current_user.display_name
|
112
112
|
/ Menu Footer
|
113
113
|
%li.user-footer
|
data/lib/olivander/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: five-two-nw-olivander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.2.
|
4
|
+
version: 0.1.2.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|