five-two-nw-olivander 0.1.2.25 → 0.1.2.26

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: c84745db767e205f4aec15220fedbd5dd8d4dc3dc973e4a24624e51c59301443
4
- data.tar.gz: 635805ef6e29cc864c36afc572811a452205aa947dbcce7bbac914cbb3740ecb
3
+ metadata.gz: 1d96cd91f2f4830a4cfe85a04cfac5bc30eb3460a0305bca7efb350f35c4e581
4
+ data.tar.gz: 23d8592c86e3ba64edc0a666b05bbcda1847365b1d4a23233cf0d7134995c225
5
5
  SHA512:
6
- metadata.gz: a4f3cd18eccd926ef5fbc6e555ffa3450713f1c91647accfe6625d51df3ec2ccf0c11588c6d68f2a441d89087af319604916d5f9cc1368d45c7362f219541522
7
- data.tar.gz: 9d9c6ccc4a03f07d14c98f9f20ba3fcc9c5f56cc782f9c7ffd2632bedcf38773cd9a1c981614e184dbefb4d1baea4155f5159827b4789e5bdad54ed3692e9ddf
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
- attributes = klazz.new.attributes.collect{ |x| x[0] }
22
- attributes &&= only if only.size.positive?
23
- attributes -= except if except.size.positive?
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
- attributes.each do |key|
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
@@ -1,5 +1,5 @@
1
1
  <h2>Log in</h2>
2
- ;lkjasd;lkjasdf
2
+
3
3
  <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
4
  <div class="form-inputs">
5
5
  <%= f.input :email,
@@ -1,6 +1,6 @@
1
1
  %head
2
2
  %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
3
- %title= page_title
3
+ %title= header_page_title
4
4
  %meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
5
5
  = favicon_link
6
6
  = csrf_meta_tags
@@ -0,0 +1,4 @@
1
+ - flash.to_hash.slice("alert", "error", "notice", "success").each do |key, value|
2
+ .span.alert{ class: "alert-#{flash_class(key)}" }
3
+ %i.icon{ class: flash_icon(key) }
4
+ = value
@@ -1,3 +1,3 @@
1
1
  module Olivander
2
- VERSION = '0.1.2.25'.freeze
2
+ VERSION = '0.1.2.26'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.25
4
+ version: 0.1.2.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dennis