five-two-nw-olivander 0.2.0.22 → 0.2.0.23

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: cb603dd2511a6392d67387838934cd9b8ea6c07b6d3317d29a8582f54499a741
4
- data.tar.gz: f41f025d643dd0d6c7b66644f42e0863a07aab6d34a2660ab8ff7fbcd4eeeb08
3
+ metadata.gz: 7d0296c18b05b98a8346e7c04c1dbfc31b449ad9bd3328103f3fedbb0be36e29
4
+ data.tar.gz: c54615ded2e32f20658347245f453922abd816812867a74861f929387380a5eb
5
5
  SHA512:
6
- metadata.gz: ea2a63a0f6db1f587ff20d2f02f33b6f9136cafcb71a3e49d3d40bf67a8317c5d81b3bf2155e440c286807978abb5e4ddde0ac12f2d60cdf4c51effcef6f2925
7
- data.tar.gz: a2be3205634e6e3921c9cbc610e3f85d1f12744713d6972d1deac3907bcaa8ba18389829000f3af63f945110b8a1251c5009290436aa325d0f919b1df64c84a8
6
+ metadata.gz: b83fa3327c1e436a3e7266694604ae415df5e63afaa87ebd32d33e86f3366858b9c848b2952e15d457c109cc3d6099c8f769d71e261b66fa2b54c65752ff8c54
7
+ data.tar.gz: 4f9f587b5eefd520da0d09672fea7244079f1042880cc8169c810d1af4177ed2a590ee9c07c141b7a265dec313feb763f45cc8a41aa5b8317c325041be2a57ed
@@ -61,6 +61,7 @@ module Olivander
61
61
  end
62
62
 
63
63
  datatable do
64
+ puts "firing datatable do block"
64
65
  order(order_by[0], order_by[1]) if order_by.size == 2
65
66
  # bulk_actions_col if datatable._bulk_actions.size.positive?
66
67
 
@@ -69,7 +70,10 @@ module Olivander
69
70
  label = field_label_for(klazz, key)
70
71
  sym = key.gsub('_id', '')
71
72
  visible = show.include?(key) || !(default_hidden.include?(key) || hide.include?(key))
72
- if %w[id name first_name last_name display_name title].include?(sym)
73
+ already_implemented_method = "col_for_#{sym}"
74
+ if datatable.respond_to?(already_implemented_method)
75
+ datatable.send(already_implemented_method, visible: visible)
76
+ elsif %w[id name first_name last_name display_name title].include?(sym)
73
77
  col sym, visible: visible, action: :show
74
78
  elsif sym.include?('.')
75
79
  col sym, visible: visible, label: label
@@ -1,4 +1,6 @@
1
1
  .content-wrapper
2
+ - if Olivander::CurrentContext.application_context.layout_container?
3
+ <div class='container'>
2
4
  %section.content-header
3
5
  .container-fluid
4
6
  .row.mb-2
@@ -10,3 +12,6 @@
10
12
  %section.content
11
13
  .container-fluid
12
14
  = content
15
+ - if Olivander::CurrentContext.application_context.layout_container?
16
+ </div>
17
+
@@ -1,10 +1,13 @@
1
+ - if Olivander::CurrentContext.application_context.nav_container?
2
+ <div class='container'>
1
3
  / Navbar
2
- %nav.main-header.navbar.navbar-expand.navbar-white.navbar-light
4
+ %nav.main-header.navbar{ class: Olivander::CurrentContext.application_context.nav_class }
3
5
  / Left navbar links
4
6
  %ul.navbar-nav
5
- %li.nav-item
6
- %a.nav-link{"data-widget" => "pushmenu", :href => "#", :role => "button", 'data-enable-remember': "true"}
7
- %i.fas.fa-bars
7
+ - if Olivander::CurrentContext.application_context.sidebar?
8
+ %li.nav-item
9
+ %a.nav-link{"data-widget" => "pushmenu", :href => "#", :role => "button", 'data-enable-remember': "true"}
10
+ %i.fas.fa-bars
8
11
  - Olivander::CurrentContext.application_context.visible_modules.each do |menu_item|
9
12
  %li.nav-item.d-none.d-sm-inline-block
10
13
  = link_to menu_item.text, menu_item.href, class: 'nav-link'
@@ -124,3 +127,5 @@
124
127
  -# %li.nav-item
125
128
  -# %a.nav-link{title: 'Show Sidebar Options', "data-controlsidebar-slide" => "true", "data-widget" => "control-sidebar", :href => "#", :role => "button"}
126
129
  -# %i.fas.fa-th-large
130
+ - if Olivander::CurrentContext.application_context.nav_container?
131
+ </div>
@@ -2,13 +2,15 @@
2
2
  %html
3
3
  = render partial: 'layouts/olivander/adminlte/head'
4
4
  - sidebar_collapse = cookies['lte.pushmenu.collapsed'] == 'true' ? 'sidebar-collapse' : ''
5
- %body.hold-transition.sidebar-mini.layout-fixed{ class: sidebar_collapse }
5
+ - layout_class = Olivander::CurrentContext.application_context.layout_class
6
+ %body{ class: [layout_class, sidebar_collapse].join(' ') }
6
7
  .wrapper
7
8
  / Preloader
8
9
  -# .preloader.flex-column.justify-content-center.align-items-center
9
10
  -# %img.animation__shake{:alt => "FFES Logo", :height => "60", :src => image_path("logo.gif")}
10
11
  = render partial: 'layouts/olivander/adminlte/navbar'
11
- = render partial: 'layouts/olivander/adminlte/sidebar'
12
+ - if Olivander::CurrentContext.application_context.sidebar?
13
+ = render partial: 'layouts/olivander/adminlte/sidebar'
12
14
  -# = render partial: 'layouts/olivander/adminlte/content'
13
15
  = render partial: @content_partial || 'layouts/olivander/adminlte/content', locals: { content: yield }
14
16
  = turbo_frame_tag 'modal'
@@ -1,14 +1,34 @@
1
1
  module Olivander
2
2
  class ApplicationContext
3
- attr_accessor :name, :logo, :login_logo, :company, :menu_items, :route_builder, :sign_out_path, :sidebar_background_class
3
+ attr_accessor :name, :logo, :login_logo, :company, :menu_items,
4
+ :route_builder, :sign_out_path, :sidebar_background_class,
5
+ :nav_container, :nav_class, :layout_container, :layout_class,
6
+ :sidebar
7
+
8
+ DEFAULT_APPLICATION_NAME = 'Application Name'.freeze
9
+ DEFAULT_SIGN_OUT_PATH = '/users/sign_out'.freeze
10
+ DEFAULT_HEADER_CLASSES = ''.freeze
11
+ DEFAULT_LOGO_URL = '/images/olivander_logo.png'.freeze
12
+ DEFAULT_LOGO_ALT = 'Logo Image'.freeze
13
+ DEFAULT_LOGIN_LOGO_URL = '/images/olivander_login_logo.png'.freeze
14
+ DEFAULT_LOGIN_LOGO_ALT = 'Login Logo Image'.freeze
15
+ DEFAULT_COMPANY_URL = '/'.freeze
16
+ DEFAULT_COMPANY_ALT = 'Company Name'.freeze
17
+ DEFAULT_LAYOUT_CLASS = 'hold-transition sidebar-mini layout-fixed'.freeze
18
+ DEFAULT_NAV_CLASS = 'navbar-expand navbar-white navbar-light'.freeze
4
19
 
5
20
  def initialize(**kwargs)
6
- self.name = kwargs[:name] || ENV['OLIVANDER_APP_NAME'] || 'Application Name'
21
+ self.name = kwargs[:name] || ENV['OLIVANDER_APP_NAME'] || DEFAULT_APPLICATION_NAME
7
22
  self.logo = kwargs[:logo] || Logo.new(url: kwargs[:logo_url], alt: kwargs[:logo_alt])
8
23
  self.login_logo = kwargs[:login_logo] || LoginLogo.new(url: kwargs[:login_logo_url], alt: kwargs[:login_logo_alt])
9
24
  self.company = kwargs[:company] || Company.new(name: kwargs[:company_name], url: kwargs[:company_url])
10
- self.sign_out_path = kwargs[:sign_out_path] || '/sign_out'
25
+ self.sign_out_path = kwargs[:sign_out_path] || DEFAULT_SIGN_OUT_PATH
11
26
  self.menu_items = kwargs[:menu_items] || []
27
+ self.nav_container = kwargs[:nav_container] || 'false'.freeze == 'true'.freeze
28
+ self.nav_class = kwargs[:nav_class] || DEFAULT_NAV_CLASS
29
+ self.layout_container = kwargs[:layout_container] || 'false'.freeze == 'true'.freeze
30
+ self.layout_class = kwargs[:layout_class] || DEFAULT_LAYOUT_CLASS
31
+ self.sidebar = kwargs[:sidebar] || 'true' == 'true'.freeze
12
32
  begin
13
33
  self.route_builder = RouteBuilder.new
14
34
  rescue NameError
@@ -16,6 +36,18 @@ module Olivander
16
36
  end
17
37
  end
18
38
 
39
+ def nav_container?
40
+ nav_container == true
41
+ end
42
+
43
+ def layout_container?
44
+ layout_container == true
45
+ end
46
+
47
+ def sidebar?
48
+ sidebar == true
49
+ end
50
+
19
51
  def visible_modules
20
52
  [].tap do |arr|
21
53
  menu_items.each do |menu_item|
@@ -37,8 +69,8 @@ module Olivander
37
69
  attr_accessor :url, :alt
38
70
 
39
71
  def initialize(**kwargs)
40
- self.url = kwargs[:url] || ENV['OLIVANDER_LOGO_URL'] || '/images/olivander_logo.png'
41
- self.alt = kwargs[:alt] || ENV['OLIVANDER_LOGO_ALT'] || 'Logo Image'
72
+ self.url = kwargs[:url] || ENV['OLIVANDER_LOGO_URL'] || DEFAULT_LOGO_URL
73
+ self.alt = kwargs[:alt] || ENV['OLIVANDER_LOGO_ALT'] || DEFAULT_LOGO_ALT
42
74
  end
43
75
  end
44
76
 
@@ -46,8 +78,8 @@ module Olivander
46
78
  attr_accessor :url, :alt
47
79
 
48
80
  def initialize(**kwargs)
49
- self.url = kwargs[:url] || ENV['OLIVANDER_LOGIN_LOGO_URL'] || '/images/olivander_login_logo.png'
50
- self.alt = kwargs[:alt] || ENV['OLIVANDER_LOGIN_LOGO_ALT'] || 'Login Logo Image'
81
+ self.url = kwargs[:url] || ENV['OLIVANDER_LOGIN_LOGO_URL'] || DEFAULT_LOGIN_LOGO_URL
82
+ self.alt = kwargs[:alt] || ENV['OLIVANDER_LOGIN_LOGO_ALT'] || DEFAULT_LOGIN_LOGO_ALT
51
83
  end
52
84
  end
53
85
 
@@ -55,8 +87,8 @@ module Olivander
55
87
  attr_accessor :name, :url
56
88
 
57
89
  def initialize(**kwargs)
58
- self.url = kwargs[:url] || ENV['OLIVANDER_COMPANY_URL'] || '/'
59
- self.name = kwargs[:name] || ENV['OLIVANDER_COMPANY_NAME'] || 'Company Name'
90
+ self.url = kwargs[:url] || ENV['OLIVANDER_COMPANY_URL'] || DEFAULT_COMPANY_URL
91
+ self.name = kwargs[:name] || ENV['OLIVANDER_COMPANY_NAME'] || DEFAULT_COMPANY_ALT
60
92
  end
61
93
  end
62
94
  end
@@ -64,6 +96,7 @@ module Olivander
64
96
  class CurrentContext < ActiveSupport::CurrentAttributes
65
97
  attribute :application_context
66
98
  attribute :user, :ability
99
+ DEFAULT_USER_DISPLAY = 'No User Set'.freeze
67
100
 
68
101
  def build(&block)
69
102
  self.application_context ||= ::Olivander::ApplicationContext.new
@@ -76,7 +109,7 @@ module Olivander
76
109
  private
77
110
 
78
111
  def build_dummy_user
79
- OpenStruct.new({ display_name: 'No User Set' })
112
+ OpenStruct.new({ display_name: DEFAULT_USER_DISPLAY })
80
113
  end
81
114
 
82
115
  def build_dummy_ability
@@ -1,3 +1,3 @@
1
1
  module Olivander
2
- VERSION = '0.2.0.22'.freeze
2
+ VERSION = '0.2.0.23'.freeze
3
3
  end
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.2.0.22
4
+ version: 0.2.0.23
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-06-06 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick