ama_layout 7.0.pre → 7.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 +4 -4
- data/ama_layout.gemspec +1 -1
- data/app/helpers/ama_layout_path_helper.rb +1 -1
- data/app/views/ama_layout/_siteheader.html.erb +4 -4
- data/app/views/ama_layout/agent/_sidebar.html.erb +8 -0
- data/app/views/ama_layout/agent/_siteheader.html.erb +38 -0
- data/app/views/ama_layout/agent/_top_nav.html.erb +6 -0
- data/lib/ama_layout.rb +3 -1
- data/lib/ama_layout/agent/navigation.rb +36 -0
- data/lib/ama_layout/agent_navigation.yml +14 -0
- data/lib/ama_layout/ama_layout_view.rb +16 -0
- data/lib/ama_layout/decorators/agent/navigation_decorator.rb +35 -0
- data/lib/ama_layout/decorators/navigation_decorator.rb +2 -2
- data/lib/ama_layout/draper_replacement.rb +3 -3
- data/lib/ama_layout/version.rb +1 -1
- data/spec/agent/navigation_spec.rb +85 -0
- data/spec/ama_layout/decorators/agent/navigation_decorator_spec.rb +85 -0
- data/spec/ama_layout/decorators/navigation_decorator_spec.rb +20 -5
- data/spec/ama_layout/decorators/navigation_item_decorator_spec.rb +4 -2
- data/spec/ama_layout/fixtures/agent_navigation.yml +3 -0
- data/spec/factories/agent_navigation.rb +5 -0
- data/spec/support/helpers/attach_methods_sample.rb +7 -0
- metadata +25 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3ca2feaab21a5bf26eb756b0e47f33f9062e894b
|
|
4
|
+
data.tar.gz: 39d8c33eb56c90afd51ca405542493fbf5e33e31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 08711a7f214bccc53a373fc1dee33ee8da8999b5282d86b8809b412519532f2a942a0c00f2a753eb8c63b82a8465a26af8ccd0d9df4a986d8d3df98098b7cd40
|
|
7
|
+
data.tar.gz: 9fd1f9eb34ed8e3340a81de82a9693024ce14476441589cafbc327c8778fd59875c939d1a74a16789dd4cfb7c7503e7f5e857daeda1a66b395dcde6f90a84e84
|
data/ama_layout.gemspec
CHANGED
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_dependency 'foundation-rails', '>= 6.4.1.2'
|
|
22
22
|
spec.add_dependency 'rails', '>= 4.2'
|
|
23
23
|
spec.add_dependency 'browser', '~> 2.0'
|
|
24
|
-
spec.add_dependency 'breadcrumbs_on_rails', '
|
|
24
|
+
spec.add_dependency 'breadcrumbs_on_rails', '>= 3'
|
|
25
25
|
spec.add_dependency 'redis-rails'
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
|
27
27
|
spec.add_development_dependency 'rake', '>= 11.0'
|
|
@@ -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"),
|
|
4
|
+
<%= link_to(image_tag("ama-logo.png"), Rails.configuration.amaabca_site, class: "title-bar__logo") %>
|
|
5
5
|
<a href="#" data-toggle="offCanvasRight" data-notifications-toggle>
|
|
6
6
|
<i class="fa fa-2x fa-bell notification__icon"></i>
|
|
7
7
|
<%= navigation.notification_badge %>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
<div class="top-bar" id="main-menu">
|
|
11
11
|
<div class="top-bar-left">
|
|
12
|
-
<%= link_to(image_tag("ama-logo.png", class: "top-bar__logo"),
|
|
12
|
+
<%= link_to(image_tag("ama-logo.png", class: "top-bar__logo"), Rails.configuration.amaabca_site) %>
|
|
13
13
|
</div>
|
|
14
14
|
<div class="top-bar-right">
|
|
15
15
|
<ul class="menu" data-responsive-menu="drilldown medium-dropdown">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<li>
|
|
21
21
|
<a href="<%= Rails.configuration.amaabca_site %>/membership/contact-us--centre-locations-hours-and-contact-information">Contact Us</a>
|
|
22
22
|
</li>
|
|
23
|
-
<%= navigation.account_toggle %>
|
|
23
|
+
<%= navigation.account_toggle(self) %>
|
|
24
24
|
<%= navigation.top_nav %>
|
|
25
25
|
</ul>
|
|
26
26
|
</div>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<h2 class="side-nav__header">Online Account</h2>
|
|
31
31
|
<div class="side-nav__content">
|
|
32
32
|
<ul class="side-nav__list">
|
|
33
|
-
<%= navigation.account_toggle %>
|
|
33
|
+
<%= navigation.account_toggle(self) %>
|
|
34
34
|
<%= render partial: "ama_layout/main_nav_item", collection: navigation.items, as: :nav_item %>
|
|
35
35
|
<li class="side-nav__item">
|
|
36
36
|
<a class="side-nav__link" href="<%= Rails.configuration.amaabca_site %>">AMA Website</a>
|
|
@@ -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,38 @@
|
|
|
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
|
+
</div>
|
|
6
|
+
<div class="top-bar" id="main-menu">
|
|
7
|
+
<div class="top-bar-left">
|
|
8
|
+
<%= link_to(image_tag("ama-logo.png", class: "top-bar__logo"), Rails.configuration.amaabca_site) %>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="top-bar-right">
|
|
11
|
+
<ul class="menu" data-responsive-menu="drilldown medium-dropdown">
|
|
12
|
+
<li>
|
|
13
|
+
<a href="https://albertamotorassociation.zendesk.com/hc/en-us" target="_blank">Help</a>
|
|
14
|
+
</li>
|
|
15
|
+
<%= navigation.top_nav %>
|
|
16
|
+
</ul>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="off-canvas position-left" id="offCanvasLeft" data-off-canvas>
|
|
21
|
+
<h2 class="side-nav__header">Online Account</h2>
|
|
22
|
+
<div class="side-nav__content">
|
|
23
|
+
<ul class="side-nav__list">
|
|
24
|
+
<%= render partial: "ama_layout/main_nav_item", collection: navigation.items, as: :nav_item %>
|
|
25
|
+
<%= navigation.sign_out_link %>
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="javascript_errors error_notification" hidden></div>
|
|
30
|
+
<noscript>
|
|
31
|
+
<div class="mt1 large-12 columns text-center error_notification">
|
|
32
|
+
<h2 class="mt1">There seems to be an issue with your browser.</h2>
|
|
33
|
+
<h5>Javascript is disabled in your web browser.</h5>
|
|
34
|
+
<div class='fieldset text-center small mb1 block'>
|
|
35
|
+
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>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</noscript>
|
data/lib/ama_layout.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'foundation-rails'
|
|
|
4
4
|
require 'browser'
|
|
5
5
|
require 'breadcrumbs_on_rails'
|
|
6
6
|
require 'redis-rails'
|
|
7
|
+
require 'ama_layout/ama_layout_view'
|
|
7
8
|
require 'ama_layout/draper_replacement'
|
|
8
9
|
require 'ama_layout/breadcrumb_builder'
|
|
9
10
|
require 'ama_layout/moneris'
|
|
@@ -21,11 +22,12 @@ require 'ama_layout/decorators/notification_decorator'
|
|
|
21
22
|
require 'ama_layout/notification_scrubber'
|
|
22
23
|
require 'ama_layout/notification_set'
|
|
23
24
|
require 'ama_layout/notifications'
|
|
25
|
+
require 'ama_layout/agent/navigation'
|
|
26
|
+
require 'ama_layout/decorators/agent/navigation_decorator'
|
|
24
27
|
|
|
25
28
|
module AmaLayout
|
|
26
29
|
class Engine < Rails::Engine
|
|
27
30
|
initializer('ama_layout') do
|
|
28
|
-
Rails.configuration.view_paths = File.join(self.root, 'app', 'views')
|
|
29
31
|
I18n.load_path << File.join(self.root, 'app', 'config', 'locales', 'en.yml')
|
|
30
32
|
::ActionController::Base.send :include, AmaLayout::ActionController
|
|
31
33
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module AmaLayout
|
|
2
|
+
module Agent
|
|
3
|
+
class Navigation
|
|
4
|
+
include ActiveModel::Model
|
|
5
|
+
|
|
6
|
+
def decorate
|
|
7
|
+
AmaLayout::Agent::NavigationDecorator.new(self)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
attr_accessor :user, :current_url, :nav_file_path, :display_name
|
|
11
|
+
|
|
12
|
+
def initialize(args = {})
|
|
13
|
+
args = defaults.merge args
|
|
14
|
+
super
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def items
|
|
18
|
+
navigation_items.map do |n|
|
|
19
|
+
NavigationItem.new n.merge({ current_url: current_url})
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def navigation_items
|
|
24
|
+
YAML.load ERB.new(File.read nav_file_path).result
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def defaults
|
|
30
|
+
{
|
|
31
|
+
nav_file_path: File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "lib", "ama_layout", "agent_navigation.yml")
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module AmaLayout
|
|
2
|
+
class AmaLayoutView < ActionView::Base
|
|
3
|
+
attr_accessor :view_data
|
|
4
|
+
|
|
5
|
+
def initialize(args)
|
|
6
|
+
self.view_data = args[:view_data]
|
|
7
|
+
controller = view_data.try(:controller) || ::ApplicationController.new
|
|
8
|
+
context = controller.view_paths
|
|
9
|
+
super(context, {}, controller)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def method_missing(method, *args, &block)
|
|
13
|
+
view_data.send(method, *args, &block)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module AmaLayout
|
|
2
|
+
module Agent
|
|
3
|
+
class NavigationDecorator
|
|
4
|
+
include AmaLayout::DraperReplacement
|
|
5
|
+
extend AmaLayout::DraperReplacement
|
|
6
|
+
|
|
7
|
+
def items
|
|
8
|
+
object.items.map(&:decorate)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def display_name_text
|
|
12
|
+
"Welcome, #{display_name.titleize}#{cash_drawer_name}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def sign_out_link
|
|
16
|
+
return "" unless user
|
|
17
|
+
h.render partial: "ama_layout/sign_out_link"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def top_nav
|
|
21
|
+
return "" unless user
|
|
22
|
+
h.render partial: "ama_layout/agent/top_nav", locals: { navigation: self }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def sidebar
|
|
26
|
+
return "" unless user
|
|
27
|
+
h.render partial: "ama_layout/sidebar", locals: { navigation: self }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def cash_drawer_name
|
|
31
|
+
user.cash_drawers.any? ? " - #{user.cash_drawers.last.name}" : ''
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -28,8 +28,8 @@ module AmaLayout
|
|
|
28
28
|
display_name.present? ? "Welcome, #{display_name.titleize}" : email
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def account_toggle
|
|
32
|
-
h.render partial: "account_toggle"
|
|
31
|
+
def account_toggle(view_data = {})
|
|
32
|
+
h(view_data).render partial: "account_toggle"
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def notifications
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module AmaLayout
|
|
2
2
|
module DraperReplacement
|
|
3
|
-
attr_accessor :object
|
|
3
|
+
attr_accessor :object, :controller
|
|
4
4
|
|
|
5
|
-
def h
|
|
6
|
-
|
|
5
|
+
def h(view_data = {})
|
|
6
|
+
AmaLayoutView.new(view_data: view_data)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def initialize(args = {})
|
data/lib/ama_layout/version.rb
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
describe AmaLayout::Agent::Navigation do
|
|
2
|
+
describe "#nav_file_path" do
|
|
3
|
+
let(:file_path) { File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "lib", "ama_layout", "agent_navigation.yml") }
|
|
4
|
+
|
|
5
|
+
it "defaults to lib/ama_layout/agent_navigation.yml" do
|
|
6
|
+
expect(subject.nav_file_path).to eq file_path
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
context "overridden file path" do
|
|
10
|
+
let(:file_path) do
|
|
11
|
+
File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "spec", "ama_layout", "fixtures", "agent_navigation.yml")
|
|
12
|
+
end
|
|
13
|
+
let(:user) { double("user") }
|
|
14
|
+
let(:subject) { described_class.new(user: user, nav_file_path: file_path, current_url: '/') }
|
|
15
|
+
|
|
16
|
+
it "uses the overridden file path" do
|
|
17
|
+
expect(subject.items.first.text).to eq "Waffles"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "#items" do
|
|
23
|
+
it "does not remove nil #navigation_items" do
|
|
24
|
+
expect(subject.items.collect(&:alt)).to include nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "displays links" do
|
|
28
|
+
expect(subject.items.collect(&:link)).to eq subject.navigation_items.collect {|i| i["link"] }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "contains text" do
|
|
32
|
+
expect(subject.items.collect(&:text)).to eq subject.navigation_items.collect {|i| i["text"] }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "contains icons" do
|
|
36
|
+
expect(subject.items.collect(&:icon)).to eq subject.navigation_items.collect {|i| i["icon"] }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "contains alt text" do
|
|
40
|
+
expect(subject.items.collect(&:alt)).to eq subject.navigation_items.collect {|i| i["alt"] }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context "customer lookup" do
|
|
44
|
+
context "main nav" do
|
|
45
|
+
it "return the main nav items" do
|
|
46
|
+
expect(subject.items[0].text).to eq "Customer Lookup"
|
|
47
|
+
expect(subject.items[0].link).to eq ""
|
|
48
|
+
expect(subject.items[0].icon).to eq ""
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context "driver education" do
|
|
54
|
+
context "main nav" do
|
|
55
|
+
it "return the main nav items" do
|
|
56
|
+
expect(subject.items[1].text).to eq "Driver Education"
|
|
57
|
+
expect(subject.items[1].link).to eq ""
|
|
58
|
+
expect(subject.items[1].icon).to eq "fa-car"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
context "subnavs" do
|
|
63
|
+
let(:driver_education_subnav) { subject.items[1].sub_nav }
|
|
64
|
+
|
|
65
|
+
it "return the subnav items" do
|
|
66
|
+
expect(driver_education_subnav[0].text).to eq "Purchase Course"
|
|
67
|
+
expect(driver_education_subnav[0].link).to eq ""
|
|
68
|
+
|
|
69
|
+
expect(driver_education_subnav[1].text).to eq "Admin Tasks"
|
|
70
|
+
expect(driver_education_subnav[1].link).to eq ""
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
context "cashout" do
|
|
76
|
+
context "main nav" do
|
|
77
|
+
it "return the main nav items" do
|
|
78
|
+
expect(subject.items[2].text).to eq "Cashout"
|
|
79
|
+
expect(subject.items[2].link).to eq ""
|
|
80
|
+
expect(subject.items[2].icon).to eq ""
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
describe AmaLayout::Agent::NavigationDecorator do
|
|
2
|
+
let(:name) { "John D" }
|
|
3
|
+
let(:cash_drawer) { OpenStruct.new(name: 'Edmonton Main') }
|
|
4
|
+
let(:user) { OpenStruct.new(email: 'john.doe@test.com', cash_drawers: [cash_drawer]) }
|
|
5
|
+
let(:navigation) { FactoryGirl.build(:agent_navigation, user: user, display_name: name) }
|
|
6
|
+
let(:navigation_presenter) { navigation.decorate }
|
|
7
|
+
|
|
8
|
+
describe "#display_name_text" do
|
|
9
|
+
context "user does have a cash drawer" do
|
|
10
|
+
it "is part of the welcome message" do
|
|
11
|
+
expect(navigation_presenter.display_name_text).to eq "Welcome, John D - Edmonton Main"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context "the user does not have a cash drawer" do
|
|
15
|
+
let(:cash_drawer) { nil }
|
|
16
|
+
it "is not part of the welcome message" do
|
|
17
|
+
expect(navigation_presenter.display_name_text).to eq "Welcome, John D"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "#items" do
|
|
24
|
+
it "returns an array of navigation items" do
|
|
25
|
+
expect(navigation_presenter.items).to be_an Array
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "array contains decorated navigation items" do
|
|
29
|
+
items = navigation_presenter.items
|
|
30
|
+
items.each do |i|
|
|
31
|
+
expect(i).to be_a AmaLayout::NavigationItemDecorator
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe "#sign_out_link" do
|
|
37
|
+
context "with user" do
|
|
38
|
+
it "returns link" do
|
|
39
|
+
expect(navigation_presenter.sign_out_link).to include "Sign Out"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context "without user" do
|
|
44
|
+
let(:user) { nil }
|
|
45
|
+
|
|
46
|
+
it "does not return the link" do
|
|
47
|
+
expect(navigation_presenter.sign_out_link).to eq ""
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe "#top_nav" do
|
|
53
|
+
context "with user" do
|
|
54
|
+
it "renders the partial" do
|
|
55
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
56
|
+
expect(navigation_presenter.top_nav).to eq "render"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context "without user" do
|
|
61
|
+
let(:user) { nil }
|
|
62
|
+
|
|
63
|
+
it "does not renders the partial" do
|
|
64
|
+
expect(navigation_presenter.top_nav).to eq ''
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe "#sidebar" do
|
|
70
|
+
context "with user" do
|
|
71
|
+
it "renders the partial" do
|
|
72
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
73
|
+
expect(navigation_presenter.sidebar).to eq "render"
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
context "without user" do
|
|
78
|
+
let(:user) { nil }
|
|
79
|
+
|
|
80
|
+
it "does not renders the partial" do
|
|
81
|
+
expect(navigation_presenter.sidebar).to eq ''
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -94,9 +94,8 @@ describe AmaLayout::NavigationDecorator do
|
|
|
94
94
|
context "with items" do
|
|
95
95
|
it "renders the partial" do
|
|
96
96
|
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
expect(navigation_presenter.top_nav).to include("AMA Road Reports", "http://auth.waffles.ca")
|
|
97
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
98
|
+
expect(navigation_presenter.top_nav).to eq "render"
|
|
100
99
|
end
|
|
101
100
|
end
|
|
102
101
|
|
|
@@ -111,7 +110,8 @@ describe AmaLayout::NavigationDecorator do
|
|
|
111
110
|
context "with items" do
|
|
112
111
|
it "renders the partial" do
|
|
113
112
|
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
|
114
|
-
|
|
113
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
114
|
+
expect(navigation_presenter.sidebar).to eq "render"
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -125,7 +125,22 @@ describe AmaLayout::NavigationDecorator do
|
|
|
125
125
|
context "account toggle" do
|
|
126
126
|
it "in ama_layout it renders a blank partial" do
|
|
127
127
|
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
|
128
|
-
|
|
128
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
129
|
+
expect(navigation_presenter.account_toggle).to eq "render"
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it "in ama_layout it renders a blank partial" do
|
|
133
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
|
134
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
135
|
+
expect(navigation_presenter.account_toggle).to eq "render"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
describe "ama layout view" do
|
|
140
|
+
context "needed to allow rendering based on the view main app" do
|
|
141
|
+
it "attaches additional methods to current decorator - draper is capable of the same thing" do
|
|
142
|
+
expect(navigation_presenter.h(Helpers::AttachMethodsSample.new).additional_info).to eq "Bruce Wayne"
|
|
143
|
+
end
|
|
129
144
|
end
|
|
130
145
|
end
|
|
131
146
|
|
|
@@ -39,7 +39,8 @@ describe AmaLayout::NavigationItemDecorator do
|
|
|
39
39
|
context "with items" do
|
|
40
40
|
it "renders the partial" do
|
|
41
41
|
navigation_item.sub_nav = items
|
|
42
|
-
|
|
42
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
43
|
+
expect(navigation_item_presenter.top_sub_nav).to eq "render"
|
|
43
44
|
end
|
|
44
45
|
end
|
|
45
46
|
|
|
@@ -54,7 +55,8 @@ describe AmaLayout::NavigationItemDecorator do
|
|
|
54
55
|
context "with items" do
|
|
55
56
|
it "renders the partial" do
|
|
56
57
|
navigation_item.sub_nav = items
|
|
57
|
-
|
|
58
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
|
|
59
|
+
expect(navigation_item_presenter.sidebar_sub_nav).to eq "render"
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
|
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: 7.0.
|
|
4
|
+
version: 7.0.1
|
|
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-08-
|
|
21
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
|
22
22
|
dependencies:
|
|
23
23
|
- !ruby/object:Gem::Dependency
|
|
24
24
|
name: foundation-rails
|
|
@@ -66,16 +66,16 @@ dependencies:
|
|
|
66
66
|
name: breadcrumbs_on_rails
|
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements:
|
|
69
|
-
- - "
|
|
69
|
+
- - ">="
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
|
-
version: 3
|
|
71
|
+
version: '3'
|
|
72
72
|
type: :runtime
|
|
73
73
|
prerelease: false
|
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
|
75
75
|
requirements:
|
|
76
|
-
- - "
|
|
76
|
+
- - ">="
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: 3
|
|
78
|
+
version: '3'
|
|
79
79
|
- !ruby/object:Gem::Dependency
|
|
80
80
|
name: redis-rails
|
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -287,11 +287,18 @@ files:
|
|
|
287
287
|
- app/views/ama_layout/_top_nav.html.erb
|
|
288
288
|
- app/views/ama_layout/_top_sub_nav.html.erb
|
|
289
289
|
- app/views/ama_layout/_top_sub_nav_item.html.erb
|
|
290
|
+
- app/views/ama_layout/agent/_sidebar.html.erb
|
|
291
|
+
- app/views/ama_layout/agent/_siteheader.html.erb
|
|
292
|
+
- app/views/ama_layout/agent/_top_nav.html.erb
|
|
290
293
|
- app/views/application/_account_toggle.html.erb
|
|
291
294
|
- config/routes.rb
|
|
292
295
|
- lib/ama_layout.rb
|
|
296
|
+
- lib/ama_layout/agent/navigation.rb
|
|
297
|
+
- lib/ama_layout/agent_navigation.yml
|
|
298
|
+
- lib/ama_layout/ama_layout_view.rb
|
|
293
299
|
- lib/ama_layout/breadcrumb_builder.rb
|
|
294
300
|
- lib/ama_layout/controllers/action_controller.rb
|
|
301
|
+
- lib/ama_layout/decorators/agent/navigation_decorator.rb
|
|
295
302
|
- lib/ama_layout/decorators/moneris_decorator.rb
|
|
296
303
|
- lib/ama_layout/decorators/navigation_decorator.rb
|
|
297
304
|
- lib/ama_layout/decorators/navigation_item_decorator.rb
|
|
@@ -310,13 +317,16 @@ files:
|
|
|
310
317
|
- lib/ama_layout/notifications/abstract_store.rb
|
|
311
318
|
- lib/ama_layout/notifications/redis_store.rb
|
|
312
319
|
- lib/ama_layout/version.rb
|
|
320
|
+
- spec/agent/navigation_spec.rb
|
|
313
321
|
- spec/ama_layout/breadcrumb_builder_spec.rb
|
|
314
322
|
- spec/ama_layout/controllers/ama_layout/api/v1/notifications_controller_spec.rb
|
|
315
323
|
- spec/ama_layout/controllers/pages_controller_spec.rb
|
|
324
|
+
- spec/ama_layout/decorators/agent/navigation_decorator_spec.rb
|
|
316
325
|
- spec/ama_layout/decorators/moneris_decorator_spec.rb
|
|
317
326
|
- spec/ama_layout/decorators/navigation_decorator_spec.rb
|
|
318
327
|
- spec/ama_layout/decorators/navigation_item_decorator_spec.rb
|
|
319
328
|
- spec/ama_layout/decorators/notification_decorator_spec.rb
|
|
329
|
+
- spec/ama_layout/fixtures/agent_navigation.yml
|
|
320
330
|
- spec/ama_layout/fixtures/navigation.yml
|
|
321
331
|
- spec/ama_layout/fixtures/real_date_picker.html
|
|
322
332
|
- spec/ama_layout/javascripts/real_date_picker_spec.coffee
|
|
@@ -330,6 +340,7 @@ files:
|
|
|
330
340
|
- spec/ama_layout/notifications/abstract_store_spec.rb
|
|
331
341
|
- spec/ama_layout/notifications/redis_store_spec.rb
|
|
332
342
|
- spec/ama_layout/notifications_spec.rb
|
|
343
|
+
- spec/factories/agent_navigation.rb
|
|
333
344
|
- spec/factories/navigation.rb
|
|
334
345
|
- spec/factories/navigation_item.rb
|
|
335
346
|
- spec/factories/users.rb
|
|
@@ -344,6 +355,7 @@ files:
|
|
|
344
355
|
- spec/internal/log/.gitignore
|
|
345
356
|
- spec/internal/public/favicon.ico
|
|
346
357
|
- spec/spec_helper.rb
|
|
358
|
+
- spec/support/helpers/attach_methods_sample.rb
|
|
347
359
|
- spec/support/shared_examples/member_navigation.rb
|
|
348
360
|
homepage: https://github.com/amaabca/ama_layout
|
|
349
361
|
licenses:
|
|
@@ -360,9 +372,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
360
372
|
version: '0'
|
|
361
373
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
374
|
requirements:
|
|
363
|
-
- - "
|
|
375
|
+
- - ">="
|
|
364
376
|
- !ruby/object:Gem::Version
|
|
365
|
-
version:
|
|
377
|
+
version: '0'
|
|
366
378
|
requirements: []
|
|
367
379
|
rubyforge_project:
|
|
368
380
|
rubygems_version: 2.5.1
|
|
@@ -370,13 +382,16 @@ signing_key:
|
|
|
370
382
|
specification_version: 4
|
|
371
383
|
summary: ".ama.ab.ca site layouts"
|
|
372
384
|
test_files:
|
|
385
|
+
- spec/agent/navigation_spec.rb
|
|
373
386
|
- spec/ama_layout/breadcrumb_builder_spec.rb
|
|
374
387
|
- spec/ama_layout/controllers/ama_layout/api/v1/notifications_controller_spec.rb
|
|
375
388
|
- spec/ama_layout/controllers/pages_controller_spec.rb
|
|
389
|
+
- spec/ama_layout/decorators/agent/navigation_decorator_spec.rb
|
|
376
390
|
- spec/ama_layout/decorators/moneris_decorator_spec.rb
|
|
377
391
|
- spec/ama_layout/decorators/navigation_decorator_spec.rb
|
|
378
392
|
- spec/ama_layout/decorators/navigation_item_decorator_spec.rb
|
|
379
393
|
- spec/ama_layout/decorators/notification_decorator_spec.rb
|
|
394
|
+
- spec/ama_layout/fixtures/agent_navigation.yml
|
|
380
395
|
- spec/ama_layout/fixtures/navigation.yml
|
|
381
396
|
- spec/ama_layout/fixtures/real_date_picker.html
|
|
382
397
|
- spec/ama_layout/javascripts/real_date_picker_spec.coffee
|
|
@@ -390,6 +405,7 @@ test_files:
|
|
|
390
405
|
- spec/ama_layout/notifications/abstract_store_spec.rb
|
|
391
406
|
- spec/ama_layout/notifications/redis_store_spec.rb
|
|
392
407
|
- spec/ama_layout/notifications_spec.rb
|
|
408
|
+
- spec/factories/agent_navigation.rb
|
|
393
409
|
- spec/factories/navigation.rb
|
|
394
410
|
- spec/factories/navigation_item.rb
|
|
395
411
|
- spec/factories/users.rb
|
|
@@ -404,4 +420,5 @@ test_files:
|
|
|
404
420
|
- spec/internal/log/.gitignore
|
|
405
421
|
- spec/internal/public/favicon.ico
|
|
406
422
|
- spec/spec_helper.rb
|
|
423
|
+
- spec/support/helpers/attach_methods_sample.rb
|
|
407
424
|
- spec/support/shared_examples/member_navigation.rb
|