pugin 0.6.2 → 0.6.3
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/app/views/pugin/cards/_person-list.haml +3 -1
- data/app/views/pugin/components/_navigation-letter.haml +2 -3
- data/app/views/pugin/components/_status.haml +3 -3
- data/app/views/pugin/constituencies/list/_list.html.haml +8 -3
- data/app/views/pugin/constituencies/list/current/_current_constituency.html.haml +5 -6
- data/app/views/pugin/constituencies/list/former/_former_constituency.html.haml +2 -3
- data/app/views/pugin/elements/_list.html.haml +3 -3
- data/config/locales/en.yml +10 -3
- data/lib/pugin.rb +1 -1
- data/lib/pugin/version.rb +1 -1
- data/spec/views/pugin/cards/_person-list.html.haml_spec.rb +5 -2
- data/spec/views/pugin/components/_navigation-letter.html.haml_spec.rb +80 -95
- data/spec/views/pugin/components/_status.html.haml_spec.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dac6bcc0d2b09d29aac46e0e7ed1a1e6f764cda
|
4
|
+
data.tar.gz: 1561a7f11e4aa36c3019b671848ffc288dfd3853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffa4ee3787a25699378037edd3ce2edb924d72b95c455cad42a53c067e6812b6bc97188738b32b1bee8e3d75ac7c117c945e18274d2cb64393db2fbecc066e58
|
7
|
+
data.tar.gz: af8fb5067f17c8aa34af6d80c0cf7286ccde0a6c3c122b93e7dd74ddf6576a11738a5ac6b06634b10a9251cfdcb3547bb8a5ebe3b9782b8e022087a8baffb405
|
@@ -1,7 +1,9 @@
|
|
1
1
|
-if people.empty?
|
2
2
|
%ol.list--box
|
3
3
|
%li
|
4
|
-
%p
|
4
|
+
%p
|
5
|
+
= "#{I18n.t('no_content.empty_list.members.description')}"
|
6
|
+
= params[:letter].nil? ? "" : "#{I18n.t('no_content.empty_list.members.for')} '#{params[:letter].upcase}'"
|
5
7
|
-else
|
6
8
|
%ol.list--box
|
7
9
|
- people.each do |person|
|
@@ -9,7 +9,6 @@
|
|
9
9
|
- unless letter == params[:letter]
|
10
10
|
= navigation_link(route_symbol: route_symbol, letter: letter, primary_id: local_assigns.fetch(:primary_id, nil), secondary_id: local_assigns.fetch(:secondary_id, nil))
|
11
11
|
- else
|
12
|
-
= letter
|
12
|
+
%span= letter
|
13
13
|
- else
|
14
|
-
= letter
|
15
|
-
|
14
|
+
%span= letter
|
@@ -8,7 +8,7 @@
|
|
8
8
|
- if defined?(FlagHelper.register_to_vote?) && FlagHelper.register_to_vote?
|
9
9
|
%a{ href: 'https://www.gov.uk/register-to-vote' }= I18n.t('pugin.components.status.register_to_vote')
|
10
10
|
= I18n.t('pugin.components.status.election_text_1')
|
11
|
-
- else
|
11
|
+
- else
|
12
12
|
= I18n.t('pugin.components.status.election_text_2')
|
13
|
-
|
14
|
-
|
13
|
+
%a{ href: 'http://www.parliament.uk/get-involved/elections/voting/', target: '_blank', title: I18n.t('open_new_window')}= I18n.t('pugin.components.status.how_to_vote')
|
14
|
+
= I18n.t('pugin.components.status.election_text_3')
|
@@ -1,3 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
%li
|
2
|
+
- if constituencies.current?
|
3
|
+
%h2= link_to(constituencies.name, constituency_path(constituencies.graph_id))
|
4
|
+
//- Constituency has a member? TRUE = Member's Name : FALSE = "Vacant" text
|
5
|
+
%p= constituencies.members.empty? ? I18n.t('pugin.constituencies.list.current.vacant').capitalize : constituencies.members.first.display_name
|
6
|
+
- else
|
7
|
+
%h2= link_to constituencies.name, constituency_path(constituencies.graph_id)
|
8
|
+
%p= "#{t('former').capitalize} #{t('constituency')}"
|
@@ -1,6 +1,5 @@
|
|
1
|
-
%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
%li= constituency.members.first.display_name
|
1
|
+
%h2= link_to(constituency.name, constituency_path(constituency.graph_id))
|
2
|
+
- if constituency.members.empty?
|
3
|
+
%p= I18n.t('pugin.constituencies.list.current.vacant').capitalize
|
4
|
+
- else
|
5
|
+
%p= constituency.members.first.display_name
|
@@ -1,3 +1,2 @@
|
|
1
|
-
%
|
2
|
-
|
3
|
-
%li= constituency.current? ? "#{t('current').capitalize} #{t('constituency')}" : "#{t('former').capitalize} #{t('constituency')}"
|
1
|
+
%h2= link_to constituency.name, constituency_path(constituency.graph_id)
|
2
|
+
%p= constituency.current? ? "#{t('current').capitalize} #{t('constituency')}" : "#{t('former').capitalize} #{t('constituency')}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
- list_tag = local_assigns.fetch(:ordered?, false) ? :ol : :ul
|
2
|
-
= content_tag(list_tag, class: "list") do
|
2
|
+
= content_tag(list_tag, class: "list--box") do
|
3
3
|
- if data.empty?
|
4
|
-
%li
|
4
|
+
%li
|
5
5
|
%p= t('no_content.empty_list.members.description', letter: params[:letter])
|
6
6
|
- else
|
7
|
-
= render partial: "pugin/#{item_type}/list/list", collection: local_assigns.fetch(:data, []), as:
|
7
|
+
= render partial: "pugin/#{item_type}/list/list", collection: local_assigns.fetch(:data, []), as: item_type.to_sym
|
data/config/locales/en.yml
CHANGED
@@ -9,10 +9,12 @@ en:
|
|
9
9
|
status:
|
10
10
|
status_text_1: 'This is a test website, so may be inaccurate.'
|
11
11
|
status_text_2: 'to help improve it.'
|
12
|
-
election_text_1: 'in the
|
13
|
-
election_text_2: '
|
12
|
+
election_text_1: 'in the general election by 22 May.'
|
13
|
+
election_text_2: 'Find out'
|
14
|
+
election_text_3: 'in the general election on 8 June.'
|
14
15
|
give_feedback: 'Give feedback'
|
15
16
|
register_to_vote: 'Register to vote'
|
17
|
+
how_to_vote: 'how to vote'
|
16
18
|
footer:
|
17
19
|
uk_parliament: "UK Parliament"
|
18
20
|
current_website: "Current Parliament.uk website"
|
@@ -33,6 +35,10 @@ en:
|
|
33
35
|
current:
|
34
36
|
current_member:
|
35
37
|
current_mp_for: "Current MP for"
|
38
|
+
constituencies:
|
39
|
+
list:
|
40
|
+
current:
|
41
|
+
vacant: 'vacant'
|
36
42
|
layouts:
|
37
43
|
pugin:
|
38
44
|
website_brand: "UK Parliament"
|
@@ -40,4 +46,5 @@ en:
|
|
40
46
|
no_content:
|
41
47
|
empty_list:
|
42
48
|
members:
|
43
|
-
description:
|
49
|
+
description: 'There are no results'
|
50
|
+
for: 'for'
|
data/lib/pugin.rb
CHANGED
data/lib/pugin/version.rb
CHANGED
@@ -74,12 +74,15 @@ DATA
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'renders as expected' do
|
77
|
-
render partial: 'pugin/cards/person-list', locals: { people: @people
|
77
|
+
render partial: 'pugin/cards/person-list', locals: { people: @people }
|
78
78
|
|
79
79
|
expect(response).to eq(<<DATA
|
80
80
|
<ol class='list--box'>
|
81
81
|
<li>
|
82
|
-
<p>
|
82
|
+
<p>
|
83
|
+
There are no results
|
84
|
+
|
85
|
+
</p>
|
83
86
|
</li>
|
84
87
|
</ol>
|
85
88
|
DATA
|
@@ -3,105 +3,90 @@ require 'haml'
|
|
3
3
|
|
4
4
|
describe 'pugin/components/_navigation-letter.html.haml', type: :view do
|
5
5
|
|
6
|
-
context 'with
|
6
|
+
context 'with all letters containing data' do
|
7
7
|
|
8
8
|
before :each do
|
9
|
-
|
9
|
+
# Variables used in testing
|
10
|
+
@primary_id = '1234'
|
11
|
+
@secondary_id = '5678'
|
12
|
+
@letters = ('A'..'Z')
|
13
|
+
|
14
|
+
# Allow URLS to be generated
|
15
|
+
# - Simple Letter
|
16
|
+
('a'..'z').each do |letter|
|
17
|
+
allow(view).to receive(:people_letter_path).with(letter).and_return("/people/a-z/#{letter}")
|
18
|
+
end
|
19
|
+
|
20
|
+
# - Letter with Primary ID
|
21
|
+
('a'..'z').each do |letter|
|
22
|
+
allow(view).to receive(:party_members_letter_path).with(@primary_id, letter).and_return("/parties/#{@primary_id}/members/a-z/#{letter}")
|
23
|
+
end
|
24
|
+
|
25
|
+
# - Letter with Primary ID and Secondary ID
|
26
|
+
('a'..'z').each do |letter|
|
27
|
+
allow(view).to receive(:house_party_members_letter_path).with(@primary_id, @secondary_id, letter).and_return("/houses/#{@primary_id}/parties/#{@secondary_id}/members/a-z/#{letter}")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# Test for simple letter
|
33
|
+
context 'and with no active letter' do
|
34
|
+
before :each do
|
35
|
+
render partial: 'pugin/components/navigation-letter', locals: { route_symbol: :people_letter_path }
|
36
|
+
end
|
37
|
+
('a'..'z').each do |letter|
|
38
|
+
it "doesn't render any list items with the active class" do
|
39
|
+
expect(rendered).not_to include("<li class='active' data-letter=#{letter}>")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'and with an active letter "a"' do
|
45
|
+
before :each do
|
46
|
+
params[:letter] = "a"
|
47
|
+
render partial: 'pugin/components/navigation-letter', locals: { route_symbol: :people_letter_path }
|
48
|
+
end
|
49
|
+
it "renders the list items with the active class and no link" do
|
50
|
+
expect(rendered).to include("<li class='active' data-letter='a'>\n<span>a</span>\n</li>")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Test for primary id and letter
|
55
|
+
context 'and a primary id' do
|
56
|
+
before :each do
|
57
|
+
render partial: 'pugin/components/navigation-letter', locals: { route_symbol: :party_members_letter_path, primary_id: @primary_id }
|
58
|
+
end
|
59
|
+
|
60
|
+
('a'..'z').each do |letter|
|
61
|
+
it "renders a navigation link for /parties/1234/a-z/#{letter}" do
|
62
|
+
expect(rendered).to include("<a data-atoz-see=\"true\" href=\"/parties/1234/members/a-z/#{letter}\">#{letter}</a>")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'and both a primary and secondary id' do
|
68
|
+
before :each do
|
69
|
+
render partial: 'pugin/components/navigation-letter', locals: { route_symbol: :house_party_members_letter_path, primary_id: @primary_id, secondary_id: @secondary_id }
|
70
|
+
end
|
71
|
+
('a'..'z').each do |letter|
|
72
|
+
it "renders a navigation link for /houses/1234/parties/5678/members/a-z/#{letter}" do
|
73
|
+
expect(rendered).to include("<a data-atoz-see=\"true\" href=\"/houses/1234/parties/5678/members/a-z/#{letter}\">#{letter}</a>")
|
74
|
+
end
|
75
|
+
end
|
10
76
|
end
|
11
77
|
|
12
|
-
|
13
|
-
|
78
|
+
context "doesn't render links for empty letters" do
|
79
|
+
before :each do
|
80
|
+
@letters = []
|
81
|
+
render partial: 'pugin/components/navigation-letter', locals: { route_symbol: :party_members_letter_path, primary_id: @primary_id }
|
82
|
+
end
|
14
83
|
|
15
|
-
|
16
|
-
|
17
|
-
<
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<nav aria-label='Paged navigation' class='navigation--letter'>
|
22
|
-
<ul>
|
23
|
-
<li data-letter='a'>
|
24
|
-
a
|
25
|
-
</li>
|
26
|
-
<li data-letter='b'>
|
27
|
-
b
|
28
|
-
</li>
|
29
|
-
<li data-letter='c'>
|
30
|
-
c
|
31
|
-
</li>
|
32
|
-
<li data-letter='d'>
|
33
|
-
d
|
34
|
-
</li>
|
35
|
-
<li data-letter='e'>
|
36
|
-
e
|
37
|
-
</li>
|
38
|
-
<li data-letter='f'>
|
39
|
-
f
|
40
|
-
</li>
|
41
|
-
<li data-letter='g'>
|
42
|
-
g
|
43
|
-
</li>
|
44
|
-
<li data-letter='h'>
|
45
|
-
h
|
46
|
-
</li>
|
47
|
-
<li data-letter='i'>
|
48
|
-
i
|
49
|
-
</li>
|
50
|
-
<li data-letter='j'>
|
51
|
-
j
|
52
|
-
</li>
|
53
|
-
<li data-letter='k'>
|
54
|
-
k
|
55
|
-
</li>
|
56
|
-
<li data-letter='l'>
|
57
|
-
l
|
58
|
-
</li>
|
59
|
-
<li data-letter='m'>
|
60
|
-
m
|
61
|
-
</li>
|
62
|
-
<li data-letter='n'>
|
63
|
-
n
|
64
|
-
</li>
|
65
|
-
<li data-letter='o'>
|
66
|
-
o
|
67
|
-
</li>
|
68
|
-
<li data-letter='p'>
|
69
|
-
p
|
70
|
-
</li>
|
71
|
-
<li data-letter='q'>
|
72
|
-
q
|
73
|
-
</li>
|
74
|
-
<li data-letter='r'>
|
75
|
-
r
|
76
|
-
</li>
|
77
|
-
<li data-letter='s'>
|
78
|
-
s
|
79
|
-
</li>
|
80
|
-
<li data-letter='t'>
|
81
|
-
t
|
82
|
-
</li>
|
83
|
-
<li data-letter='u'>
|
84
|
-
u
|
85
|
-
</li>
|
86
|
-
<li data-letter='v'>
|
87
|
-
v
|
88
|
-
</li>
|
89
|
-
<li data-letter='w'>
|
90
|
-
w
|
91
|
-
</li>
|
92
|
-
<li data-letter='x'>
|
93
|
-
x
|
94
|
-
</li>
|
95
|
-
<li data-letter='y'>
|
96
|
-
y
|
97
|
-
</li>
|
98
|
-
<li data-letter='z'>
|
99
|
-
z
|
100
|
-
</li>
|
101
|
-
</ul>
|
102
|
-
</nav>
|
103
|
-
DATA
|
104
|
-
)
|
84
|
+
('a'..'z').each do |letter|
|
85
|
+
it "just renders the letter #{letter}" do
|
86
|
+
expect(rendered).not_to include("<a data-atoz-see=\"true\" href=\"/parties/1234/members/a-z/#{letter}\">#{letter}</a>")
|
87
|
+
expect(rendered).to include("<li data-letter='#{letter}'>\n<span>#{letter}</span>\n</li>")
|
88
|
+
end
|
89
|
+
end
|
105
90
|
end
|
106
91
|
end
|
107
|
-
end
|
92
|
+
end
|
@@ -50,7 +50,6 @@ DATA
|
|
50
50
|
|
51
51
|
it 'renders a message that shows a link to register to vote' do
|
52
52
|
render partial: 'pugin/components/status', locals: { status: nil }
|
53
|
-
p FlagHelper.dissolution?
|
54
53
|
expect(response).to eq(
|
55
54
|
<<DATA
|
56
55
|
<div class='highlight--status highlight--default'>
|
@@ -60,7 +59,7 @@ This is a test website, so may be inaccurate.
|
|
60
59
|
<a href='https://ukparliament-self.achieveservice.com/AchieveForms/?form_uri=sandbox://AF-Form-337e2b87-4c8b-40f7-bb72-a80f15284b21&amp;category=AF-Category-108691b0-e15c-46d7-9d16-7ad0d35cdb2a&amp;isPublished=false' target='_blank' title='website opens in a new window'>Give feedback</a>
|
61
60
|
to help improve it.
|
62
61
|
<a href='https://www.gov.uk/register-to-vote'>Register to vote</a>
|
63
|
-
in the
|
62
|
+
in the general election by 22 May.
|
64
63
|
</p>
|
65
64
|
</div>
|
66
65
|
</div>
|
@@ -93,7 +92,9 @@ DATA
|
|
93
92
|
This is a test website, so may be inaccurate.
|
94
93
|
<a href='https://ukparliament-self.achieveservice.com/AchieveForms/?form_uri=sandbox://AF-Form-337e2b87-4c8b-40f7-bb72-a80f15284b21&amp;category=AF-Category-108691b0-e15c-46d7-9d16-7ad0d35cdb2a&amp;isPublished=false' target='_blank' title='website opens in a new window'>Give feedback</a>
|
95
94
|
to help improve it.
|
96
|
-
|
95
|
+
Find out
|
96
|
+
<a href='http://www.parliament.uk/get-involved/elections/voting/' target='_blank' title='website opens in a new window'>how to vote</a>
|
97
|
+
in the general election on 8 June.
|
97
98
|
</p>
|
98
99
|
</div>
|
99
100
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Rayner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|