ama_layout 10.2.0 → 11.1.0
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/.github/workflows/ci.yml +45 -0
- data/Dangerfile +19 -0
- data/ama_layout.gemspec +1 -1
- data/app/assets/javascripts/ama_layout/desktop/foundation-custom.js +1 -0
- data/app/helpers/ama_layout_breadcrumb_helper.rb +7 -1
- data/app/helpers/ama_layout_content_helper.rb +28 -17
- data/app/helpers/ama_layout_partial_helper.rb +11 -0
- data/app/views/ama_layout/{_alert.html.erb → v2/_alert.html.erb} +0 -0
- data/app/views/ama_layout/{_applogo.html.erb → v2/_applogo.html.erb} +0 -0
- data/app/views/ama_layout/{_breadcrumbs.html.erb → v2/_breadcrumbs.html.erb} +0 -0
- data/app/views/ama_layout/{_custom_nav_links.html.erb → v2/_custom_nav_links.html.erb} +0 -0
- data/app/views/ama_layout/{_custom_sidebar.html.erb → v2/_custom_sidebar.html.erb} +0 -0
- data/app/views/ama_layout/v2/_font.html.erb +1 -0
- data/app/views/ama_layout/{_footer.html.erb → v2/_footer.html.erb} +0 -0
- data/app/views/ama_layout/{_main_nav_item.html.erb → v2/_main_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/{_main_top_nav_item.html.erb → v2/_main_top_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/{_member_links.html.erb → v2/_member_links.html.erb} +0 -0
- data/app/views/ama_layout/{_mobile_links.html.erb → v2/_mobile_links.html.erb} +0 -0
- data/app/views/ama_layout/{_mobile_notification_icon.html.erb → v2/_mobile_notification_icon.html.erb} +0 -0
- data/app/views/ama_layout/{_notice.html.erb → v2/_notice.html.erb} +0 -0
- data/app/views/ama_layout/{_notices.html.erb → v2/_notices.html.erb} +0 -0
- data/app/views/ama_layout/{_notification.html.erb → v2/_notification.html.erb} +0 -0
- data/app/views/ama_layout/{_notification_icon.html.erb → v2/_notification_icon.html.erb} +0 -0
- data/app/views/ama_layout/{_notification_sidebar.html.erb → v2/_notification_sidebar.html.erb} +1 -1
- data/app/views/ama_layout/{_sidebar.html.erb → v2/_sidebar.html.erb} +0 -0
- data/app/views/ama_layout/{_sign_out_link.html.erb → v2/_sign_out_link.html.erb} +0 -0
- data/app/views/ama_layout/{_siteheader.html.erb → v2/_siteheader.html.erb} +0 -0
- data/app/views/ama_layout/{_sub_nav.html.erb → v2/_sub_nav.html.erb} +0 -0
- data/app/views/ama_layout/{_sub_nav_item.html.erb → v2/_sub_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/{_success.html.erb → v2/_success.html.erb} +0 -0
- data/app/views/ama_layout/{_top_nav.html.erb → v2/_top_nav.html.erb} +0 -0
- data/app/views/ama_layout/{_top_sub_nav.html.erb → v2/_top_sub_nav.html.erb} +0 -0
- data/app/views/ama_layout/{_top_sub_nav_item.html.erb → v2/_top_sub_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/v3/_alert.html.erb +5 -0
- data/app/views/ama_layout/v3/_applogo.html.erb +3 -0
- data/app/views/ama_layout/v3/_breadcrumbs.html.erb +3 -0
- data/app/views/ama_layout/v3/_custom_nav_links.html.erb +0 -0
- data/app/views/ama_layout/v3/_custom_sidebar.html.erb +1 -0
- data/app/views/ama_layout/v3/_font.html.erb +2 -0
- data/app/views/ama_layout/v3/_footer.html.erb +69 -0
- data/app/views/ama_layout/v3/_main_nav_item.html.erb +6 -0
- data/app/views/ama_layout/v3/_main_top_nav_item.html.erb +4 -0
- data/app/views/ama_layout/v3/_member_links.html.erb +6 -0
- data/app/views/ama_layout/v3/_mobile_links.html.erb +22 -0
- data/app/views/ama_layout/v3/_mobile_notification_icon.html.erb +4 -0
- data/app/views/ama_layout/v3/_notice.html.erb +5 -0
- data/app/views/ama_layout/v3/_notices.html.erb +3 -0
- data/app/views/ama_layout/v3/_notification.html.erb +10 -0
- data/app/views/ama_layout/v3/_notification_icon.html.erb +6 -0
- data/app/views/ama_layout/v3/_notification_sidebar.html.erb +22 -0
- data/app/views/ama_layout/v3/_sidebar.html.erb +8 -0
- data/app/views/ama_layout/v3/_sign_out_link.html.erb +3 -0
- data/app/views/ama_layout/v3/_siteheader.html.erb +37 -0
- data/app/views/ama_layout/v3/_sub_nav.html.erb +3 -0
- data/app/views/ama_layout/v3/_sub_nav_item.html.erb +3 -0
- data/app/views/ama_layout/v3/_success.html.erb +5 -0
- data/app/views/ama_layout/v3/_top_nav.html.erb +16 -0
- data/app/views/ama_layout/v3/_top_sub_nav.html.erb +3 -0
- data/app/views/ama_layout/v3/_top_sub_nav_item.html.erb +3 -0
- data/config.ru +1 -1
- data/lib/ama_layout/ama_layout_view.rb +6 -0
- data/lib/ama_layout/decorators/agent/navigation_decorator.rb +5 -3
- data/lib/ama_layout/decorators/navigation_decorator.rb +8 -8
- data/lib/ama_layout/draper_replacement.rb +6 -0
- data/lib/ama_layout/moneris.rb +10 -1
- data/lib/ama_layout/moneris/{textbox.txt → v2/textbox.txt} +0 -0
- data/lib/ama_layout/moneris/v3/textbox.txt +58 -0
- data/lib/ama_layout/version.rb +1 -1
- data/spec/ama_layout/decorators/moneris_decorator_spec.rb +4 -4
- data/spec/ama_layout/moneris_spec.rb +22 -3
- data/spec/helpers/ama_layout_content_helper_spec.rb +64 -62
- data/spec/spec_helper.rb +3 -1
- metadata +68 -37
- data/.travis.yml +0 -6
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="off-canvas position-right right-sidebar" id="offCanvasRight" data-off-canvas>
|
|
2
|
+
<div class="row column right-sidebar__header">
|
|
3
|
+
<h2 class="mt1">Notification Centre</h2>
|
|
4
|
+
<button class="close-button" aria-label="Close menu" type="button" data-close>
|
|
5
|
+
<span aria-hidden="true">×</span>
|
|
6
|
+
</button>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="row column">
|
|
9
|
+
<%= navigation.notifications_heading %>
|
|
10
|
+
</div>
|
|
11
|
+
<%= render partial: ama_layout_partial('notification'), collection: notifications %>
|
|
12
|
+
<div class="row column">
|
|
13
|
+
<p class="mt1">Did You Know?</p>
|
|
14
|
+
<div class="section-content">
|
|
15
|
+
<p class="bold">Sign up for Vehicle Registration Auto-Renew</p>
|
|
16
|
+
<p>
|
|
17
|
+
We'll process your payment and mail you a new registration certificate and licence plate sticker. It's that simple!
|
|
18
|
+
</p>
|
|
19
|
+
<%= link_to 'Sign up now', "#{Rails.configuration.registries_site}/order/registrations/new", class: 'button--right button--expand-small-down' %>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<aside class="side-nav" data-equalizer-watch="page-container-equalize">
|
|
2
|
+
<h2 class="side-nav__header">Online Account</h2>
|
|
3
|
+
<div class="side-nav__content">
|
|
4
|
+
<ul class="side-nav__list">
|
|
5
|
+
<%= render partial: "ama_layout/main_nav_item", collection: navigation.items, as: :nav_item %>
|
|
6
|
+
</ul>
|
|
7
|
+
</div>
|
|
8
|
+
</aside>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<div class="header">
|
|
2
|
+
<div class="title-bar" data-responsive-toggle="main-menu" data-hide-for="large">
|
|
3
|
+
<button class="menu-icon" type="button" data-toggle="offCanvasLeft"></button>
|
|
4
|
+
<%= link_to(image_tag("ama-logo.png"), Rails.configuration.amaabca_site, class: "title-bar__logo") %>
|
|
5
|
+
<%= navigation.mobile_notification_icon %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="top-bar" id="main-menu">
|
|
8
|
+
<div class="top-bar-left">
|
|
9
|
+
<%= link_to(image_tag("ama-logo.png", class: "top-bar__logo"), Rails.configuration.amaabca_site) %>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="top-bar-right">
|
|
12
|
+
<ul class="menu" data-responsive-menu="drilldown medium-dropdown">
|
|
13
|
+
<%= navigation.notification_icon %>
|
|
14
|
+
<li>
|
|
15
|
+
<a href="<%= Rails.configuration.amaabca_site %>/knowledge-base/articles" target="_blank">Help</a>
|
|
16
|
+
</li>
|
|
17
|
+
<li>
|
|
18
|
+
<a href="<%= Rails.configuration.amaabca_site %>/membership/contact-us--centre-locations-hours-and-contact-information">Contact Us</a>
|
|
19
|
+
</li>
|
|
20
|
+
<%= navigation.account_toggle(self) %>
|
|
21
|
+
<%= navigation.top_nav %>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<%= navigation.mobile_links %>
|
|
27
|
+
<%= navigation.notification_sidebar %>
|
|
28
|
+
<div class="javascript_errors error_notification" hidden></div>
|
|
29
|
+
<noscript>
|
|
30
|
+
<div class="mt1 large-12 columns text-center error_notification">
|
|
31
|
+
<h2 class="mt1">There seems to be an issue with your browser.</h2>
|
|
32
|
+
<h5>Javascript is disabled in your web browser.</h5>
|
|
33
|
+
<div class='fieldset text-center small mb1 block'>
|
|
34
|
+
For full functionality of this site it is necessary to enable JavaScript. Here are the <a href="http://www.enable-javascript.com/" target="_blank"> instructions how to enable JavaScript in your web browser</a>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</noscript>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<li class="has-submenu">
|
|
2
|
+
<%= link_to navigation.display_name_text, '#', class: 'link--no-underline' %>
|
|
3
|
+
<ul class="submenu menu vertical">
|
|
4
|
+
<li class="bold">
|
|
5
|
+
<%= link_to 'Account Settings', "#{Rails.configuration.gatekeeper_site}/account_settings" %>
|
|
6
|
+
</li>
|
|
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
|
+
<%= navigation.member_links %>
|
|
14
|
+
<%= navigation.sign_out_link %>
|
|
15
|
+
</ul>
|
|
16
|
+
</li>
|
data/config.ru
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module AmaLayout
|
|
2
4
|
module Agent
|
|
3
5
|
class NavigationDecorator
|
|
@@ -14,19 +16,19 @@ module AmaLayout
|
|
|
14
16
|
def sign_out_link
|
|
15
17
|
return '' unless user
|
|
16
18
|
|
|
17
|
-
h.render partial: '
|
|
19
|
+
h.render partial: ama_layout_partial('sign_out_link')
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def top_nav
|
|
21
23
|
return '' unless user
|
|
22
24
|
|
|
23
|
-
h.render partial: '
|
|
25
|
+
h.render partial: ama_layout_partial('agent/top_nav'), locals: { navigation: self }
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def sidebar
|
|
27
29
|
return '' unless user
|
|
28
30
|
|
|
29
|
-
h.render partial: '
|
|
31
|
+
h.render partial: ('sidebar'), locals: { navigation: self }
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
def cash_drawer_name
|
|
@@ -15,25 +15,25 @@ module AmaLayout
|
|
|
15
15
|
def sign_out_link
|
|
16
16
|
return '' unless user
|
|
17
17
|
|
|
18
|
-
h.render partial: '
|
|
18
|
+
h.render partial: ama_layout_partial('sign_out_link')
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def member_links
|
|
22
22
|
return '' unless user && %w[member member_renewal member_outstanding_balance].include?(user.try(:menu_key))
|
|
23
23
|
|
|
24
|
-
h.render partial: '
|
|
24
|
+
h.render partial: ama_layout_partial('member_links')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def top_nav
|
|
28
28
|
return '' unless user
|
|
29
29
|
|
|
30
|
-
h.render partial: '
|
|
30
|
+
h.render partial: ama_layout_partial('top_nav'), locals: { navigation: self }
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def sidebar
|
|
34
34
|
return '' if items.none?
|
|
35
35
|
|
|
36
|
-
h.render partial: '
|
|
36
|
+
h.render partial: ama_layout_partial('sidebar'), locals: { navigation: self }
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def name_or_email
|
|
@@ -47,19 +47,19 @@ module AmaLayout
|
|
|
47
47
|
def notification_icon
|
|
48
48
|
return '' unless user
|
|
49
49
|
|
|
50
|
-
h.render '
|
|
50
|
+
h.render ama_layout_partial('notification_icon'), navigation: self
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def mobile_notification_icon
|
|
54
54
|
return '' unless user
|
|
55
55
|
|
|
56
|
-
h.render '
|
|
56
|
+
h.render ama_layout_partial('mobile_notification_icon'), navigation: self
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def mobile_links
|
|
60
60
|
return '' if user
|
|
61
61
|
|
|
62
|
-
h.render '
|
|
62
|
+
h.render ama_layout_partial('mobile_links')
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def notification_badge
|
|
@@ -78,7 +78,7 @@ module AmaLayout
|
|
|
78
78
|
def notification_sidebar
|
|
79
79
|
return '' unless user
|
|
80
80
|
|
|
81
|
-
h.render '
|
|
81
|
+
h.render ama_layout_partial('notification_sidebar'), navigation: self, notifications: decorated_notifications
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def notifications_heading
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../app/helpers/ama_layout_partial_helper'
|
|
4
|
+
|
|
1
5
|
module AmaLayout
|
|
2
6
|
module DraperReplacement
|
|
3
7
|
extend ActiveSupport::Concern
|
|
4
8
|
|
|
5
9
|
included do
|
|
10
|
+
include AmaLayoutPartialHelper
|
|
11
|
+
|
|
6
12
|
attr_accessor :object, :controller
|
|
7
13
|
|
|
8
14
|
def h(view_data = {})
|
data/lib/ama_layout/moneris.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module AmaLayout
|
|
2
4
|
class Moneris
|
|
3
5
|
include ActiveModel::Model
|
|
@@ -9,7 +11,14 @@ module AmaLayout
|
|
|
9
11
|
attr_accessor :textbox_style_file
|
|
10
12
|
|
|
11
13
|
def textbox_style_file
|
|
12
|
-
@textbox_style_file ||= File.join
|
|
14
|
+
@textbox_style_file ||= File.join(
|
|
15
|
+
Gem.loaded_specs['ama_layout'].full_gem_path,
|
|
16
|
+
'lib',
|
|
17
|
+
'ama_layout',
|
|
18
|
+
'moneris',
|
|
19
|
+
Rails.configuration.stylesheet_resolver.version,
|
|
20
|
+
'textbox.txt'
|
|
21
|
+
)
|
|
13
22
|
end
|
|
14
23
|
end
|
|
15
24
|
end
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
-webkit-appearance: none;
|
|
2
|
+
-webkit-box-shadow: none;
|
|
3
|
+
-webkit-rtl-ordering: logical;
|
|
4
|
+
-webkit-transition-delay: 0s, 0s;
|
|
5
|
+
-webkit-transition-duration: 0.45s, 0.45s;
|
|
6
|
+
-webkit-transition-property: box-shadow, border-color;
|
|
7
|
+
-webkit-transition-timing-function: ease, ease-in-out;
|
|
8
|
+
-webkit-user-select: text;
|
|
9
|
+
-webkit-writing-mode: horizontal-tb;
|
|
10
|
+
background-color: rgb(255, 255, 255);
|
|
11
|
+
border-bottom-color: rgb(160, 160, 161);
|
|
12
|
+
border-bottom-style: solid;
|
|
13
|
+
border-bottom-width: 2px;
|
|
14
|
+
border-image-outset: 0px;
|
|
15
|
+
border-image-repeat: stretch;
|
|
16
|
+
border-image-slice: 100%;
|
|
17
|
+
border-image-source: none;
|
|
18
|
+
border-image-width: 1;
|
|
19
|
+
border-left-color: rgb(160, 160, 161);
|
|
20
|
+
border-left-style: solid;
|
|
21
|
+
border-left-width: 2px;
|
|
22
|
+
border-right-color: rgb(160, 160, 161);
|
|
23
|
+
border-right-style: solid;
|
|
24
|
+
border-right-width: 2px;
|
|
25
|
+
border-top-color: rgb(160, 160, 161);
|
|
26
|
+
border-top-style: solid;
|
|
27
|
+
border-top-width: 2px;
|
|
28
|
+
box-shadow: none;
|
|
29
|
+
border-radius: 9px;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
color: rgba(0, 0, 0, 0.74902);
|
|
32
|
+
cursor: auto;
|
|
33
|
+
display: block;
|
|
34
|
+
font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size: 14px;
|
|
35
|
+
font-style: normal;font-variant: normal;
|
|
36
|
+
font-weight: normal;
|
|
37
|
+
height: 44px;
|
|
38
|
+
letter-spacing: normal;
|
|
39
|
+
line-height: normal;
|
|
40
|
+
margin-bottom: 0px;
|
|
41
|
+
margin-left: 0px;
|
|
42
|
+
margin-right: 0px;
|
|
43
|
+
margin-top: 0px;
|
|
44
|
+
padding-bottom: 8px;
|
|
45
|
+
padding-left: 8px;
|
|
46
|
+
padding-right: 8px;
|
|
47
|
+
padding-top: 8px;
|
|
48
|
+
text-align: start;
|
|
49
|
+
text-indent: 0px;
|
|
50
|
+
text-shadow: none;
|
|
51
|
+
text-transform: none;
|
|
52
|
+
transition-delay: 0s, 0s;
|
|
53
|
+
transition-duration: 0.45s, 0.45s;
|
|
54
|
+
transition-property: box-shadow, border-color;
|
|
55
|
+
transition-timing-function: ease, ease-in-out;
|
|
56
|
+
width: 100%;
|
|
57
|
+
word-spacing: 0px;
|
|
58
|
+
writing-mode: lr-tb;
|
data/lib/ama_layout/version.rb
CHANGED
|
@@ -14,7 +14,7 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
|
14
14
|
expect(moneris_presenter.textbox).to include "-webkit-user-select: text;"
|
|
15
15
|
expect(moneris_presenter.textbox).to include "-webkit-writing-mode: horizontal-tb;"
|
|
16
16
|
expect(moneris_presenter.textbox).to include "background-color: rgb(255, 255, 255);"
|
|
17
|
-
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(
|
|
17
|
+
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(160, 160, 161);"
|
|
18
18
|
expect(moneris_presenter.textbox).to include "border-bottom-style: solid;"
|
|
19
19
|
expect(moneris_presenter.textbox).to include "border-bottom-width: 2px;"
|
|
20
20
|
expect(moneris_presenter.textbox).to include "border-image-outset: 0px;"
|
|
@@ -22,13 +22,13 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
|
22
22
|
expect(moneris_presenter.textbox).to include "border-image-slice: 100%;"
|
|
23
23
|
expect(moneris_presenter.textbox).to include "border-image-source: none;"
|
|
24
24
|
expect(moneris_presenter.textbox).to include "border-image-width: 1;"
|
|
25
|
-
expect(moneris_presenter.textbox).to include "border-left-color: rgb(
|
|
25
|
+
expect(moneris_presenter.textbox).to include "border-left-color: rgb(160, 160, 161)"
|
|
26
26
|
expect(moneris_presenter.textbox).to include "border-left-style: solid;"
|
|
27
27
|
expect(moneris_presenter.textbox).to include "border-left-width: 2px;"
|
|
28
|
-
expect(moneris_presenter.textbox).to include "border-right-color: rgb(
|
|
28
|
+
expect(moneris_presenter.textbox).to include "border-right-color: rgb(160, 160, 161)"
|
|
29
29
|
expect(moneris_presenter.textbox).to include "border-right-style: solid;"
|
|
30
30
|
expect(moneris_presenter.textbox).to include "border-right-width: 2px;"
|
|
31
|
-
expect(moneris_presenter.textbox).to include "border-top-color: rgb(
|
|
31
|
+
expect(moneris_presenter.textbox).to include "border-top-color: rgb(160, 160, 161)"
|
|
32
32
|
expect(moneris_presenter.textbox).to include "border-top-style: solid;"
|
|
33
33
|
expect(moneris_presenter.textbox).to include "border-top-width: 2px;"
|
|
34
34
|
expect(moneris_presenter.textbox).to include "box-shadow: none;"
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
describe AmaLayout::Moneris do
|
|
4
|
+
describe '#textbox_style_file' do
|
|
5
|
+
around(:each) do |example|
|
|
6
|
+
current_version = Rails.configuration.stylesheet_resolver.version
|
|
7
|
+
Rails.configuration.stylesheet_resolver.version = version
|
|
8
|
+
example.run
|
|
9
|
+
Rails.configuration.stylesheet_resolver.version = current_version
|
|
10
|
+
end
|
|
11
|
+
context 'v2' do
|
|
12
|
+
let(:version) { 'v2' }
|
|
13
|
+
|
|
14
|
+
it 'returns the correct file path' do
|
|
15
|
+
expect(subject.textbox_style_file).to include("lib/ama_layout/moneris/#{version}/textbox.txt")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
context 'v3' do
|
|
20
|
+
let(:version) { 'v3' }
|
|
2
21
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
22
|
+
it 'returns the correct file path' do
|
|
23
|
+
expect(subject.textbox_style_file).to include("lib/ama_layout/moneris/#{version}/textbox.txt")
|
|
24
|
+
end
|
|
6
25
|
end
|
|
7
26
|
end
|
|
8
27
|
end
|
|
@@ -1,159 +1,161 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
describe AmaLayoutContentHelper do
|
|
2
|
-
let(:greeting) {
|
|
3
|
-
let(:site_name) {
|
|
4
|
-
let(:site_domain) {
|
|
4
|
+
let(:greeting) { 'DJ Funky Fresh' }
|
|
5
|
+
let(:site_name) { 'Waffle Emporium' }
|
|
6
|
+
let(:site_domain) { 'http://waffleemporium.ca' }
|
|
5
7
|
let(:site_url) { "#{site_domain}/wafflesauce" }
|
|
6
8
|
let(:nav_item) { FactoryBot.build(:navigation_item) }
|
|
7
9
|
|
|
8
|
-
describe
|
|
9
|
-
it
|
|
10
|
+
describe '#greeting' do
|
|
11
|
+
it 'returns the greeting set in the domain cookie' do
|
|
10
12
|
helper.request.cookies[:logged_in_meta] = greeting
|
|
11
13
|
expect(helper.greeting).to eq greeting
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
describe
|
|
16
|
-
it
|
|
17
|
+
describe '#utm_source' do
|
|
18
|
+
it 'returns the downcased character-only representation of the site name' do
|
|
17
19
|
allow(Rails.configuration).to receive(:site_name).and_return(site_name)
|
|
18
|
-
expect(helper.utm_source).to eq site_name.downcase.gsub(/\W/,
|
|
20
|
+
expect(helper.utm_source).to eq site_name.downcase.gsub(/\W/, '')
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
|
|
22
|
-
describe
|
|
23
|
-
it
|
|
24
|
+
describe '#active_section' do
|
|
25
|
+
it 'returns active if request include the path' do
|
|
24
26
|
allow_any_instance_of(ActionController::TestRequest).to receive(:fullpath).and_return("#{site_domain}/gotica")
|
|
25
|
-
expect(helper.active_section(nav_item)).to eq
|
|
27
|
+
expect(helper.active_section(nav_item)).to eq 'activepage'
|
|
26
28
|
end
|
|
27
29
|
|
|
28
|
-
it
|
|
30
|
+
it 'returns nil if request does not include the path' do
|
|
29
31
|
expect(helper.active_section(nav_item)).to eq nil
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
|
|
33
|
-
describe
|
|
35
|
+
describe '#active_page' do
|
|
34
36
|
before(:each) do
|
|
35
37
|
allow(helper.request).to receive(:fullpath).and_return(site_url)
|
|
36
38
|
end
|
|
37
39
|
|
|
38
|
-
it
|
|
39
|
-
expect(helper.active_page(site_url)).to eq
|
|
40
|
+
it 'returns active if the given path matches the request path' do
|
|
41
|
+
expect(helper.active_page(site_url)).to eq 'activepage'
|
|
40
42
|
end
|
|
41
43
|
|
|
42
|
-
it
|
|
43
|
-
expect(helper.active_page(
|
|
44
|
+
it 'returns nothing if the given patch does not match the request path' do
|
|
45
|
+
expect(helper.active_page('http://waffleemporium.ca/ecuaselffaw')).to be_nil
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
|
|
47
|
-
describe
|
|
49
|
+
describe '#active_domain' do
|
|
48
50
|
before(:each) do
|
|
49
51
|
allow(helper.request).to receive(:url).and_return(site_url)
|
|
50
52
|
end
|
|
51
53
|
|
|
52
|
-
it
|
|
53
|
-
expect(helper.active_domain(site_domain)).to eq
|
|
54
|
+
it 'returns active if the request domain matches the given domain' do
|
|
55
|
+
expect(helper.active_domain(site_domain)).to eq 'active'
|
|
54
56
|
end
|
|
55
57
|
|
|
56
|
-
it
|
|
57
|
-
expect(helper.active_domain(
|
|
58
|
+
it 'returns nothing if the request domain does not match the given domain' do
|
|
59
|
+
expect(helper.active_domain('http://pancakeemporium.ca')).to be_nil
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
|
|
61
|
-
describe
|
|
62
|
-
it
|
|
63
|
-
expect(helper.renew_or_join_path(true)).to eq
|
|
63
|
+
describe '#renew_or_join_path' do
|
|
64
|
+
it 'returns nothing if the visitor is logged in' do
|
|
65
|
+
expect(helper.renew_or_join_path(true)).to eq ''
|
|
64
66
|
end
|
|
65
67
|
|
|
66
|
-
it
|
|
67
|
-
expect(helper.renew_or_join_path(false)).to include
|
|
68
|
+
it 'returns the join link if the visitor is not logged in' do
|
|
69
|
+
expect(helper.renew_or_join_path(false)).to include 'Become a Member'
|
|
68
70
|
end
|
|
69
71
|
end
|
|
70
72
|
|
|
71
|
-
describe
|
|
72
|
-
it
|
|
73
|
-
expect(helper.gift_or_pricing_path(true)).to eq
|
|
73
|
+
describe '#gift_or_pricing_path' do
|
|
74
|
+
it 'returns nothing if the visitor is logged in' do
|
|
75
|
+
expect(helper.gift_or_pricing_path(true)).to eq ''
|
|
74
76
|
end
|
|
75
77
|
|
|
76
|
-
it
|
|
77
|
-
expect(helper.gift_or_pricing_path(false)).to include
|
|
78
|
+
it 'returns the gift link if the visitor is not logged in' do
|
|
79
|
+
expect(helper.gift_or_pricing_path(false)).to include 'Gift Membership'
|
|
78
80
|
end
|
|
79
81
|
end
|
|
80
82
|
|
|
81
|
-
describe
|
|
83
|
+
describe '#dropdown_menu' do
|
|
82
84
|
let(:render_args) do
|
|
83
|
-
{ partial:
|
|
85
|
+
{ partial: 'ama_layout/v3/dropdown_menu', locals: { logged_in: true, greeting: greeting } }
|
|
84
86
|
end
|
|
85
87
|
|
|
86
|
-
it
|
|
88
|
+
it 'renders the dropdown menu if the visitor is logged in' do
|
|
87
89
|
expect(helper).to receive(:render).with(render_args)
|
|
88
90
|
helper.dropdown_menu(true, greeting)
|
|
89
91
|
end
|
|
90
92
|
|
|
91
|
-
it
|
|
92
|
-
expect(helper.dropdown_menu(false, greeting)).to eq
|
|
93
|
+
it 'does not render the dropdown menu if the visitor is not logged in' do
|
|
94
|
+
expect(helper.dropdown_menu(false, greeting)).to eq ''
|
|
93
95
|
end
|
|
94
96
|
end
|
|
95
97
|
|
|
96
|
-
describe
|
|
98
|
+
describe '#tablet_menu' do
|
|
97
99
|
let(:render_args) do
|
|
98
|
-
{ partial:
|
|
100
|
+
{ partial: 'ama_layout/v3/tablet_menu', locals: { logged_in: true, greeting: greeting } }
|
|
99
101
|
end
|
|
100
102
|
|
|
101
|
-
it
|
|
103
|
+
it 'renders the tablet menu if the visitor is logged in' do
|
|
102
104
|
expect(helper).to receive(:render).with(render_args)
|
|
103
105
|
helper.tablet_menu(true, greeting)
|
|
104
106
|
end
|
|
105
107
|
|
|
106
|
-
it
|
|
107
|
-
expect(helper.tablet_menu(false, greeting)).to eq
|
|
108
|
+
it 'does not render the tablet menu if the visitor is not logged in' do
|
|
109
|
+
expect(helper.tablet_menu(false, greeting)).to eq ''
|
|
108
110
|
end
|
|
109
111
|
end
|
|
110
112
|
|
|
111
|
-
describe
|
|
112
|
-
it
|
|
113
|
-
expect(helper).to receive(:render).with(
|
|
113
|
+
describe '#tablet_signout' do
|
|
114
|
+
it 'renders a signout link if the visitor is logged in' do
|
|
115
|
+
expect(helper).to receive(:render).with('ama_layout/v3/tablet_signout')
|
|
114
116
|
helper.tablet_signout(true)
|
|
115
117
|
end
|
|
116
118
|
|
|
117
|
-
it
|
|
118
|
-
expect(helper.tablet_signout(false)).to eq
|
|
119
|
+
it 'does not render the tablet menu if the visitor is not logged in' do
|
|
120
|
+
expect(helper.tablet_signout(false)).to eq ''
|
|
119
121
|
end
|
|
120
122
|
end
|
|
121
123
|
|
|
122
|
-
describe
|
|
123
|
-
let(:message) {
|
|
124
|
+
describe '#notice' do
|
|
125
|
+
let(:message) { 'This is a notice.' }
|
|
124
126
|
|
|
125
|
-
it
|
|
126
|
-
expect(helper).to receive(:render).with partial:
|
|
127
|
+
it 'renders the notice partial if a notice is present' do
|
|
128
|
+
expect(helper).to receive(:render).with partial: 'ama_layout/v3/notice', locals: { message: message }
|
|
127
129
|
helper.notice(message)
|
|
128
130
|
end
|
|
129
131
|
|
|
130
|
-
it
|
|
132
|
+
it 'does not render the notice partial if a notice is not present' do
|
|
131
133
|
expect(helper.notice(nil)).to be_nil
|
|
132
134
|
end
|
|
133
135
|
end
|
|
134
136
|
|
|
135
|
-
describe
|
|
136
|
-
let(:message) {
|
|
137
|
+
describe '#alert' do
|
|
138
|
+
let(:message) { 'This is an alert.' }
|
|
137
139
|
|
|
138
|
-
it
|
|
139
|
-
expect(helper).to receive(:render).with partial:
|
|
140
|
+
it 'renders the alert partial if a alert is present' do
|
|
141
|
+
expect(helper).to receive(:render).with partial: 'ama_layout/v3/alert', locals: { message: message }
|
|
140
142
|
helper.alert(message)
|
|
141
143
|
end
|
|
142
144
|
|
|
143
|
-
it
|
|
145
|
+
it 'does not render the alert partial if a alert is not present' do
|
|
144
146
|
expect(helper.notice(nil)).to be_nil
|
|
145
147
|
end
|
|
146
148
|
end
|
|
147
149
|
|
|
148
|
-
describe
|
|
149
|
-
let(:message) {
|
|
150
|
+
describe '#success_message' do
|
|
151
|
+
let(:message) { 'This is a success message' }
|
|
150
152
|
|
|
151
|
-
it
|
|
152
|
-
expect(helper).to receive(:render).with partial:
|
|
153
|
+
it 'renders the success partial if a success message is present' do
|
|
154
|
+
expect(helper).to receive(:render).with partial: 'ama_layout/v3/success', locals: { message: message }
|
|
153
155
|
helper.success_message(message)
|
|
154
156
|
end
|
|
155
157
|
|
|
156
|
-
it
|
|
158
|
+
it 'does not render the success partial if the success message is not present' do
|
|
157
159
|
expect(helper.success_message(nil)).to be_nil
|
|
158
160
|
end
|
|
159
161
|
end
|