ama_layout 5.4.0 → 5.5.0

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
  SHA1:
3
- metadata.gz: 3c84576ab846039685676fea5a445c6bde97a418
4
- data.tar.gz: 898f53f578677836a9f708c44117142217b49d3e
3
+ metadata.gz: c9d464241916a44feae3e3484c748db498c538d2
4
+ data.tar.gz: bb46402967e1dc1550edb662e0ce9454e8266d7a
5
5
  SHA512:
6
- metadata.gz: 1d15a754ed97115d0312f123885c591bb28498f6c7f17a99b00e5316256026ec9e2e0a25ca8a468a0fea441b26a8ebc0a622a6bd4b8c3e66f4df480254fa4fb2
7
- data.tar.gz: 0fc6b11bd21ee5739d94dc2e3188bf9030302bdcb5eff52c4ffbf364e90045da1ec01d7bb9ab252deac6ffdb418203c543814c149ed51173cd1948091acfa505
6
+ metadata.gz: b96bdea23b834ba5c23aae70e2c84c1e6580878ed350935eb0ac9a36be20ff94b5c84baa249e3e8490126f9ee06de4c6d97423ee2f6373b2ef6d439df9e9b1a1
7
+ data.tar.gz: 1b28881f58e8bf7eeefe277974d73e633ce7cbaae809002c15d978083dc7af3e4b03fc95a6a6a3b1a77f4d4458e1753ad9dcf3e5fe6c22a8637404763a0340d7
@@ -1,7 +1,7 @@
1
1
  <div class="header">
2
2
  <div class="title-bar" data-responsive-toggle="main-menu" data-hide-for="large">
3
3
  <button class="menu-icon" type="button" data-toggle="offCanvasLeft"></button>
4
- <%= link_to(image_tag("ama-logo.png", class: "title-bar__logo"), "https://www.ama.ab.ca") %>
4
+ <%= link_to(image_tag("ama-logo.png"), "https://www.ama.ab.ca", class: "title-bar__logo") %>
5
5
  </div>
6
6
  <div class="top-bar" id="main-menu">
7
7
  <div class="top-bar-left">
data/lib/ama_layout.rb CHANGED
@@ -9,6 +9,7 @@ require 'ama_layout/breadcrumb_builder'
9
9
  require 'ama_layout/moneris'
10
10
  require 'ama_layout/navigation'
11
11
  require 'ama_layout/navigation_item'
12
+ require 'ama_layout/navigation_helper'
12
13
  require 'ama_layout/decorators/moneris_decorator'
13
14
  require 'ama_layout/decorators/navigation_decorator'
14
15
  require 'ama_layout/decorators/navigation_item_decorator'
@@ -13,12 +13,15 @@ module AmaLayout
13
13
  cattr_accessor :member do
14
14
  "member"
15
15
  end
16
+
16
17
  cattr_accessor :non_member do
17
18
  "non-member"
18
19
  end
20
+
19
21
  cattr_accessor :member_in_renewal do
20
22
  "member-in-renewal"
21
23
  end
24
+
22
25
  cattr_accessor :member_in_renewal_late do
23
26
  "member-in-renewal-late"
24
27
  end
@@ -81,11 +81,78 @@ non-member:
81
81
  link: "<%= Rails.configuration.gatekeeper_site %>/user/edit"
82
82
  icon: "fa-cogs"
83
83
  member-in-renewal:
84
+ - text: "My Account Overview"
85
+ link: "<%= Rails.configuration.gatekeeper_site %>/"
86
+ icon: "fa-tachometer"
87
+ - text: "My Membership"
88
+ link: "<%= Rails.configuration.membership_site %>/membership/overview"
89
+ icon: "fa-credit-card"
90
+ sub_nav:
91
+ - text: "Membership Overview"
92
+ link: "<%= Rails.configuration.membership_site %>/membership/overview"
93
+ - text: "Renew Membership"
94
+ link: "<%= Rails.configuration.membership_site %>/renews/new"
95
+ icon: "fa-credit-card"
96
+ - text: "Manage Membership"
97
+ link: "<%= Rails.configuration.membership_site %>/membership/manage"
98
+ - text: "Billing Options"
99
+ link: "<%= Rails.configuration.youraccount_site %>/billing"
100
+ - text: "Print/Request New Card"
101
+ link: "<%= Rails.configuration.youraccount_site %>/membership"
102
+ - text: "My Roadside Assistance"
103
+ link: "<%= Rails.configuration.automotive_site %>/"
104
+ icon: "fa-car"
105
+ sub_nav:
106
+ - text: "Roadside Assistance Overview"
107
+ link: "<%= Rails.configuration.automotive_site %>/"
108
+ - text: "My Driver Education"
109
+ link: "<%= Rails.configuration.driveredonline_site %>/"
110
+ icon: "fa-car"
111
+ sub_nav:
112
+ - text: "Driver Education Overview"
113
+ link: "<%= Rails.configuration.driveredonline_site %>/"
114
+ - text: "New Driver Online Program"
115
+ link: "<%= Rails.configuration.driveredonline_site %>/dashboard"
116
+ - text: "My AMA Rewards"
117
+ link: "<%= Rails.configuration.youraccount_site %>/rewards"
118
+ icon: "fa-usd"
119
+ sub_nav:
120
+ - text: "Rewards Overview"
121
+ link: "<%= Rails.configuration.youraccount_site %>/rewards"
122
+ - text: "Gift Cards"
123
+ link: "<%= Rails.configuration.membership_site %>/reward_cards"
124
+ - text: "Transaction History"
125
+ link: "<%= Rails.configuration.youraccount_site %>/reward_dollars"
126
+ - text: "Pizza 73 Coupon Codes"
127
+ link: "<%= Rails.configuration.youraccount_site %>/pizza73"
128
+ - text: "My Registries"
129
+ link: "<%= Rails.configuration.registries_site %>/"
130
+ icon: "fa-folder-open"
131
+ sub_nav:
132
+ - text: "Registries Overview"
133
+ link: "<%= Rails.configuration.registries_site %>/"
134
+ - text: "Vehicle Registration Auto-Renew"
135
+ link: "<%= Rails.configuration.registries_site %>/order/registrations/new"
136
+ - text: "My Travel"
137
+ link: "<%= Rails.configuration.travel_site %>"
138
+ - text: "My Account Settings"
139
+ link: "<%= Rails.configuration.gatekeeper_site %>/user/edit"
140
+ icon: "fa-cogs"
141
+ sub_nav:
142
+ - text: "Change Email/Password"
143
+ link: "<%= Rails.configuration.gatekeeper_site %>/user/edit"
144
+ - text: "Email Subscriptions"
145
+ link: "<%= Rails.configuration.youraccount_site %>/subscriptions"
146
+ - text: "AMA Insider Magazine"
147
+ link: "<%= Rails.configuration.youraccount_site %>/amainsider"
148
+ - text: "Change Address"
149
+ link: "<%= Rails.configuration.youraccount_site %>/membership_update/new"
150
+ member-in-renewal-late:
84
151
  - text: "Account Dashboard"
85
152
  link: "<%= Rails.configuration.gatekeeper_site %>/"
86
153
  icon: "fa-tachometer"
87
154
  - text: "Renew"
88
- link: "<%= Rails.configuration.youraccount_site %>/renew"
155
+ link: "<%= Rails.configuration.membership_site %>/renews/new"
89
156
  icon: "fa-credit-card"
90
157
  - text: "Driver Education"
91
158
  link: "<%= Rails.configuration.driveredonline_site %>/"
@@ -95,11 +162,11 @@ member-in-renewal:
95
162
  link: "<%= Rails.configuration.driveredonline_site %>/"
96
163
  - text: "New Driver Online Program"
97
164
  link: "<%= Rails.configuration.driveredonline_site %>/dashboard"
98
- member-in-renewal-late:
165
+ member-with-outstanding-balance:
99
166
  - text: "Account Dashboard"
100
167
  link: "<%= Rails.configuration.gatekeeper_site %>/"
101
168
  icon: "fa-tachometer"
102
- - text: "Renew"
169
+ - text: "Pay Outstanding Balance"
103
170
  link: "<%= Rails.configuration.youraccount_site %>/renew"
104
171
  icon: "fa-credit-card"
105
172
  - text: "Driver Education"
@@ -0,0 +1,25 @@
1
+ module AmaLayout
2
+ module NavigationHelper
3
+ def navigation
4
+ return AmaLayout::Navigation.non_member unless member?
5
+ case
6
+ when _in_renewal_late?
7
+ AmaLayout::Navigation.member_in_renewal_late
8
+ when _in_renewal?
9
+ AmaLayout::Navigation.member_in_renewal
10
+ else
11
+ AmaLayout::Navigation.member
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def _in_renewal?
18
+ in_renewal
19
+ end
20
+
21
+ def _in_renewal_late?
22
+ status == "AL"
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module AmaLayout
2
- VERSION = '5.4.0'
2
+ VERSION = '5.5.0'
3
3
  end
@@ -0,0 +1,55 @@
1
+ describe AmaLayout::NavigationHelper do
2
+ subject { FactoryGirl.create(:user) }
3
+
4
+ describe '#navigation' do
5
+ before(:each) do
6
+ subject.class.include(AmaLayout::NavigationHelper).new
7
+ end
8
+
9
+ context 'non-member' do
10
+ subject { FactoryGirl.create(:user, :non_member) }
11
+
12
+ it 'shows non-member sidebar menu' do
13
+ expect(subject.navigation).to eq 'non-member'
14
+ end
15
+ end
16
+
17
+ context 'member' do
18
+ it 'shows member sidebar menu' do
19
+ expect(subject.navigation).to eq 'member'
20
+ end
21
+ end
22
+
23
+ context 'member with accr' do
24
+ subject { FactoryGirl.create(:user, :with_accr) }
25
+
26
+ it 'shows member sidebar menu' do
27
+ expect(subject.navigation).to eq 'member'
28
+ end
29
+ end
30
+
31
+ context 'member with mpp' do
32
+ subject { FactoryGirl.create(:user, :with_mpp) }
33
+
34
+ it 'shows member sidebar menu' do
35
+ expect(subject.navigation).to eq 'member'
36
+ end
37
+ end
38
+
39
+ context 'member in-renewal' do
40
+ subject { FactoryGirl.create(:user, :in_renewal) }
41
+
42
+ it 'shows in-renewal sidebar menu' do
43
+ expect(subject.navigation).to eq 'member-in-renewal'
44
+ end
45
+ end
46
+
47
+ context 'member in-renewal late' do
48
+ subject { FactoryGirl.create(:user, :in_renewal_late) }
49
+
50
+ it 'shows in-renewal-late sidebar menu' do
51
+ expect(subject.navigation).to eq 'member-in-renewal-late'
52
+ end
53
+ end
54
+ end
55
+ end
@@ -66,37 +66,7 @@ describe AmaLayout::Navigation do
66
66
 
67
67
  context "member" do
68
68
  context "subnavs" do
69
- context "automotive" do
70
- let(:automotive_subnav) { subject.items[2].sub_nav }
71
-
72
- it "returns the subnav items" do
73
- expect(automotive_subnav[0].text).to eq "Roadside Assistance Overview"
74
- expect(automotive_subnav[0].link).to eq "#{automotive_site}/"
75
- end
76
- end
77
-
78
- context "driver education" do
79
- let(:driver_education_subnav) { subject.items[3].sub_nav }
80
-
81
- it "return the subnav items" do
82
- expect(driver_education_subnav[0].text).to eq "Driver Education Overview"
83
- expect(driver_education_subnav[0].link).to eq "#{driveredonline_site}/"
84
-
85
- expect(driver_education_subnav[1].text).to eq "New Driver Online Program"
86
- expect(driver_education_subnav[1].link).to eq "#{driveredonline_site}/dashboard"
87
- end
88
- end
89
-
90
- context "registries" do
91
- let(:registries_subnav) { subject.items[5].sub_nav }
92
-
93
- it "returns the subnav items" do
94
- expect(registries_subnav[0].text).to eq "Registries Overview"
95
- expect(registries_subnav[0].link).to eq "#{registries_site}/"
96
- expect(registries_subnav[1].text).to eq "Vehicle Registration Auto-Renew"
97
- expect(registries_subnav[1].link).to eq "#{registries_site}/order/registrations/new"
98
- end
99
- end
69
+ include_examples "member_navigation"
100
70
  end
101
71
  end
102
72
 
@@ -121,24 +91,37 @@ describe AmaLayout::Navigation do
121
91
 
122
92
  context "member-in-renewal" do
123
93
  context "subnavs" do
124
- context "driver education" do
125
- before(:each) do
126
- subject.user = OpenStruct.new navigation: "member-in-renewal"
127
- end
128
- let(:driver_education_subnav) { subject.items[2].sub_nav }
94
+ before(:each) do
95
+ subject.user = OpenStruct.new navigation: "member-in-renewal"
96
+ end
129
97
 
130
- it "return the subnav items" do
131
- expect(driver_education_subnav[0].text).to eq "Driver Education Overview"
132
- expect(driver_education_subnav[0].link).to eq "#{driveredonline_site}/"
98
+ include_examples "member_navigation"
133
99
 
134
- expect(driver_education_subnav[1].text).to eq "New Driver Online Program"
135
- expect(driver_education_subnav[1].link).to eq "#{driveredonline_site}/dashboard"
100
+ context "membership" do
101
+ let(:membership_subnav) { subject.items[1].sub_nav }
102
+
103
+ it "has the correct subnav items" do
104
+ expect(membership_subnav[1].text).to eq "Renew Membership"
105
+ expect(membership_subnav[1].link).to eq "#{membership_site}/renews/new"
136
106
  end
137
107
  end
138
108
  end
139
109
  end
140
110
 
141
111
  context "member-in-renewal-late" do
112
+ before(:each) do
113
+ subject.user = OpenStruct.new navigation: "member-in-renewal-late"
114
+ end
115
+
116
+ context "main nav" do
117
+ it "return the main nav items" do
118
+ expect(subject.items[0].text).to eq "Account Dashboard"
119
+ expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
120
+ expect(subject.items[1].text).to eq "Renew"
121
+ expect(subject.items[1].link).to eq "#{membership_site}/renews/new"
122
+ end
123
+ end
124
+
142
125
  context "subnavs" do
143
126
  context "driver education" do
144
127
  before(:each) do
@@ -0,0 +1,35 @@
1
+ FactoryGirl.define do
2
+ 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
9
+
10
+ trait :non_member do
11
+ member? false
12
+ end
13
+
14
+ trait :with_accr do
15
+ renew_type 'A'
16
+ end
17
+
18
+ trait :with_mpp do
19
+ renew_type 'M'
20
+ end
21
+
22
+ trait :in_renewal do
23
+ in_renewal true
24
+ end
25
+
26
+ trait :in_renewal_late do
27
+ in_renewal true
28
+ status 'AL'
29
+ end
30
+
31
+ trait :outstanding_balance do
32
+ has_outstanding_balance true
33
+ end
34
+ end
35
+ end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ require 'rspec/rails'
6
6
  require 'combustion'
7
7
  require 'timecop'
8
8
 
9
- ENV['RAILS_ENV'] ||= 'test'
9
+ ENV['RAILS_ENV'] = 'test'
10
10
 
11
11
  Combustion.initialize! :all
12
12
 
@@ -0,0 +1,105 @@
1
+ shared_examples 'member_navigation' do
2
+
3
+ context 'overview' do
4
+ it 'has the correct overview text and url' do
5
+ expect(subject.items[0].text).to eq 'My Account Overview'
6
+ expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
7
+ end
8
+ end
9
+
10
+ context "membership" do
11
+ let(:membership_subnav) { subject.items[1].sub_nav }
12
+
13
+ it "returns the subnav items" do
14
+ length = membership_subnav.length
15
+
16
+ expect(membership_subnav[0].text).to eq 'Membership Overview'
17
+ expect(membership_subnav[0].link).to eq "#{membership_site}/membership/overview"
18
+
19
+ expect(membership_subnav[length - 3].text).to eq 'Manage Membership'
20
+ expect(membership_subnav[length - 3].link).to eq "#{membership_site}/membership/manage"
21
+
22
+ expect(membership_subnav[length - 2].text).to eq 'Billing Options'
23
+ expect(membership_subnav[length - 2].link).to eq "#{youraccount_site}/billing"
24
+
25
+ expect(membership_subnav.last.text).to eq 'Print/Request New Card'
26
+ expect(membership_subnav.last.link).to eq "#{youraccount_site}/membership"
27
+ end
28
+ end
29
+
30
+ context 'automotive' do
31
+ let(:automotive_subnav) { subject.items[2].sub_nav }
32
+
33
+ it 'returns the subnav items' do
34
+ expect(automotive_subnav[0].text).to eq 'Roadside Assistance Overview'
35
+ expect(automotive_subnav[0].link).to eq "#{automotive_site}/"
36
+ end
37
+ end
38
+
39
+ context 'driver education' do
40
+ let(:driver_education_subnav) { subject.items[3].sub_nav }
41
+
42
+ it 'return the subnav items' do
43
+ expect(driver_education_subnav[0].text).to eq 'Driver Education Overview'
44
+ expect(driver_education_subnav[0].link).to eq "#{driveredonline_site}/"
45
+
46
+ expect(driver_education_subnav[1].text).to eq 'New Driver Online Program'
47
+ expect(driver_education_subnav[1].link).to eq "#{driveredonline_site}/dashboard"
48
+ end
49
+ end
50
+
51
+ context 'rewards' do
52
+ let(:rewards_subnav) { subject.items[4].sub_nav }
53
+
54
+ it 'returns the subnav items' do
55
+ expect(rewards_subnav[0].text).to eq 'Rewards Overview'
56
+ expect(rewards_subnav[0].link).to eq "#{youraccount_site}/rewards"
57
+
58
+ expect(rewards_subnav[1].text).to eq 'Gift Cards'
59
+ expect(rewards_subnav[1].link).to eq "#{membership_site}/reward_cards"
60
+
61
+ expect(rewards_subnav[2].text).to eq 'Transaction History'
62
+ expect(rewards_subnav[2].link).to eq "#{youraccount_site}/reward_dollars"
63
+
64
+ expect(rewards_subnav[3].text).to eq 'Pizza 73 Coupon Codes'
65
+ expect(rewards_subnav[3].link).to eq "#{youraccount_site}/pizza73"
66
+ end
67
+ end
68
+
69
+ context 'registries' do
70
+ let(:registries_subnav) { subject.items[5].sub_nav }
71
+
72
+ it 'returns the subnav items' do
73
+ expect(registries_subnav[0].text).to eq 'Registries Overview'
74
+ expect(registries_subnav[0].link).to eq "#{registries_site}/"
75
+
76
+ expect(registries_subnav[1].text).to eq 'Vehicle Registration Auto-Renew'
77
+ expect(registries_subnav[1].link).to eq "#{registries_site}/order/registrations/new"
78
+ end
79
+ end
80
+
81
+ context 'travel' do
82
+ it 'has the correct travel text and url' do
83
+ expect(subject.items[6].text).to eq 'My Travel'
84
+ expect(subject.items[6].link).to eq "#{travel_site}"
85
+ end
86
+ end
87
+
88
+ context 'my account' do
89
+ let(:my_account_subnav) { subject.items[7].sub_nav }
90
+
91
+ it 'returns the subnav items' do
92
+ expect(my_account_subnav[0].text).to eq 'Change Email/Password'
93
+ expect(my_account_subnav[0].link).to eq "#{gatekeeper_site}/user/edit"
94
+
95
+ expect(my_account_subnav[1].text).to eq 'Email Subscriptions'
96
+ expect(my_account_subnav[1].link).to eq "#{youraccount_site}/subscriptions"
97
+
98
+ expect(my_account_subnav[2].text).to eq 'AMA Insider Magazine'
99
+ expect(my_account_subnav[2].link).to eq "#{youraccount_site}/amainsider"
100
+
101
+ expect(my_account_subnav[3].text).to eq 'Change Address'
102
+ expect(my_account_subnav[3].link).to eq "#{youraccount_site}/membership_update/new"
103
+ end
104
+ end
105
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ama_layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2017-06-22 00:00:00.000000000 Z
21
+ date: 2017-06-26 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: foundation-rails
@@ -305,6 +305,7 @@ files:
305
305
  - lib/ama_layout/moneris/textbox.txt
306
306
  - lib/ama_layout/navigation.rb
307
307
  - lib/ama_layout/navigation.yml
308
+ - lib/ama_layout/navigation_helper.rb
308
309
  - lib/ama_layout/navigation_item.rb
309
310
  - lib/ama_layout/notification.rb
310
311
  - lib/ama_layout/notification_set.rb
@@ -321,6 +322,7 @@ files:
321
322
  - spec/ama_layout/fixtures/real_date_picker.html
322
323
  - spec/ama_layout/javascripts/real_date_picker_spec.coffee
323
324
  - spec/ama_layout/moneris_spec.rb
325
+ - spec/ama_layout/navigation_helper_spec.rb
324
326
  - spec/ama_layout/navigation_item_spec.rb
325
327
  - spec/ama_layout/navigation_spec.rb
326
328
  - spec/ama_layout/notification_set_spec.rb
@@ -330,6 +332,7 @@ files:
330
332
  - spec/ama_layout/notifications_spec.rb
331
333
  - spec/factories/navigation.rb
332
334
  - spec/factories/navigation_item.rb
335
+ - spec/factories/users.rb
333
336
  - spec/helpers/ama_layout_breadcrumb_helper_spec.rb
334
337
  - spec/helpers/ama_layout_content_helper_spec.rb
335
338
  - spec/helpers/ama_layout_path_helper_spec.rb
@@ -341,6 +344,7 @@ files:
341
344
  - spec/internal/log/.gitignore
342
345
  - spec/internal/public/favicon.ico
343
346
  - spec/spec_helper.rb
347
+ - spec/support/shared_examples/member_navigation.rb
344
348
  homepage: https://github.com/amaabca/ama_layout
345
349
  licenses:
346
350
  - MIT
@@ -361,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
365
  version: '0'
362
366
  requirements: []
363
367
  rubyforge_project:
364
- rubygems_version: 2.6.12
368
+ rubygems_version: 2.6.7
365
369
  signing_key:
366
370
  specification_version: 4
367
371
  summary: ".ama.ab.ca site layouts"
@@ -375,6 +379,7 @@ test_files:
375
379
  - spec/ama_layout/fixtures/real_date_picker.html
376
380
  - spec/ama_layout/javascripts/real_date_picker_spec.coffee
377
381
  - spec/ama_layout/moneris_spec.rb
382
+ - spec/ama_layout/navigation_helper_spec.rb
378
383
  - spec/ama_layout/navigation_item_spec.rb
379
384
  - spec/ama_layout/navigation_spec.rb
380
385
  - spec/ama_layout/notification_set_spec.rb
@@ -384,6 +389,7 @@ test_files:
384
389
  - spec/ama_layout/notifications_spec.rb
385
390
  - spec/factories/navigation.rb
386
391
  - spec/factories/navigation_item.rb
392
+ - spec/factories/users.rb
387
393
  - spec/helpers/ama_layout_breadcrumb_helper_spec.rb
388
394
  - spec/helpers/ama_layout_content_helper_spec.rb
389
395
  - spec/helpers/ama_layout_path_helper_spec.rb
@@ -395,3 +401,4 @@ test_files:
395
401
  - spec/internal/log/.gitignore
396
402
  - spec/internal/public/favicon.ico
397
403
  - spec/spec_helper.rb
404
+ - spec/support/shared_examples/member_navigation.rb