ama_layout 6.10.0.pre → 7.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/PULL_REQUEST_TEMPLATE.md +10 -0
- data/ama_layout.gemspec +3 -4
- data/app/helpers/ama_layout_path_helper.rb +1 -1
- data/app/views/ama_layout/_sign_out_link.html.erb +3 -0
- data/lib/ama_layout.rb +2 -1
- data/lib/ama_layout/decorators/moneris_decorator.rb +3 -2
- data/lib/ama_layout/decorators/navigation_decorator.rb +5 -6
- data/lib/ama_layout/decorators/navigation_item_decorator.rb +3 -2
- data/lib/ama_layout/decorators/notification_decorator.rb +3 -2
- data/lib/ama_layout/draper_replacement.rb +27 -0
- data/lib/ama_layout/moneris.rb +4 -1
- data/lib/ama_layout/navigation.rb +4 -1
- data/lib/ama_layout/navigation_item.rb +4 -1
- data/lib/ama_layout/notification.rb +0 -2
- data/lib/ama_layout/version.rb +1 -1
- data/spec/ama_layout/decorators/navigation_decorator_spec.rb +7 -10
- data/spec/ama_layout/decorators/navigation_item_decorator_spec.rb +2 -4
- data/spec/spec_helper.rb +0 -2
- metadata +12 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b9a4cdafc68754b4b609a395a2a320ffd1be61
|
4
|
+
data.tar.gz: 70892459cd1d3e4b09d9304ccf2ed15a3f678611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 856dbbca7af3686fa5fd57b873c0ab448b3df411d9e1ba66abbb1a2194bb480033eb4ac4997ec6e708ad446265545a0a30e600dfd2c85c1405bf0a8303dc4600
|
7
|
+
data.tar.gz: 9fd42c8bf9c50e2e5eb01564759977b6b17e118cb7d5b8ff5c41c834bd94e4781241916f56d74fec5f1bf9e302fca19a5c728adede34214fc66a85638bb231e4
|
@@ -0,0 +1,10 @@
|
|
1
|
+
### PR Review Checklist
|
2
|
+
To be completed by the person who opens the PR. Use strikethroughs for items that are not applicable in list.
|
3
|
+
- [ ] I have reviewed my own PR to check syntax & logic, removed unnecessary/old code, made sure everything aligns with our style guide and BEM.
|
4
|
+
- [ ] I've added new components to the style guide (or have a PR in to add them).
|
5
|
+
- [ ] Any applicable version numbers have been updated.
|
6
|
+
- [ ] I've tested on mobile, tablet, and desktop, as well as across all of the browsers we support.
|
7
|
+
- [ ] I've proof-read all text for legibility, proper grammar, punctuation, and capitalization (titlecase).
|
8
|
+
- [ ] I have written a detailed PR message explaining what is being changed and why
|
9
|
+
- [ ] I’ve linked to any relevant VSTS tickets
|
10
|
+
- [ ] I’ve added the appropriate review symbols to my PR - (elephant) for dev review, (art) for design
|
data/ama_layout.gemspec
CHANGED
@@ -17,12 +17,11 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
|
+
|
20
21
|
spec.add_dependency 'foundation-rails', '>= 6.4.1.2'
|
21
|
-
spec.add_dependency 'rails', '>=
|
22
|
-
spec.add_dependency 'activemodel-serializers-xml'
|
23
|
-
spec.add_dependency 'draper', '>= 3.0.0'
|
22
|
+
spec.add_dependency 'rails', '>= 4.2'
|
24
23
|
spec.add_dependency 'browser', '~> 2.0'
|
25
|
-
spec.add_dependency 'breadcrumbs_on_rails', '
|
24
|
+
spec.add_dependency 'breadcrumbs_on_rails', '~> 3.0.1'
|
26
25
|
spec.add_dependency 'redis-rails'
|
27
26
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
28
27
|
spec.add_development_dependency 'rake', '>= 11.0'
|
data/lib/ama_layout.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'ama_layout/version'
|
2
2
|
require 'rails/all'
|
3
3
|
require 'foundation-rails'
|
4
|
-
require 'draper'
|
5
4
|
require 'browser'
|
6
5
|
require 'breadcrumbs_on_rails'
|
7
6
|
require 'redis-rails'
|
7
|
+
require 'ama_layout/draper_replacement'
|
8
8
|
require 'ama_layout/breadcrumb_builder'
|
9
9
|
require 'ama_layout/moneris'
|
10
10
|
require 'ama_layout/navigation'
|
@@ -25,6 +25,7 @@ require 'ama_layout/notifications'
|
|
25
25
|
module AmaLayout
|
26
26
|
class Engine < Rails::Engine
|
27
27
|
initializer('ama_layout') do
|
28
|
+
Rails.configuration.view_paths = File.join(self.root, 'app', 'views')
|
28
29
|
I18n.load_path << File.join(self.root, 'app', 'config', 'locales', 'en.yml')
|
29
30
|
::ActionController::Base.send :include, AmaLayout::ActionController
|
30
31
|
end
|
@@ -1,20 +1,19 @@
|
|
1
1
|
module AmaLayout
|
2
|
-
class NavigationDecorator
|
3
|
-
|
2
|
+
class NavigationDecorator
|
3
|
+
include AmaLayout::DraperReplacement
|
4
|
+
extend AmaLayout::DraperReplacement
|
4
5
|
|
5
6
|
def items
|
6
7
|
object.items.map { |i| i.decorate }
|
7
8
|
end
|
8
9
|
|
9
10
|
def display_name_text
|
10
|
-
name_or_email.truncate
|
11
|
+
name_or_email.try(:truncate,30)
|
11
12
|
end
|
12
13
|
|
13
14
|
def sign_out_link
|
14
15
|
return "" unless user
|
15
|
-
h.
|
16
|
-
h.concat h.link_to "Sign Out", "/logout", class: "side-nav__link"
|
17
|
-
end
|
16
|
+
h.render partial: "ama_layout/sign_out_link"
|
18
17
|
end
|
19
18
|
|
20
19
|
def top_nav
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module AmaLayout
|
2
|
+
module DraperReplacement
|
3
|
+
attr_accessor :object
|
4
|
+
|
5
|
+
def h
|
6
|
+
ActionView::Base.new(::ActionController::Base.view_paths, {}, ::ApplicationController.new)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(args = {})
|
10
|
+
self.object = args
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.decorate_collection(objects = {})
|
14
|
+
objects.map { |o| self.new(o) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def method_missing(method, *args, &block)
|
18
|
+
return super unless delegatable?(method)
|
19
|
+
|
20
|
+
(object || DraperReplacement).send(method, *args, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def delegatable?(method)
|
24
|
+
object.respond_to?(method) || DraperReplacement.respond_to?(method)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/ama_layout/moneris.rb
CHANGED
data/lib/ama_layout/version.rb
CHANGED
@@ -94,8 +94,9 @@ 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
|
-
|
97
|
+
allow(Rails.configuration).to receive(:amaabca_site).and_return("amaabca.example.com")
|
98
|
+
allow(navigation_presenter).to receive(:sign_out_link).and_return("sign_out_link")
|
99
|
+
expect(navigation_presenter.top_nav).to include("AMA Road Reports", "http://auth.waffles.ca")
|
99
100
|
end
|
100
101
|
end
|
101
102
|
|
@@ -110,8 +111,7 @@ describe AmaLayout::NavigationDecorator do
|
|
110
111
|
context "with items" do
|
111
112
|
it "renders the partial" do
|
112
113
|
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
113
|
-
|
114
|
-
expect(navigation_presenter.sidebar).to eq "render"
|
114
|
+
expect(navigation_presenter.sidebar).to include("Online Account", "Membership Overview", "Rewards Overview")
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -125,8 +125,7 @@ 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
|
-
|
129
|
-
expect(navigation_presenter.account_toggle).to eq "render"
|
128
|
+
expect(navigation_presenter.account_toggle).to eq ""
|
130
129
|
end
|
131
130
|
end
|
132
131
|
|
@@ -153,8 +152,7 @@ describe AmaLayout::NavigationDecorator do
|
|
153
152
|
|
154
153
|
describe '#notifications' do
|
155
154
|
it 'renders the content to the page' do
|
156
|
-
expect(subject.
|
157
|
-
expect(subject.notifications).to be true
|
155
|
+
expect(subject.notifications).to include("data-notifications-toggle")
|
158
156
|
end
|
159
157
|
end
|
160
158
|
|
@@ -217,8 +215,7 @@ describe AmaLayout::NavigationDecorator do
|
|
217
215
|
|
218
216
|
describe '#notification_sidebar' do
|
219
217
|
it 'renders content to the page' do
|
220
|
-
expect(subject.
|
221
|
-
expect(subject.notification_sidebar).to be true
|
218
|
+
expect(subject.notification_sidebar).to include("Sign up now","off-canvas position-right")
|
222
219
|
end
|
223
220
|
end
|
224
221
|
|
@@ -39,8 +39,7 @@ 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
|
-
|
43
|
-
expect(navigation_item_presenter.top_sub_nav).to eq "render"
|
42
|
+
expect(navigation_item_presenter.top_sub_nav).to include("Othersite Overview", "http://othersite.com")
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
@@ -55,8 +54,7 @@ describe AmaLayout::NavigationItemDecorator do
|
|
55
54
|
context "with items" do
|
56
55
|
it "renders the partial" do
|
57
56
|
navigation_item.sub_nav = items
|
58
|
-
|
59
|
-
expect(navigation_item_presenter.sidebar_sub_nav).to eq "render"
|
57
|
+
expect(navigation_item_presenter.sidebar_sub_nav).to include(">Othersite Overview", "http://othersite.com")
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
data/spec/spec_helper.rb
CHANGED
@@ -18,8 +18,6 @@ ActionView::TestCase::TestController.instance_eval do
|
|
18
18
|
helper Rails.application.routes.url_helpers
|
19
19
|
end
|
20
20
|
|
21
|
-
Draper::ViewContext.test_strategy :fast
|
22
|
-
|
23
21
|
RSpec.configure do |config|
|
24
22
|
config.infer_spec_type_from_file_location!
|
25
23
|
config.include Rails.application.routes.url_helpers
|
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:
|
4
|
+
version: 7.0.pre
|
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-15 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: foundation-rails
|
@@ -40,42 +40,14 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '4.2'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: activemodel-serializers-xml
|
53
|
-
requirement: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '0'
|
58
|
-
type: :runtime
|
59
|
-
prerelease: false
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '0'
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: draper
|
67
|
-
requirement: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 3.0.0
|
72
|
-
type: :runtime
|
73
|
-
prerelease: false
|
74
|
-
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 3.0.0
|
50
|
+
version: '4.2'
|
79
51
|
- !ruby/object:Gem::Dependency
|
80
52
|
name: browser
|
81
53
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,16 +66,16 @@ dependencies:
|
|
94
66
|
name: breadcrumbs_on_rails
|
95
67
|
requirement: !ruby/object:Gem::Requirement
|
96
68
|
requirements:
|
97
|
-
- - "
|
69
|
+
- - "~>"
|
98
70
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
71
|
+
version: 3.0.1
|
100
72
|
type: :runtime
|
101
73
|
prerelease: false
|
102
74
|
version_requirements: !ruby/object:Gem::Requirement
|
103
75
|
requirements:
|
104
|
-
- - "
|
76
|
+
- - "~>"
|
105
77
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
78
|
+
version: 3.0.1
|
107
79
|
- !ruby/object:Gem::Dependency
|
108
80
|
name: redis-rails
|
109
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,6 +239,7 @@ files:
|
|
267
239
|
- ".travis.yml"
|
268
240
|
- Gemfile
|
269
241
|
- LICENSE.txt
|
242
|
+
- PULL_REQUEST_TEMPLATE.md
|
270
243
|
- README.md
|
271
244
|
- Rakefile
|
272
245
|
- ama_layout.gemspec
|
@@ -306,6 +279,7 @@ files:
|
|
306
279
|
- app/views/ama_layout/_notification_sidebar.html.erb
|
307
280
|
- app/views/ama_layout/_notifications.html.erb
|
308
281
|
- app/views/ama_layout/_sidebar.html.erb
|
282
|
+
- app/views/ama_layout/_sign_out_link.html.erb
|
309
283
|
- app/views/ama_layout/_siteheader.html.erb
|
310
284
|
- app/views/ama_layout/_sub_nav.html.erb
|
311
285
|
- app/views/ama_layout/_sub_nav_item.html.erb
|
@@ -322,6 +296,7 @@ files:
|
|
322
296
|
- lib/ama_layout/decorators/navigation_decorator.rb
|
323
297
|
- lib/ama_layout/decorators/navigation_item_decorator.rb
|
324
298
|
- lib/ama_layout/decorators/notification_decorator.rb
|
299
|
+
- lib/ama_layout/draper_replacement.rb
|
325
300
|
- lib/ama_layout/moneris.rb
|
326
301
|
- lib/ama_layout/moneris/textbox.txt
|
327
302
|
- lib/ama_layout/navigation.rb
|
@@ -390,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
365
|
version: 1.3.1
|
391
366
|
requirements: []
|
392
367
|
rubyforge_project:
|
393
|
-
rubygems_version: 2.
|
368
|
+
rubygems_version: 2.5.1
|
394
369
|
signing_key:
|
395
370
|
specification_version: 4
|
396
371
|
summary: ".ama.ab.ca site layouts"
|