ama_layout 9.5.3 → 10.0.1
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 +5 -5
- data/.ruby-version +1 -0
- data/.travis.yml +1 -1
- data/ama_layout.gemspec +33 -18
- data/app/views/ama_layout/_manage_credit_card_link.html.erb +3 -0
- data/app/views/ama_layout/_top_nav.html.erb +12 -4
- data/config.ru +9 -0
- data/lib/ama_layout/decorators/agent/navigation_decorator.rb +9 -6
- data/lib/ama_layout/decorators/navigation_decorator.rb +41 -26
- data/lib/ama_layout/navigation.rb +16 -9
- data/lib/ama_layout/version.rb +3 -1
- data/spec/ama_layout/decorators/navigation_decorator_spec.rb +114 -60
- data/spec/factories/agent_navigation.rb +3 -1
- data/spec/factories/navigation.rb +3 -1
- data/spec/factories/navigation_item.rb +6 -4
- data/spec/factories/users.rb +20 -13
- data/spec/internal/app/assets/config/manifest.js +0 -0
- data/spec/internal/db/schema.rb +4 -1
- metadata +46 -51
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a5cc2556c75c0b6a580dedc33539dcf01534af0cb208b4a75d54d6348e815192
|
|
4
|
+
data.tar.gz: 02b4d128b39f8fb3707ee56e23137a89efea094c2d2e875bd78e44c1de5700b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e949fba8e7c225ebf56c7ce4eed1e452b6c3344efee0514cdbcbc50cf23ef58d28afc10ba508fe09f7642cad0b36459cabb9869e7534d9410c9fecbdb5fc144
|
|
7
|
+
data.tar.gz: 4300592222f3ec0098f0c08d112be3999dbd276455c531588f43fd515a94cdeb6c7edab05ae028abed28092776adef624af3ccdd8a8859473f07ca4e2295fec9
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.5.5
|
data/.travis.yml
CHANGED
data/ama_layout.gemspec
CHANGED
|
@@ -1,35 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
5
|
require 'ama_layout/version'
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name
|
|
8
|
-
spec.version
|
|
9
|
-
spec.authors
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
spec.name = 'ama_layout'
|
|
9
|
+
spec.version = AmaLayout::VERSION
|
|
10
|
+
spec.authors = [
|
|
11
|
+
'Darko Dosenovic',
|
|
12
|
+
'Jesse Doyle',
|
|
13
|
+
'Kayt Wilson',
|
|
14
|
+
'Michael van den Beuken',
|
|
15
|
+
'Sinead Errity',
|
|
16
|
+
'Zoie Carnegie'
|
|
17
|
+
]
|
|
18
|
+
spec.email = [
|
|
19
|
+
'darko.dosenovic@ama.ab.ca',
|
|
20
|
+
'jesse.doyle@ama.ab.ca',
|
|
21
|
+
'kayt.wilson@ama.ab.ca',
|
|
22
|
+
'michael.beuken@gmail.com',
|
|
23
|
+
'sinead.errity@ama.ab.ca',
|
|
24
|
+
'zoie.carnegie@ama.ab.ca'
|
|
25
|
+
]
|
|
26
|
+
spec.summary = '.ama.ab.ca site layouts'
|
|
27
|
+
spec.description = '.ama.ab.ca site layouts'
|
|
28
|
+
spec.homepage = 'https://github.com/amaabca/ama_layout'
|
|
29
|
+
spec.license = 'MIT'
|
|
15
30
|
|
|
16
|
-
spec.files
|
|
17
|
-
spec.executables
|
|
18
|
-
spec.test_files
|
|
31
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
32
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
33
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
34
|
spec.require_paths = ['lib']
|
|
20
35
|
|
|
36
|
+
spec.add_dependency 'breadcrumbs_on_rails', '>= 3'
|
|
37
|
+
spec.add_dependency 'browser', '~> 2.0'
|
|
21
38
|
spec.add_dependency 'foundation-rails', '<= 6.4.3.0'
|
|
22
39
|
spec.add_dependency 'rails', '>= 4.2'
|
|
23
|
-
spec.add_dependency 'browser', '~> 2.0'
|
|
24
|
-
spec.add_dependency 'breadcrumbs_on_rails', '>= 3'
|
|
25
40
|
spec.add_dependency 'redis-rails'
|
|
26
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
|
41
|
+
spec.add_development_dependency 'bundler', '~> 1.17.3'
|
|
42
|
+
spec.add_development_dependency 'combustion'
|
|
43
|
+
spec.add_development_dependency 'factory_bot'
|
|
44
|
+
spec.add_development_dependency 'pry'
|
|
27
45
|
spec.add_development_dependency 'rake', '>= 11.0'
|
|
28
46
|
spec.add_development_dependency 'rspec-rails'
|
|
29
|
-
spec.add_development_dependency 'factory_bot'
|
|
30
47
|
spec.add_development_dependency 'simplecov'
|
|
31
|
-
spec.add_development_dependency 'pry'
|
|
32
|
-
spec.add_development_dependency 'combustion'
|
|
33
48
|
spec.add_development_dependency 'sqlite3'
|
|
34
49
|
spec.add_development_dependency 'timecop'
|
|
35
50
|
end
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
<li class="has-submenu">
|
|
2
2
|
<%= link_to navigation.display_name_text, '#', class: 'link--no-underline' %>
|
|
3
3
|
<ul class="submenu menu vertical">
|
|
4
|
-
<li>
|
|
5
|
-
<%= link_to '
|
|
4
|
+
<li class="bold">
|
|
5
|
+
<%= link_to 'Account Settings', "#{Rails.configuration.gatekeeper_site}/user/edit" %>
|
|
6
6
|
</li>
|
|
7
|
-
<li
|
|
8
|
-
|
|
7
|
+
<li class="small-text">
|
|
8
|
+
<%= link_to 'Change Email/Password', "#{Rails.configuration.gatekeeper_site}/user/edit" %>
|
|
9
|
+
</li>
|
|
10
|
+
<li class="small-text">
|
|
11
|
+
<%= link_to 'Email Subscriptions', "#{Rails.configuration.youraccount_site}/subscriptions" %>
|
|
12
|
+
</li>
|
|
13
|
+
<li class="small-text">
|
|
14
|
+
<%= link_to 'Update Address', "#{Rails.configuration.youraccount_site}/membership_update/new" %>
|
|
15
|
+
</li>
|
|
16
|
+
<%= navigation.manage_credit_card_link %>
|
|
9
17
|
<%= navigation.sign_out_link %>
|
|
10
18
|
</ul>
|
|
11
19
|
</li>
|
data/config.ru
ADDED
|
@@ -12,18 +12,21 @@ module AmaLayout
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def sign_out_link
|
|
15
|
-
return
|
|
16
|
-
|
|
15
|
+
return '' unless user
|
|
16
|
+
|
|
17
|
+
h.render partial: 'ama_layout/sign_out_link'
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def top_nav
|
|
20
|
-
return
|
|
21
|
-
|
|
21
|
+
return '' unless user
|
|
22
|
+
|
|
23
|
+
h.render partial: 'ama_layout/agent/top_nav', locals: { navigation: self }
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def sidebar
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
+
return '' unless user
|
|
28
|
+
|
|
29
|
+
h.render partial: 'ama_layout/sidebar', locals: { navigation: self }
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
def cash_drawer_name
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module AmaLayout
|
|
2
4
|
class NavigationDecorator
|
|
3
5
|
include AmaLayout::DraperReplacement
|
|
@@ -11,16 +13,27 @@ module AmaLayout
|
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
def sign_out_link
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
+
return '' unless user
|
|
17
|
+
|
|
18
|
+
h.render partial: 'ama_layout/sign_out_link'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def manage_credit_card_link
|
|
22
|
+
return '' unless user && %w[member member_renewal member_outstanding_balance].include?(user.try(:menu_key))
|
|
23
|
+
|
|
24
|
+
h.render partial: 'ama_layout/manage_credit_card_link'
|
|
16
25
|
end
|
|
17
26
|
|
|
18
27
|
def top_nav
|
|
19
|
-
|
|
28
|
+
return '' unless user
|
|
29
|
+
|
|
30
|
+
h.render partial: 'ama_layout/top_nav', locals: { navigation: self }
|
|
20
31
|
end
|
|
21
32
|
|
|
22
33
|
def sidebar
|
|
23
|
-
|
|
34
|
+
return '' if items.none?
|
|
35
|
+
|
|
36
|
+
h.render partial: 'ama_layout/sidebar', locals: { navigation: self }
|
|
24
37
|
end
|
|
25
38
|
|
|
26
39
|
def name_or_email
|
|
@@ -28,42 +41,44 @@ module AmaLayout
|
|
|
28
41
|
end
|
|
29
42
|
|
|
30
43
|
def account_toggle(view_data = {})
|
|
31
|
-
h(view_data).render partial:
|
|
44
|
+
h(view_data).render partial: 'account_toggle'
|
|
32
45
|
end
|
|
33
46
|
|
|
34
47
|
def notification_icon
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
return '' unless user
|
|
49
|
+
|
|
50
|
+
h.render 'ama_layout/notification_icon', navigation: self
|
|
38
51
|
end
|
|
39
52
|
|
|
40
53
|
def mobile_notification_icon
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
return '' unless user
|
|
55
|
+
|
|
56
|
+
h.render 'ama_layout/mobile_notification_icon', navigation: self
|
|
44
57
|
end
|
|
45
58
|
|
|
46
59
|
def mobile_links
|
|
47
|
-
|
|
60
|
+
return '' if user
|
|
61
|
+
|
|
62
|
+
h.render 'ama_layout/mobile_links'
|
|
48
63
|
end
|
|
49
64
|
|
|
50
65
|
def notification_badge
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
return '' unless new_notifications?
|
|
67
|
+
|
|
68
|
+
h.content_tag(
|
|
69
|
+
:div,
|
|
70
|
+
active_notification_count,
|
|
71
|
+
class: 'notification__badge',
|
|
72
|
+
data: {
|
|
73
|
+
notification_count: true
|
|
74
|
+
}
|
|
75
|
+
)
|
|
61
76
|
end
|
|
62
77
|
|
|
63
78
|
def notification_sidebar
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
return '' unless user
|
|
80
|
+
|
|
81
|
+
h.render 'ama_layout/notification_sidebar', navigation: self, notifications: decorated_notifications
|
|
67
82
|
end
|
|
68
83
|
|
|
69
84
|
def notifications_heading
|
|
@@ -85,7 +100,7 @@ module AmaLayout
|
|
|
85
100
|
end
|
|
86
101
|
|
|
87
102
|
def new_notifications?
|
|
88
|
-
active_notification_count
|
|
103
|
+
active_notification_count.positive?
|
|
89
104
|
end
|
|
90
105
|
end
|
|
91
106
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module AmaLayout
|
|
2
4
|
class Navigation
|
|
3
5
|
include ActiveModel::Model
|
|
@@ -14,44 +16,49 @@ module AmaLayout
|
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
cattr_accessor :member do
|
|
17
|
-
|
|
19
|
+
'member'
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
cattr_accessor :non_member do
|
|
21
|
-
|
|
23
|
+
'non-member'
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
cattr_accessor :member_in_renewal do
|
|
25
|
-
|
|
27
|
+
'member-in-renewal'
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
cattr_accessor :member_in_renewal_late do
|
|
29
|
-
|
|
31
|
+
'member-in-renewal-late'
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
cattr_accessor :member_with_outstanding_balance do
|
|
33
|
-
|
|
35
|
+
'member-with-outstanding-balance'
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
def items
|
|
37
39
|
navigation_items.fetch(user.try(:navigation), []).map do |n|
|
|
38
|
-
NavigationItem.new n.merge(
|
|
40
|
+
NavigationItem.new n.merge(current_url: current_url)
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
def navigation_items
|
|
43
|
-
YAML.
|
|
45
|
+
YAML.safe_load(ERB.new(File.read(nav_file_path)).result)
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
def email
|
|
47
49
|
user.email
|
|
48
50
|
end
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
private
|
|
51
53
|
|
|
52
54
|
def defaults
|
|
53
55
|
{
|
|
54
|
-
nav_file_path: File.join(
|
|
56
|
+
nav_file_path: File.join(
|
|
57
|
+
Gem.loaded_specs['ama_layout'].full_gem_path,
|
|
58
|
+
'lib',
|
|
59
|
+
'ama_layout',
|
|
60
|
+
'navigation.yml'
|
|
61
|
+
)
|
|
55
62
|
}
|
|
56
63
|
end
|
|
57
64
|
end
|
data/lib/ama_layout/version.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
describe AmaLayout::NavigationDecorator do
|
|
2
4
|
let(:navigation) { FactoryBot.build(:navigation) }
|
|
3
5
|
let(:navigation_presenter) { navigation.decorate }
|
|
@@ -15,53 +17,53 @@ describe AmaLayout::NavigationDecorator do
|
|
|
15
17
|
Rails.configuration.amaabca_site = 'http://test.ama.ab.ca/'
|
|
16
18
|
end
|
|
17
19
|
|
|
18
|
-
describe
|
|
20
|
+
describe '#display_name_text' do
|
|
19
21
|
let(:user) { OpenStruct.new(email: 'john.doe@test.com') }
|
|
20
22
|
|
|
21
|
-
context
|
|
22
|
-
let(:name) {
|
|
23
|
+
context 'name is provided' do
|
|
24
|
+
let(:name) { 'John D' }
|
|
23
25
|
let(:nav) { AmaLayout::Navigation.new(user: user, display_name: name).decorate }
|
|
24
26
|
|
|
25
|
-
it
|
|
26
|
-
expect(nav.display_name_text).to eq
|
|
27
|
+
it 'has a welcome message' do
|
|
28
|
+
expect(nav.display_name_text).to eq('Welcome, John D')
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
context
|
|
30
|
-
let(:name) {
|
|
31
|
+
context 'long name given' do
|
|
32
|
+
let(:name) { 'A Really Really Really Really Long Name' }
|
|
31
33
|
|
|
32
|
-
it
|
|
33
|
-
expect(nav.display_name_text).to eq
|
|
34
|
+
it 'trucates to a total of 30 characters' do
|
|
35
|
+
expect(nav.display_name_text).to eq("Welcome, #{name.titleize}".truncate(30))
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
|
|
38
|
-
context
|
|
40
|
+
context 'name is not provided' do
|
|
39
41
|
let(:nav) { AmaLayout::Navigation.new(user: user).decorate }
|
|
40
42
|
|
|
41
|
-
it
|
|
42
|
-
expect(nav.display_name_text).to eq
|
|
43
|
+
it 'returns the email address' do
|
|
44
|
+
expect(nav.display_name_text).to eq(user.email)
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
context
|
|
47
|
+
context 'a really long email' do
|
|
46
48
|
let(:user) { OpenStruct.new(email: 'areallyreallyreallylongemail@test.com') }
|
|
47
49
|
|
|
48
|
-
it
|
|
49
|
-
expect(nav.display_name_text).to eq
|
|
50
|
+
it 'trucates to a total of 30 characters' do
|
|
51
|
+
expect(nav.display_name_text).to eq(user.email.truncate(30))
|
|
50
52
|
end
|
|
51
53
|
end
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
|
|
55
|
-
describe
|
|
57
|
+
describe '#items' do
|
|
56
58
|
before(:each) do
|
|
57
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
|
59
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
it
|
|
62
|
+
it 'returns an array of navigation items' do
|
|
61
63
|
expect(navigation_presenter.items).to be_an Array
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
it
|
|
66
|
+
it 'array contains decorated navigation items' do
|
|
65
67
|
items = navigation_presenter.items
|
|
66
68
|
items.each do |i|
|
|
67
69
|
expect(i).to be_a AmaLayout::NavigationItemDecorator
|
|
@@ -76,7 +78,7 @@ describe AmaLayout::NavigationDecorator do
|
|
|
76
78
|
end
|
|
77
79
|
|
|
78
80
|
it 'returns nil' do
|
|
79
|
-
expect(navigation_presenter.mobile_links).to
|
|
81
|
+
expect(navigation_presenter.mobile_links).to eq('')
|
|
80
82
|
end
|
|
81
83
|
end
|
|
82
84
|
|
|
@@ -87,71 +89,123 @@ describe AmaLayout::NavigationDecorator do
|
|
|
87
89
|
end
|
|
88
90
|
end
|
|
89
91
|
|
|
90
|
-
describe
|
|
91
|
-
context
|
|
92
|
-
it
|
|
93
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
|
94
|
-
expect(navigation_presenter.sign_out_link).to include
|
|
92
|
+
describe '#sign_out_link' do
|
|
93
|
+
context 'with user' do
|
|
94
|
+
it 'returns link' do
|
|
95
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
|
96
|
+
expect(navigation_presenter.sign_out_link).to include('Sign Out')
|
|
95
97
|
end
|
|
96
98
|
end
|
|
97
99
|
|
|
98
|
-
context
|
|
99
|
-
it
|
|
100
|
-
expect(navigation_presenter.sign_out_link).to eq
|
|
100
|
+
context 'without user' do
|
|
101
|
+
it 'does not return the link' do
|
|
102
|
+
expect(navigation_presenter.sign_out_link).to eq('')
|
|
101
103
|
end
|
|
102
104
|
end
|
|
103
105
|
end
|
|
104
106
|
|
|
105
|
-
describe
|
|
106
|
-
context
|
|
107
|
-
it
|
|
108
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
|
109
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
|
110
|
-
expect(navigation_presenter.top_nav).to eq
|
|
107
|
+
describe '#top_nav' do
|
|
108
|
+
context 'with items' do
|
|
109
|
+
it 'renders the partial' do
|
|
110
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
|
111
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
|
112
|
+
expect(navigation_presenter.top_nav).to eq('render')
|
|
111
113
|
end
|
|
112
114
|
end
|
|
113
115
|
|
|
114
|
-
context
|
|
115
|
-
it
|
|
116
|
-
expect(navigation_presenter.top_nav).to eq
|
|
116
|
+
context 'without items' do
|
|
117
|
+
it 'does not renders the partial' do
|
|
118
|
+
expect(navigation_presenter.top_nav).to eq('')
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
end
|
|
120
122
|
|
|
121
|
-
describe
|
|
122
|
-
context
|
|
123
|
-
it
|
|
124
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
|
125
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
|
126
|
-
expect(navigation_presenter.sidebar).to eq
|
|
123
|
+
describe '#sidebar' do
|
|
124
|
+
context 'with items' do
|
|
125
|
+
it 'renders the partial' do
|
|
126
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
|
127
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
|
128
|
+
expect(navigation_presenter.sidebar).to eq('render')
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
context 'without items' do
|
|
133
|
+
it 'does not renders the partial' do
|
|
134
|
+
expect(navigation_presenter.sidebar).to eq('')
|
|
127
135
|
end
|
|
128
136
|
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
describe '#manage_credit_card_link' do
|
|
140
|
+
let(:navigation) { FactoryBot.build(:navigation, user: user) }
|
|
141
|
+
|
|
142
|
+
context 'nil user' do
|
|
143
|
+
let(:user) {}
|
|
144
|
+
|
|
145
|
+
it 'returns nothing' do
|
|
146
|
+
expect(navigation_presenter.manage_credit_card_link).to eq('')
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
context 'non_member' do
|
|
151
|
+
let(:user) { FactoryBot.build(:user, :non_member) }
|
|
152
|
+
|
|
153
|
+
it 'returns nothing' do
|
|
154
|
+
expect(navigation_presenter.manage_credit_card_link).to eq('')
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
context 'status AL' do
|
|
159
|
+
let(:user) { FactoryBot.build(:user, :in_renewal_late) }
|
|
160
|
+
|
|
161
|
+
it 'returns nothing' do
|
|
162
|
+
expect(navigation_presenter.manage_credit_card_link).to eq('')
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
context 'outstanding balance' do
|
|
167
|
+
let(:user) { FactoryBot.build(:user, :outstanding_balance) }
|
|
168
|
+
|
|
169
|
+
it 'returns the manage credit cards link' do
|
|
170
|
+
expect(navigation_presenter.manage_credit_card_link).to include('Manage Credit Cards')
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
context 'member' do
|
|
175
|
+
let(:user) { FactoryBot.build(:user) }
|
|
176
|
+
|
|
177
|
+
it 'returns the manage credit cards link' do
|
|
178
|
+
expect(navigation_presenter.manage_credit_card_link).to include('Manage Credit Cards')
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context 'in renewal' do
|
|
183
|
+
let(:user) { FactoryBot.build(:user, :in_renewal) }
|
|
129
184
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
expect(navigation_presenter.sidebar).to eq nil
|
|
185
|
+
it 'returns the manage credit cards link' do
|
|
186
|
+
expect(navigation_presenter.manage_credit_card_link).to include('Manage Credit Cards')
|
|
133
187
|
end
|
|
134
188
|
end
|
|
135
189
|
end
|
|
136
190
|
|
|
137
|
-
context
|
|
138
|
-
it
|
|
139
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
|
140
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
|
141
|
-
expect(navigation_presenter.account_toggle).to eq
|
|
191
|
+
context 'account toggle' do
|
|
192
|
+
it 'in ama_layout it renders a blank partial' do
|
|
193
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
|
194
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
|
195
|
+
expect(navigation_presenter.account_toggle).to eq('render')
|
|
142
196
|
end
|
|
143
197
|
|
|
144
|
-
it
|
|
145
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
|
146
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
|
147
|
-
expect(navigation_presenter.account_toggle).to eq
|
|
198
|
+
it 'in ama_layout it renders a blank partial' do
|
|
199
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
|
200
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
|
201
|
+
expect(navigation_presenter.account_toggle).to eq('render')
|
|
148
202
|
end
|
|
149
203
|
end
|
|
150
204
|
|
|
151
|
-
describe
|
|
152
|
-
context
|
|
153
|
-
it
|
|
154
|
-
expect(navigation_presenter.h(Helpers::AttachMethodsSample.new).additional_info).to eq
|
|
205
|
+
describe 'ama layout view' do
|
|
206
|
+
context 'needed to allow rendering based on the view main app' do
|
|
207
|
+
it 'attaches additional methods to current decorator - draper is capable of the same thing' do
|
|
208
|
+
expect(navigation_presenter.h(Helpers::AttachMethodsSample.new).additional_info).to eq('Bruce Wayne')
|
|
155
209
|
end
|
|
156
210
|
end
|
|
157
211
|
end
|
|
@@ -217,7 +271,7 @@ describe AmaLayout::NavigationDecorator do
|
|
|
217
271
|
end
|
|
218
272
|
|
|
219
273
|
it 'does not return the badge markup' do
|
|
220
|
-
expect(subject.notification_badge).to
|
|
274
|
+
expect(subject.notification_badge).to eq('')
|
|
221
275
|
end
|
|
222
276
|
end
|
|
223
277
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
FactoryBot.define do
|
|
2
4
|
factory :navigation_item, class: AmaLayout::NavigationItem do
|
|
3
|
-
text
|
|
4
|
-
icon
|
|
5
|
-
link
|
|
6
|
-
alt
|
|
5
|
+
text { 'Gotham Overview' }
|
|
6
|
+
icon { 'fa-tachometer' }
|
|
7
|
+
link { 'http://waffleemporium.ca/gotica' }
|
|
8
|
+
alt { 'Back to my dashboard' }
|
|
7
9
|
end
|
|
8
10
|
end
|
data/spec/factories/users.rb
CHANGED
|
@@ -1,35 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
FactoryBot.define do
|
|
2
4
|
factory :user, class: Class.new(OpenStruct) do
|
|
3
|
-
in_renewal false
|
|
4
|
-
member_type 'P'
|
|
5
|
-
renew_type 'R'
|
|
6
|
-
status 'A'
|
|
7
|
-
has_outstanding_balance false
|
|
8
|
-
member? true
|
|
5
|
+
in_renewal { false }
|
|
6
|
+
member_type { 'P' }
|
|
7
|
+
renew_type { 'R' }
|
|
8
|
+
status { 'A' }
|
|
9
|
+
has_outstanding_balance { false }
|
|
10
|
+
member? { true }
|
|
11
|
+
menu_key { 'member' }
|
|
9
12
|
|
|
10
13
|
trait :non_member do
|
|
11
|
-
member? false
|
|
14
|
+
member? { false }
|
|
15
|
+
menu_key { 'non_member' }
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
trait :with_accr do
|
|
15
|
-
renew_type 'A'
|
|
19
|
+
renew_type { 'A' }
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
trait :with_mpp do
|
|
19
|
-
renew_type 'M'
|
|
23
|
+
renew_type { 'M' }
|
|
20
24
|
end
|
|
21
25
|
|
|
22
26
|
trait :in_renewal do
|
|
23
|
-
in_renewal true
|
|
27
|
+
in_renewal { true }
|
|
28
|
+
menu_key { 'member_renewal' }
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
trait :in_renewal_late do
|
|
27
|
-
in_renewal true
|
|
28
|
-
status 'AL'
|
|
32
|
+
in_renewal { true }
|
|
33
|
+
status { 'AL' }
|
|
34
|
+
menu_key { 'member_renewal_late' }
|
|
29
35
|
end
|
|
30
36
|
|
|
31
37
|
trait :outstanding_balance do
|
|
32
|
-
has_outstanding_balance true
|
|
38
|
+
has_outstanding_balance { true }
|
|
39
|
+
menu_key { 'member_outstanding_balance' }
|
|
33
40
|
end
|
|
34
41
|
end
|
|
35
42
|
end
|
|
File without changes
|
data/spec/internal/db/schema.rb
CHANGED
metadata
CHANGED
|
@@ -1,81 +1,76 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ama_layout
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 10.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Michael van den Beuken
|
|
8
|
-
- Ruben Estevez
|
|
9
|
-
- Jordan Babe
|
|
10
|
-
- Mathieu Gilbert
|
|
11
|
-
- Ryan Jones
|
|
12
7
|
- Darko Dosenovic
|
|
13
|
-
- Jonathan Weyermann
|
|
14
|
-
- Adam Melnyk
|
|
15
|
-
- Kayt Campbell
|
|
16
|
-
- Kathleen Robertson
|
|
17
8
|
- Jesse Doyle
|
|
9
|
+
- Kayt Wilson
|
|
10
|
+
- Michael van den Beuken
|
|
11
|
+
- Sinead Errity
|
|
12
|
+
- Zoie Carnegie
|
|
18
13
|
autorequire:
|
|
19
14
|
bindir: bin
|
|
20
15
|
cert_chain: []
|
|
21
|
-
date:
|
|
16
|
+
date: 2020-01-23 00:00:00.000000000 Z
|
|
22
17
|
dependencies:
|
|
23
18
|
- !ruby/object:Gem::Dependency
|
|
24
|
-
name:
|
|
19
|
+
name: breadcrumbs_on_rails
|
|
25
20
|
requirement: !ruby/object:Gem::Requirement
|
|
26
21
|
requirements:
|
|
27
|
-
- - "
|
|
22
|
+
- - ">="
|
|
28
23
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
24
|
+
version: '3'
|
|
30
25
|
type: :runtime
|
|
31
26
|
prerelease: false
|
|
32
27
|
version_requirements: !ruby/object:Gem::Requirement
|
|
33
28
|
requirements:
|
|
34
|
-
- - "
|
|
29
|
+
- - ">="
|
|
35
30
|
- !ruby/object:Gem::Version
|
|
36
|
-
version:
|
|
31
|
+
version: '3'
|
|
37
32
|
- !ruby/object:Gem::Dependency
|
|
38
|
-
name:
|
|
33
|
+
name: browser
|
|
39
34
|
requirement: !ruby/object:Gem::Requirement
|
|
40
35
|
requirements:
|
|
41
|
-
- - "
|
|
36
|
+
- - "~>"
|
|
42
37
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '
|
|
38
|
+
version: '2.0'
|
|
44
39
|
type: :runtime
|
|
45
40
|
prerelease: false
|
|
46
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
47
42
|
requirements:
|
|
48
|
-
- - "
|
|
43
|
+
- - "~>"
|
|
49
44
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: '
|
|
45
|
+
version: '2.0'
|
|
51
46
|
- !ruby/object:Gem::Dependency
|
|
52
|
-
name:
|
|
47
|
+
name: foundation-rails
|
|
53
48
|
requirement: !ruby/object:Gem::Requirement
|
|
54
49
|
requirements:
|
|
55
|
-
- - "
|
|
50
|
+
- - "<="
|
|
56
51
|
- !ruby/object:Gem::Version
|
|
57
|
-
version:
|
|
52
|
+
version: 6.4.3.0
|
|
58
53
|
type: :runtime
|
|
59
54
|
prerelease: false
|
|
60
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
61
56
|
requirements:
|
|
62
|
-
- - "
|
|
57
|
+
- - "<="
|
|
63
58
|
- !ruby/object:Gem::Version
|
|
64
|
-
version:
|
|
59
|
+
version: 6.4.3.0
|
|
65
60
|
- !ruby/object:Gem::Dependency
|
|
66
|
-
name:
|
|
61
|
+
name: rails
|
|
67
62
|
requirement: !ruby/object:Gem::Requirement
|
|
68
63
|
requirements:
|
|
69
64
|
- - ">="
|
|
70
65
|
- !ruby/object:Gem::Version
|
|
71
|
-
version: '
|
|
66
|
+
version: '4.2'
|
|
72
67
|
type: :runtime
|
|
73
68
|
prerelease: false
|
|
74
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
75
70
|
requirements:
|
|
76
71
|
- - ">="
|
|
77
72
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: '
|
|
73
|
+
version: '4.2'
|
|
79
74
|
- !ruby/object:Gem::Dependency
|
|
80
75
|
name: redis-rails
|
|
81
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -96,30 +91,30 @@ dependencies:
|
|
|
96
91
|
requirements:
|
|
97
92
|
- - "~>"
|
|
98
93
|
- !ruby/object:Gem::Version
|
|
99
|
-
version:
|
|
94
|
+
version: 1.17.3
|
|
100
95
|
type: :development
|
|
101
96
|
prerelease: false
|
|
102
97
|
version_requirements: !ruby/object:Gem::Requirement
|
|
103
98
|
requirements:
|
|
104
99
|
- - "~>"
|
|
105
100
|
- !ruby/object:Gem::Version
|
|
106
|
-
version:
|
|
101
|
+
version: 1.17.3
|
|
107
102
|
- !ruby/object:Gem::Dependency
|
|
108
|
-
name:
|
|
103
|
+
name: combustion
|
|
109
104
|
requirement: !ruby/object:Gem::Requirement
|
|
110
105
|
requirements:
|
|
111
106
|
- - ">="
|
|
112
107
|
- !ruby/object:Gem::Version
|
|
113
|
-
version: '
|
|
108
|
+
version: '0'
|
|
114
109
|
type: :development
|
|
115
110
|
prerelease: false
|
|
116
111
|
version_requirements: !ruby/object:Gem::Requirement
|
|
117
112
|
requirements:
|
|
118
113
|
- - ">="
|
|
119
114
|
- !ruby/object:Gem::Version
|
|
120
|
-
version: '
|
|
115
|
+
version: '0'
|
|
121
116
|
- !ruby/object:Gem::Dependency
|
|
122
|
-
name:
|
|
117
|
+
name: factory_bot
|
|
123
118
|
requirement: !ruby/object:Gem::Requirement
|
|
124
119
|
requirements:
|
|
125
120
|
- - ">="
|
|
@@ -133,7 +128,7 @@ dependencies:
|
|
|
133
128
|
- !ruby/object:Gem::Version
|
|
134
129
|
version: '0'
|
|
135
130
|
- !ruby/object:Gem::Dependency
|
|
136
|
-
name:
|
|
131
|
+
name: pry
|
|
137
132
|
requirement: !ruby/object:Gem::Requirement
|
|
138
133
|
requirements:
|
|
139
134
|
- - ">="
|
|
@@ -147,21 +142,21 @@ dependencies:
|
|
|
147
142
|
- !ruby/object:Gem::Version
|
|
148
143
|
version: '0'
|
|
149
144
|
- !ruby/object:Gem::Dependency
|
|
150
|
-
name:
|
|
145
|
+
name: rake
|
|
151
146
|
requirement: !ruby/object:Gem::Requirement
|
|
152
147
|
requirements:
|
|
153
148
|
- - ">="
|
|
154
149
|
- !ruby/object:Gem::Version
|
|
155
|
-
version: '0'
|
|
150
|
+
version: '11.0'
|
|
156
151
|
type: :development
|
|
157
152
|
prerelease: false
|
|
158
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
159
154
|
requirements:
|
|
160
155
|
- - ">="
|
|
161
156
|
- !ruby/object:Gem::Version
|
|
162
|
-
version: '0'
|
|
157
|
+
version: '11.0'
|
|
163
158
|
- !ruby/object:Gem::Dependency
|
|
164
|
-
name:
|
|
159
|
+
name: rspec-rails
|
|
165
160
|
requirement: !ruby/object:Gem::Requirement
|
|
166
161
|
requirements:
|
|
167
162
|
- - ">="
|
|
@@ -175,7 +170,7 @@ dependencies:
|
|
|
175
170
|
- !ruby/object:Gem::Version
|
|
176
171
|
version: '0'
|
|
177
172
|
- !ruby/object:Gem::Dependency
|
|
178
|
-
name:
|
|
173
|
+
name: simplecov
|
|
179
174
|
requirement: !ruby/object:Gem::Requirement
|
|
180
175
|
requirements:
|
|
181
176
|
- - ">="
|
|
@@ -218,23 +213,19 @@ dependencies:
|
|
|
218
213
|
version: '0'
|
|
219
214
|
description: ".ama.ab.ca site layouts"
|
|
220
215
|
email:
|
|
221
|
-
- michael.beuken@gmail.com
|
|
222
|
-
- ruben.a.estevez@gmail.com
|
|
223
|
-
- jorbabe@gmail.com
|
|
224
|
-
- mathieu.gilbert@ama.ab.ca
|
|
225
|
-
- ryan.michael.jones@gmail.com
|
|
226
216
|
- darko.dosenovic@ama.ab.ca
|
|
227
|
-
- jonathan.weyermann@ama.ab.ca
|
|
228
|
-
- adam.melnyk@ama.ab.ca
|
|
229
|
-
- kayt.campbell@ama.ab.ca
|
|
230
|
-
- kathleen.robertson@ama.ab.ca
|
|
231
217
|
- jesse.doyle@ama.ab.ca
|
|
218
|
+
- kayt.wilson@ama.ab.ca
|
|
219
|
+
- michael.beuken@gmail.com
|
|
220
|
+
- sinead.errity@ama.ab.ca
|
|
221
|
+
- zoie.carnegie@ama.ab.ca
|
|
232
222
|
executables: []
|
|
233
223
|
extensions: []
|
|
234
224
|
extra_rdoc_files: []
|
|
235
225
|
files:
|
|
236
226
|
- ".gitignore"
|
|
237
227
|
- ".rspec"
|
|
228
|
+
- ".ruby-version"
|
|
238
229
|
- ".simplecov"
|
|
239
230
|
- ".travis.yml"
|
|
240
231
|
- Gemfile
|
|
@@ -274,6 +265,7 @@ files:
|
|
|
274
265
|
- app/views/ama_layout/_footer.html.erb
|
|
275
266
|
- app/views/ama_layout/_main_nav_item.html.erb
|
|
276
267
|
- app/views/ama_layout/_main_top_nav_item.html.erb
|
|
268
|
+
- app/views/ama_layout/_manage_credit_card_link.html.erb
|
|
277
269
|
- app/views/ama_layout/_mobile_links.html.erb
|
|
278
270
|
- app/views/ama_layout/_mobile_notification_icon.html.erb
|
|
279
271
|
- app/views/ama_layout/_notice.html.erb
|
|
@@ -294,6 +286,7 @@ files:
|
|
|
294
286
|
- app/views/ama_layout/agent/_siteheader.html.erb
|
|
295
287
|
- app/views/ama_layout/agent/_top_nav.html.erb
|
|
296
288
|
- app/views/application/_account_toggle.html.erb
|
|
289
|
+
- config.ru
|
|
297
290
|
- config/routes.rb
|
|
298
291
|
- lib/ama_layout.rb
|
|
299
292
|
- lib/ama_layout/agent/navigation.rb
|
|
@@ -350,6 +343,7 @@ files:
|
|
|
350
343
|
- spec/helpers/ama_layout_breadcrumb_helper_spec.rb
|
|
351
344
|
- spec/helpers/ama_layout_content_helper_spec.rb
|
|
352
345
|
- spec/helpers/ama_layout_path_helper_spec.rb
|
|
346
|
+
- spec/internal/app/assets/config/manifest.js
|
|
353
347
|
- spec/internal/app/controllers/application_controller.rb
|
|
354
348
|
- spec/internal/app/controllers/pages_controller.rb
|
|
355
349
|
- spec/internal/config/database.yml
|
|
@@ -380,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
380
374
|
version: '0'
|
|
381
375
|
requirements: []
|
|
382
376
|
rubyforge_project:
|
|
383
|
-
rubygems_version: 2.
|
|
377
|
+
rubygems_version: 2.7.6.2
|
|
384
378
|
signing_key:
|
|
385
379
|
specification_version: 4
|
|
386
380
|
summary: ".ama.ab.ca site layouts"
|
|
@@ -415,6 +409,7 @@ test_files:
|
|
|
415
409
|
- spec/helpers/ama_layout_breadcrumb_helper_spec.rb
|
|
416
410
|
- spec/helpers/ama_layout_content_helper_spec.rb
|
|
417
411
|
- spec/helpers/ama_layout_path_helper_spec.rb
|
|
412
|
+
- spec/internal/app/assets/config/manifest.js
|
|
418
413
|
- spec/internal/app/controllers/application_controller.rb
|
|
419
414
|
- spec/internal/app/controllers/pages_controller.rb
|
|
420
415
|
- spec/internal/config/database.yml
|