five-two-nw-olivander 0.2.0.40 → 0.2.0.42
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/assets/javascripts/adminlte.js +13 -0
- data/app/assets/stylesheets/adminlte.css +14 -1
- data/app/controllers/concerns/olivander/resources/crud_controller.rb +11 -9
- data/app/views/layouts/olivander/adminlte/main.html.haml +3 -0
- data/lib/olivander/application_context.rb +33 -21
- 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: f4f6a5a132be75741c971c202ffb9e84e9dd0baa2b4d801a27d8bc062becc82a
|
4
|
+
data.tar.gz: f3fae3ffa8b17681bb9930aa3ae8b93686cbec70e2e78fc76963b8836a4b7286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8af9883db04b3f000e2b926ab7dff2d1f5e1f9934ad752d6818d6cd1324353364c6077e31acd45c991ffb461a7d754cbf927e18fba400ed3541ebd914e7f61f
|
7
|
+
data.tar.gz: 718f1125a137e63d61f182067918306ccf000c077aee2845e212c7401f94f225638a2f3df05527fbdc8c7d9540b498b9486c34151b8a440ea480151919587cf7
|
@@ -37,4 +37,17 @@ $(document).ready(function(e) {
|
|
37
37
|
})
|
38
38
|
label.appendChild(helpCircle)
|
39
39
|
})
|
40
|
+
|
41
|
+
$(window).scroll(function() {
|
42
|
+
if ($(this).scrollTop() > 100) {
|
43
|
+
$('#back-to-top').fadeIn();
|
44
|
+
} else {
|
45
|
+
$('#back-to-top').fadeOut();
|
46
|
+
}
|
47
|
+
});
|
48
|
+
|
49
|
+
$('#back-to-top').click(function(e) {
|
50
|
+
e.preventDefault();
|
51
|
+
$('html, body').animate({ scrollTop: 0 }, '500');
|
52
|
+
});
|
40
53
|
})
|
@@ -48,4 +48,17 @@ ul.no-bullets {
|
|
48
48
|
padding: 0; /* Remove padding */
|
49
49
|
margin: 0; /* Remove margins */
|
50
50
|
}
|
51
|
-
table.dataTable.table-striped > tbody > tr:nth-of-type(2n+1) { background: rgba(0, 0, 0, 0.05); }
|
51
|
+
table.dataTable.table-striped > tbody > tr:nth-of-type(2n+1) { background: rgba(0, 0, 0, 0.05); }
|
52
|
+
/* Back to Top Button */
|
53
|
+
#back-to-top {
|
54
|
+
position: fixed;
|
55
|
+
bottom: 20px;
|
56
|
+
right: 20px;
|
57
|
+
display: none;
|
58
|
+
z-index: 100000;
|
59
|
+
font-size: 18px;
|
60
|
+
padding: 10px 15px;
|
61
|
+
border-radius: 50%;
|
62
|
+
}
|
63
|
+
/* Hover effect */
|
64
|
+
#back-to-top:hover { background-color: #999; color: white; }
|
@@ -29,7 +29,7 @@ module Olivander
|
|
29
29
|
def index_param_search
|
30
30
|
params.each do |param|
|
31
31
|
effective_resource.klass.columns.each do |col|
|
32
|
-
next unless col.name == param[0]
|
32
|
+
next unless col.name == param[0] # && !param[1].blank?
|
33
33
|
|
34
34
|
self.resources = self.resources.where(param[0].to_sym => param[1])
|
35
35
|
end
|
@@ -42,10 +42,10 @@ module Olivander
|
|
42
42
|
else
|
43
43
|
k = resources.klass
|
44
44
|
self.resources = k.all
|
45
|
-
fields = %w[name title description text].keep_if{ |field| k.respond_to?(field) }
|
45
|
+
fields = %w[name title description text].keep_if { |field| k.respond_to?(field) }
|
46
46
|
unless params[:term].blank?
|
47
47
|
like_term = "%#{ActiveRecord::Base.sanitize_sql_like(params[:term])}%"
|
48
|
-
clauses = fields.map{ |field| "#{field} ilike '#{like_term}'" }.join(' or ')
|
48
|
+
clauses = fields.map { |field| "#{field} ilike '#{like_term}'" }.join(' or ')
|
49
49
|
end
|
50
50
|
orders = fields.join(', ')
|
51
51
|
self.resources = self.resources.where(clauses) if clauses.present? && clauses.length.positive?
|
@@ -64,7 +64,7 @@ module Olivander
|
|
64
64
|
run_callbacks(:resource_render)
|
65
65
|
|
66
66
|
respond_to do |format|
|
67
|
-
format.html {
|
67
|
+
format.html {}
|
68
68
|
format.js { render('show', formats: :js) }
|
69
69
|
format.json { render json: resource }
|
70
70
|
format.turbo_stream {}
|
@@ -76,7 +76,7 @@ module Olivander
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def respond_with_success(resource, action)
|
79
|
-
return if
|
79
|
+
return if response.body.respond_to?(:length) && response.body.length > 0
|
80
80
|
|
81
81
|
if specific_redirect_path?(action)
|
82
82
|
respond_to do |format|
|
@@ -93,7 +93,7 @@ module Olivander
|
|
93
93
|
else
|
94
94
|
render(
|
95
95
|
(template_present?(action) ? action : :member_action),
|
96
|
-
locals: { action: action, remote_form_redirect: resource_redirect_path(resource, action)}
|
96
|
+
locals: { action: action, remote_form_redirect: resource_redirect_path(resource, action) }
|
97
97
|
)
|
98
98
|
end
|
99
99
|
end
|
@@ -127,7 +127,9 @@ module Olivander
|
|
127
127
|
end
|
128
128
|
|
129
129
|
format.json { render json: resource }
|
130
|
-
format.turbo_stream
|
130
|
+
format.turbo_stream do
|
131
|
+
flash.now[:success] ||= resource_flash(:success, resource, action)
|
132
|
+
end
|
131
133
|
end
|
132
134
|
end
|
133
135
|
end
|
@@ -186,8 +188,8 @@ module Olivander
|
|
186
188
|
params.keys.each do |k|
|
187
189
|
if params[k].is_a? ActionController::Parameters
|
188
190
|
recurse_and_fix_date_params(params[k])
|
189
|
-
|
190
|
-
params[k] = rearrange_date_param(params[k])
|
191
|
+
elsif date_params.include?(k.to_sym)
|
192
|
+
params[k] = rearrange_date_param(params[k])
|
191
193
|
end
|
192
194
|
end
|
193
195
|
end
|
@@ -9,6 +9,9 @@
|
|
9
9
|
-# .preloader.flex-column.justify-content-center.align-items-center
|
10
10
|
-# %img.animation__shake{:alt => "FFES Logo", :height => "60", :src => image_path("logo.gif")}
|
11
11
|
= render partial: 'layouts/olivander/adminlte/navbar'
|
12
|
+
- if Olivander::CurrentContext.application_context.back_to_top?
|
13
|
+
%a.btn.btn-secondary.btn-lg#back-to-top{ href: '#' }
|
14
|
+
%i.fa.fa-arrow-up
|
12
15
|
- if Olivander::CurrentContext.application_context.sidebar?
|
13
16
|
= render partial: 'layouts/olivander/adminlte/sidebar'
|
14
17
|
-# = render partial: 'layouts/olivander/adminlte/content'
|
@@ -1,21 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Olivander
|
4
|
+
# DTO to represent the overall application context
|
2
5
|
class ApplicationContext
|
3
6
|
attr_accessor :name, :logo, :login_logo, :company, :menu_items,
|
4
7
|
:route_builder, :sign_out_path, :sidebar_background_class,
|
5
8
|
:nav_container, :nav_class, :layout_container, :layout_class,
|
6
|
-
:sidebar
|
7
|
-
|
8
|
-
DEFAULT_APPLICATION_NAME = 'Application Name'
|
9
|
-
DEFAULT_SIGN_OUT_PATH = '/users/sign_out'
|
10
|
-
DEFAULT_HEADER_CLASSES = ''
|
11
|
-
DEFAULT_LOGO_URL = '/images/olivander_logo.png'
|
12
|
-
DEFAULT_LOGO_ALT = 'Logo Image'
|
13
|
-
DEFAULT_LOGIN_LOGO_URL = '/images/olivander_login_logo.png'
|
14
|
-
DEFAULT_LOGIN_LOGO_ALT = 'Login Logo Image'
|
15
|
-
DEFAULT_COMPANY_URL = '/'
|
16
|
-
DEFAULT_COMPANY_ALT = 'Company Name'
|
17
|
-
DEFAULT_LAYOUT_CLASS = 'hold-transition sidebar-mini layout-fixed'
|
18
|
-
DEFAULT_NAV_CLASS = 'navbar-expand navbar-white navbar-light'
|
9
|
+
:sidebar, :back_to_top
|
10
|
+
|
11
|
+
DEFAULT_APPLICATION_NAME = 'Application Name'
|
12
|
+
DEFAULT_SIGN_OUT_PATH = '/users/sign_out'
|
13
|
+
DEFAULT_HEADER_CLASSES = ''
|
14
|
+
DEFAULT_LOGO_URL = '/images/olivander_logo.png'
|
15
|
+
DEFAULT_LOGO_ALT = 'Logo Image'
|
16
|
+
DEFAULT_LOGIN_LOGO_URL = '/images/olivander_login_logo.png'
|
17
|
+
DEFAULT_LOGIN_LOGO_ALT = 'Login Logo Image'
|
18
|
+
DEFAULT_COMPANY_URL = '/'
|
19
|
+
DEFAULT_COMPANY_ALT = 'Company Name'
|
20
|
+
DEFAULT_LAYOUT_CLASS = 'hold-transition sidebar-mini layout-fixed'
|
21
|
+
DEFAULT_NAV_CLASS = 'navbar-expand navbar-white navbar-light'
|
19
22
|
|
20
23
|
def initialize(**kwargs)
|
21
24
|
self.name = kwargs[:name] || ENV['OLIVANDER_APP_NAME'] || DEFAULT_APPLICATION_NAME
|
@@ -24,11 +27,12 @@ module Olivander
|
|
24
27
|
self.company = kwargs[:company] || Company.new(name: kwargs[:company_name], url: kwargs[:company_url])
|
25
28
|
self.sign_out_path = kwargs[:sign_out_path] || DEFAULT_SIGN_OUT_PATH
|
26
29
|
self.menu_items = kwargs[:menu_items] || []
|
27
|
-
self.nav_container = kwargs[:nav_container] || 'false'
|
30
|
+
self.nav_container = kwargs[:nav_container] || 'false' == 'true'
|
28
31
|
self.nav_class = kwargs[:nav_class] || DEFAULT_NAV_CLASS
|
29
|
-
self.layout_container = kwargs[:layout_container] || 'false'
|
32
|
+
self.layout_container = kwargs[:layout_container] || 'false' == 'true'
|
30
33
|
self.layout_class = kwargs[:layout_class] || DEFAULT_LAYOUT_CLASS
|
31
|
-
self.sidebar = kwargs[:sidebar] ||
|
34
|
+
self.sidebar = (kwargs[:sidebar] || true)
|
35
|
+
self.back_to_top = (kwargs[:back_to_top] || true)
|
32
36
|
begin
|
33
37
|
self.route_builder = RouteBuilder.new
|
34
38
|
rescue NameError
|
@@ -36,16 +40,20 @@ module Olivander
|
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
43
|
+
def back_to_top?
|
44
|
+
back_to_top.to_s == 'true'
|
45
|
+
end
|
46
|
+
|
39
47
|
def nav_container?
|
40
|
-
nav_container == true
|
48
|
+
nav_container.to_s == 'true'
|
41
49
|
end
|
42
50
|
|
43
51
|
def layout_container?
|
44
|
-
layout_container == true
|
52
|
+
layout_container.to_s == 'true'
|
45
53
|
end
|
46
54
|
|
47
55
|
def sidebar?
|
48
|
-
sidebar == true
|
56
|
+
sidebar.to_s == 'true'
|
49
57
|
end
|
50
58
|
|
51
59
|
def visible_modules
|
@@ -65,6 +73,7 @@ module Olivander
|
|
65
73
|
end
|
66
74
|
end
|
67
75
|
|
76
|
+
# DTO for the current application logo
|
68
77
|
class Logo
|
69
78
|
attr_accessor :url, :alt
|
70
79
|
|
@@ -74,6 +83,7 @@ module Olivander
|
|
74
83
|
end
|
75
84
|
end
|
76
85
|
|
86
|
+
# DTO for the current login logo
|
77
87
|
class LoginLogo
|
78
88
|
attr_accessor :url, :alt
|
79
89
|
|
@@ -83,6 +93,7 @@ module Olivander
|
|
83
93
|
end
|
84
94
|
end
|
85
95
|
|
96
|
+
# DTO for information about the Company for which this app is deployed
|
86
97
|
class Company
|
87
98
|
attr_accessor :name, :url
|
88
99
|
|
@@ -93,12 +104,13 @@ module Olivander
|
|
93
104
|
end
|
94
105
|
end
|
95
106
|
|
107
|
+
# DTO for state in the current thread of execution
|
96
108
|
class CurrentContext < ActiveSupport::CurrentAttributes
|
97
109
|
attribute :application_context
|
98
110
|
attribute :user, :ability
|
99
|
-
DEFAULT_USER_DISPLAY
|
111
|
+
DEFAULT_USER_DISPLAY = 'No User Set'
|
100
112
|
|
101
|
-
def build
|
113
|
+
def build
|
102
114
|
self.application_context ||= ::Olivander::ApplicationContext.new
|
103
115
|
self.user ||= build_dummy_user
|
104
116
|
self.ability ||= build_dummy_ability
|
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.2.0.
|
4
|
+
version: 0.2.0.42
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|