five-two-nw-olivander 0.1.2.25 → 0.1.2.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/olivander/datatable.rb +15 -6
- data/app/helpers/olivander/application_helper.rb +34 -1
- data/app/views/devise/sessions/new.html.erb +1 -1
- data/app/views/layouts/olivander/adminlte/_head.html.haml +1 -1
- data/app/views/layouts/olivander/adminlte/_login_flashes.html.haml +4 -0
- 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: 575201e4ba97a06d33425fffb69b3550f2c3fddc58e1ccb030a827914cbd65f0
|
4
|
+
data.tar.gz: e1570ff90c9a44764ea6c8e5d8b269d6482377c47010c36475eeabbbfcb5e1e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97a5958aab8927d392183d9aea8b193491bf346af4a65fadc9faa96a4f57a54478e7a7247060ca0ec84a25fe7b09dd0c063001f5ae8dc50f59bdb03e86b1475a
|
7
|
+
data.tar.gz: 3c237985f2aee2131498cbf501734aa9d517f7827eee5d23fb0549452c0d96aadd2913f66269e937a0ae9b5280654c39d3bd179f203b7f42ea7af49584481b7d
|
@@ -18,27 +18,36 @@ module Olivander
|
|
18
18
|
def self.auto_datatable(klazz, collection: nil, link_path: nil, only: [], except: [], hide: [], show: [], order_by: [])
|
19
19
|
Rails.logger.debug "initializing datatable for #{klazz}"
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
klazz_attributes = klazz.new.attributes.collect{ |x| x[0] }
|
22
|
+
column_attributes = klazz_attributes
|
23
|
+
column_attributes &&= only if only.size.positive?
|
24
|
+
column_attributes -= except if except.size.positive?
|
24
25
|
|
25
26
|
default_hidden = %w[id created updated created_at updated_at deleted_at current_user current_action]
|
26
27
|
|
27
28
|
collection do
|
28
|
-
collection.nil? ? klazz.all : collection
|
29
|
+
dc = collection.nil? ? klazz.all : collection
|
30
|
+
|
31
|
+
attributes.each do |att|
|
32
|
+
dc = dc.where("#{att[0]} = ?", att[1]) if klazz_attributes.include?(att[0].to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
dc
|
29
36
|
end
|
30
37
|
|
31
38
|
datatable do
|
32
39
|
order(order_by[0], order_by[1]) if order_by.size == 2
|
33
40
|
bulk_actions_col
|
34
|
-
|
41
|
+
column_attributes.each do |key|
|
35
42
|
label = field_label_for(klazz, key)
|
36
|
-
sym = key.gsub('_id', '')
|
43
|
+
sym = key.gsub('_id', '') #.to_sym
|
37
44
|
visible = show.include?(key) || !(default_hidden.include?(key) || hide.include?(key))
|
38
45
|
if link_path.present? && sym == :id
|
39
46
|
link_col sym, link_path, :id, visible: visible
|
40
47
|
elsif link_path.present? && sym == :name
|
41
48
|
link_col sym, link_path, :id, visible: visible
|
49
|
+
elsif sym.include?('.')
|
50
|
+
col sym, visible: visible, label: label
|
42
51
|
else
|
43
52
|
col sym, visible: visible, label: label
|
44
53
|
end
|
@@ -79,7 +79,8 @@ module Olivander
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def field_label_for(resource_class, sym)
|
82
|
-
|
82
|
+
sym_s = sym.to_s.gsub('.', '_')
|
83
|
+
i18n_key = "activerecord.attributes.#{resource_class.name.underscore}.#{sym_s}"
|
83
84
|
return I18n.t(i18n_key) if I18n.exists?(i18n_key)
|
84
85
|
|
85
86
|
sym.to_s.titleize
|
@@ -109,9 +110,41 @@ module Olivander
|
|
109
110
|
(is_dev_environment? ? 'bg-danger' : 'bg-info')
|
110
111
|
end
|
111
112
|
|
113
|
+
def header_page_title
|
114
|
+
[is_dev_environment? ? sidebar_context_suffix.upcase : nil, page_title].reject(&:blank?).join(' ')
|
115
|
+
end
|
116
|
+
|
112
117
|
def favicon_link
|
113
118
|
favicon_path = is_dev_environment? ? '/images/favicon-dev.png' : '/images/favicon.ico'
|
114
119
|
favicon_link_tag(image_path(favicon_path))
|
115
120
|
end
|
121
|
+
|
122
|
+
def flash_class key
|
123
|
+
case key
|
124
|
+
when "error"
|
125
|
+
"danger"
|
126
|
+
when "notice"
|
127
|
+
"info"
|
128
|
+
when "alert"
|
129
|
+
"danger"
|
130
|
+
else
|
131
|
+
key
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def flash_icon key
|
136
|
+
case key
|
137
|
+
when "error"
|
138
|
+
"fas fa-exclamation-circle"
|
139
|
+
when "notice"
|
140
|
+
"fas fa-info-circle"
|
141
|
+
when "alert"
|
142
|
+
"fas fa-info-circle"
|
143
|
+
when "success"
|
144
|
+
"fas fa-check-circle"
|
145
|
+
else
|
146
|
+
"fas fa-question-circle"
|
147
|
+
end
|
148
|
+
end
|
116
149
|
end
|
117
150
|
end
|
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.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|