ama_layout 5.11.0 → 5.12.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/ama_layout.gemspec +1 -2
- 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 +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68fd224038d65d4b4733ef89e62342eb54616de9
|
4
|
+
data.tar.gz: 1748ef1c697447bbc45b6e0de04feda2f16f6f76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03fdbd8ba50676c84aab9634f1476edd64396d483a6d21150f6f002b1f47181066ec1c7467891ae1e872014b56333d24ede29db654a758440bd3f50d85646734
|
7
|
+
data.tar.gz: e96716e1f6c132e99a08ba9b0fd7bb452c2dc3cb3e5abe2d68c1105e13f2465311e664fe75a729c5c1d107e670610916614bb68a028bd35dccd011b4ade57548
|
data/ama_layout.gemspec
CHANGED
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'foundation-rails', '>= 6.4.1.2'
|
22
|
-
spec.add_dependency 'rails', '
|
23
|
-
spec.add_dependency 'draper', '~> 2.1'
|
22
|
+
spec.add_dependency 'rails', '>= 4.2'
|
24
23
|
spec.add_dependency 'browser', '~> 2.0'
|
25
24
|
spec.add_dependency 'breadcrumbs_on_rails', '~> 3.0.1'
|
26
25
|
spec.add_dependency 'redis-rails'
|
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: 5.
|
4
|
+
version: 5.12.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-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
|
@@ -38,30 +38,16 @@ dependencies:
|
|
38
38
|
name: rails
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
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
50
|
version: '4.2'
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: draper
|
53
|
-
requirement: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '2.1'
|
58
|
-
type: :runtime
|
59
|
-
prerelease: false
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - "~>"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '2.1'
|
65
51
|
- !ruby/object:Gem::Dependency
|
66
52
|
name: browser
|
67
53
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,6 +279,7 @@ files:
|
|
293
279
|
- app/views/ama_layout/_notification_sidebar.html.erb
|
294
280
|
- app/views/ama_layout/_notifications.html.erb
|
295
281
|
- app/views/ama_layout/_sidebar.html.erb
|
282
|
+
- app/views/ama_layout/_sign_out_link.html.erb
|
296
283
|
- app/views/ama_layout/_siteheader.html.erb
|
297
284
|
- app/views/ama_layout/_sub_nav.html.erb
|
298
285
|
- app/views/ama_layout/_sub_nav_item.html.erb
|
@@ -309,6 +296,7 @@ files:
|
|
309
296
|
- lib/ama_layout/decorators/navigation_decorator.rb
|
310
297
|
- lib/ama_layout/decorators/navigation_item_decorator.rb
|
311
298
|
- lib/ama_layout/decorators/notification_decorator.rb
|
299
|
+
- lib/ama_layout/draper_replacement.rb
|
312
300
|
- lib/ama_layout/moneris.rb
|
313
301
|
- lib/ama_layout/moneris/textbox.txt
|
314
302
|
- lib/ama_layout/navigation.rb
|
@@ -377,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
377
365
|
version: '0'
|
378
366
|
requirements: []
|
379
367
|
rubyforge_project:
|
380
|
-
rubygems_version: 2.
|
368
|
+
rubygems_version: 2.5.1
|
381
369
|
signing_key:
|
382
370
|
specification_version: 4
|
383
371
|
summary: ".ama.ab.ca site layouts"
|