five-two-nw-olivander 0.1.2.25 → 0.1.2.26
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 +4 -4
- data/app/datatables/olivander/datatable.rb +12 -5
- data/app/helpers/olivander/application_helper.rb +32 -0
- 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 +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d96cd91f2f4830a4cfe85a04cfac5bc30eb3460a0305bca7efb350f35c4e581
|
|
4
|
+
data.tar.gz: 23d8592c86e3ba64edc0a666b05bbcda1847365b1d4a23233cf0d7134995c225
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2806dca34a1cbccd23d2f9efbae8bf18365ab492fa714b9bb6b3f0451a5752a5e1a59be0f39e2b4cf3b1ad70bfafc9bf373c6a6cab2fef9cadb229b832f5e9e0
|
|
7
|
+
data.tar.gz: 69338f7e7fd4dcf122316bf5de2c3d7e7ced36b3a47d2797bbfa6f89a20130a886a3069a570129560559678f636a8af777a2298473b6b2f5ae7971e05cb7daa8
|
|
@@ -18,20 +18,27 @@ 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
43
|
sym = key.gsub('_id', '').to_sym
|
|
37
44
|
visible = show.include?(key) || !(default_hidden.include?(key) || hide.include?(key))
|
|
@@ -109,9 +109,41 @@ module Olivander
|
|
|
109
109
|
(is_dev_environment? ? 'bg-danger' : 'bg-info')
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
+
def header_page_title
|
|
113
|
+
[is_dev_environment? ? sidebar_context_suffix.upcase : nil, page_title].reject(&:blank?).join(' ')
|
|
114
|
+
end
|
|
115
|
+
|
|
112
116
|
def favicon_link
|
|
113
117
|
favicon_path = is_dev_environment? ? '/images/favicon-dev.png' : '/images/favicon.ico'
|
|
114
118
|
favicon_link_tag(image_path(favicon_path))
|
|
115
119
|
end
|
|
120
|
+
|
|
121
|
+
def flash_class key
|
|
122
|
+
case key
|
|
123
|
+
when "error"
|
|
124
|
+
"danger"
|
|
125
|
+
when "notice"
|
|
126
|
+
"info"
|
|
127
|
+
when "alert"
|
|
128
|
+
"danger"
|
|
129
|
+
else
|
|
130
|
+
key
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def flash_icon key
|
|
135
|
+
case key
|
|
136
|
+
when "error"
|
|
137
|
+
"fas fa-exclamation-circle"
|
|
138
|
+
when "notice"
|
|
139
|
+
"fas fa-info-circle"
|
|
140
|
+
when "alert"
|
|
141
|
+
"fas fa-info-circle"
|
|
142
|
+
when "success"
|
|
143
|
+
"fas fa-check-circle"
|
|
144
|
+
else
|
|
145
|
+
"fas fa-question-circle"
|
|
146
|
+
end
|
|
147
|
+
end
|
|
116
148
|
end
|
|
117
149
|
end
|
data/lib/olivander/version.rb
CHANGED