pugin 1.0.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3e098ca3ba1d75ad3f960e24dd0a5f693fcdf47
4
- data.tar.gz: 57ed57564d93d81f01b1cf32f660f3883d1aaf2e
3
+ metadata.gz: 2e1de1c2ade9b160907ca841bc484a546361b4a4
4
+ data.tar.gz: 980035410a8fc7ba1d423984046a8dd14df75714
5
5
  SHA512:
6
- metadata.gz: cfd518519aee88a2fe7633c9ad8f03b8d6d0a3f8e5aac2e74449a73c2bc69988a6cab7d5dfd35e6254fd64242fed61b0c165f3b3afbac5b6393ba959ef990cb0
7
- data.tar.gz: e70e70e0710d93014a77bf10f9c0849494219439b8885aa38ae47cf7d8c8e6cd2a0932958d1409fa139487dae758c36442c41c67e60dafc1c9ba437e2b1d116d
6
+ metadata.gz: 0b94f9c82b3fd138014793cc5ea87337cb4472bfba22f819a7f4d02b99d0e46319332cddee76b81c535d2b32af99bf77200476c7ec74a13a0ea2c1f0559f5247
7
+ data.tar.gz: 27b493c136cba49f363b0ae0b9efe4f794b44a984866eb4bfef784a3e4c3277248c7f3624fdd289ce88694dcf113812c76344495ac34eda647652d02d582020a
@@ -4,6 +4,11 @@
4
4
  = params[:letter].present? ? "#{I18n.t('pugin.components.navigation-letter.showing_results')} #{params[:letter].capitalize}" : "#{I18n.t('pugin.components.navigation-letter.select_letter')}"
5
5
  %nav.navigation--letter{ aria:{ label: I18n.t('pugin.components.navigation-letter.aria_label') } }
6
6
  %ol
7
+ %li{ data: { letter: 'all' }, class: ('active' unless local_assigns[:all_path]) }
8
+ - if @letters.empty? || !local_assigns[:all_path]
9
+ %span= I18n.t('pugin.components.navigation-letter.all').capitalize
10
+ - else
11
+ = link_to "#{I18n.t('pugin.components.navigation-letter.all').upcase}", send(all_path)
7
12
  - ('a'..'z').each do |letter|
8
13
  %li{ data: { letter: letter }, class: ('active' if (params[:letter] == letter)) }
9
14
  - if @letters.include?(letter.upcase)
@@ -2,7 +2,7 @@
2
2
  .container
3
3
  %p
4
4
  = I18n.t('pugin.components.status.status_text_1')
5
- %a{ href: 'http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/', target: '_blank', title: I18n.t('open_new_window')}= I18n.t('pugin.components.status.give_feedback')
5
+ %a{ href: 'http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/' }= I18n.t('pugin.components.status.give_feedback')
6
6
  = I18n.t('pugin.components.status.status_text_2')
7
7
  - if Pugin::Feature::Bandiera.dissolution?
8
8
  - if Pugin::Feature::Bandiera.register_to_vote?
@@ -10,10 +10,10 @@
10
10
  = I18n.t('pugin.components.status.election_text_1')
11
11
  - else
12
12
  = I18n.t('pugin.components.status.election_text_2')
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')
13
+ %a{ href: 'http://www.parliament.uk/get-involved/elections/voting/' }= I18n.t('pugin.components.status.how_to_vote')
14
14
  = I18n.t('pugin.components.status.election_text_3')
15
15
  - elsif Pugin::Feature::Bandiera.election?
16
16
  = I18n.t('pugin.components.status.election_day_text')
17
17
  = succeed "." do
18
- %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')
18
+ %a{ href: 'http://www.parliament.uk/get-involved/elections/voting/' }= I18n.t('pugin.components.status.how_to_vote')
19
19
 
@@ -13,8 +13,12 @@
13
13
  %h2
14
14
  %a{:href => "/constituencies/#{constituencies.graph_id}"}= constituencies.name
15
15
  -# Constituency has a member? TRUE = Member's Name : FALSE = "Vacant" text
16
- %p= constituencies.members.empty? ? I18n.t('pugin.constituencies.list.current_constituency.vacant').capitalize : constituencies.members.first.display_name
17
- - else
16
+ - if !constituencies.members.empty?
17
+ %p= constituencies.current_member_display_name
18
+ %p= constituencies.current_member_party_name
19
+ - else
20
+ %p= I18n.t('pugin.constituencies.list.current_constituency.vacant').capitalize
21
+ - else
18
22
  %h2
19
- %a{:href => "/constituencies/#{constituencies.graph_id}"}= constituencies.name
23
+ %a{:href => "/constituencies/#{constituencies.graph_id}"}= "#{constituencies.name} (#{l(constituencies.start_date, format: :year_only)} - #{l(constituencies.end_date, format: :year_only)})"
20
24
  %p= "#{t('pugin.constituencies.list.former_constituency.former').capitalize} #{t('pugin.constituencies.list.former_constituency.constituency')}"
@@ -1,4 +1,7 @@
1
1
  en:
2
+ time:
3
+ formats:
4
+ year_only: "%Y"
2
5
  pugin:
3
6
  cards:
4
7
  person-list:
@@ -24,6 +27,7 @@ en:
24
27
  aria_label: "Paged navigation"
25
28
  select_letter: "select a letter"
26
29
  showing_results: "Showing results for"
30
+ all: "all"
27
31
  navigation-main:
28
32
  aria_label: "navigation"
29
33
  item_1: "MPs"
data/lib/pugin.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'pugin/version'
2
2
 
3
3
  module Pugin
4
- ASSET_VERSION = '1.6.0'.freeze
4
+ ASSET_VERSION = '1.6.1'.freeze
5
5
  ASSET_LOCATION_URL = ENV.fetch('ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1devci.pugin-website')
6
6
  STATIC_ASSET_LOCATION_URL = ENV.fetch('STATIC_ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1devci.static-assets')
7
7
  class << self
data/lib/pugin/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pugin
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -20,7 +20,7 @@ describe 'pugin/components/_status.html.haml', type: :view do
20
20
  <div class='container'>
21
21
  <p>
22
22
  This is a test website, so may be inaccurate.
23
- <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/' target='_blank' title='website opens in a new window'>Give feedback</a>
23
+ <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
24
24
  to help improve it.
25
25
  </p>
26
26
  </div>
@@ -45,7 +45,7 @@ DATA
45
45
  <div class='container'>
46
46
  <p>
47
47
  This is a test website, so may be inaccurate.
48
- <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/' target='_blank' title='website opens in a new window'>Give feedback</a>
48
+ <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
49
49
  to help improve it.
50
50
  <a href='https://www.gov.uk/register-to-vote'>Register to vote</a>
51
51
  in the general election by 22 May.
@@ -73,10 +73,10 @@ DATA
73
73
  <div class='container'>
74
74
  <p>
75
75
  This is a test website, so may be inaccurate.
76
- <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/' target='_blank' title='website opens in a new window'>Give feedback</a>
76
+ <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
77
77
  to help improve it.
78
78
  Find out
79
- <a href='http://www.parliament.uk/get-involved/elections/voting/' target='_blank' title='website opens in a new window'>how to vote</a>
79
+ <a href='http://www.parliament.uk/get-involved/elections/voting/'>how to vote</a>
80
80
  in the general election on 8 June.
81
81
  </p>
82
82
  </div>
@@ -103,10 +103,10 @@ DATA
103
103
  <div class='container'>
104
104
  <p>
105
105
  This is a test website, so may be inaccurate.
106
- <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/' target='_blank' title='website opens in a new window'>Give feedback</a>
106
+ <a href='http://www.smartsurvey.co.uk/s/ukparliament-beta-website-feedback/'>Give feedback</a>
107
107
  to help improve it.
108
108
  Thursday 8 June is election day, find out
109
- <a href='http://www.parliament.uk/get-involved/elections/voting/' target='_blank' title='website opens in a new window'>how to vote</a>.
109
+ <a href='http://www.parliament.uk/get-involved/elections/voting/'>how to vote</a>.
110
110
  </p>
111
111
  </div>
112
112
  </div>
@@ -1,56 +1,67 @@
1
1
  require 'spec_helper'
2
2
  require 'haml'
3
3
 
4
- describe 'pugin/constituencies/list/_list.html.haml', type: :view do
4
+ describe 'pugin/constituencies/list/_list.html.haml', type: :view do
5
5
 
6
6
  context 'with a current constituency data set' do
7
7
 
8
- before :each do
8
+ before :each do
9
9
  constituency = Class.new
10
+ members = Class.new
11
+ party = Class.new
12
+ allow(constituency).to receive(:current_member_display_name).and_return('Test Name')
13
+ allow(constituency).to receive(:current_member_party_name).and_return('Test Party')
10
14
  allow(constituency).to receive(:current?).and_return(true)
11
15
  allow(constituency).to receive(:name).and_return('Aberavon')
12
16
  allow(constituency).to receive(:graph_id).and_return('123')
13
- allow(constituency).to receive(:members).and_return([])
17
+ allow(constituency).to receive(:members).and_return([])
14
18
  @constituencies = [constituency]
15
19
  end
16
20
 
17
- it "shows the constituency's name as a link" do
21
+ it "shows the constituency's name as a link" do
18
22
  render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
19
23
  expect(response).to include("<a href='/constituencies/123'>Aberavon</a>")
20
24
  end
21
25
 
22
- context 'with a current member' do
26
+ context 'with a current member' do
23
27
 
24
- before :each do
28
+ before :each do
25
29
  constituency = Class.new
26
30
  members = Class.new
27
- allow(members).to receive(:display_name).and_return('Test Name')
28
- allow(constituency).to receive(:members).and_return([members])
31
+ party = Class.new
32
+ allow(constituency).to receive(:current_member_display_name).and_return('Test Name')
33
+ allow(constituency).to receive(:current_member_party_name).and_return('Test Party')
34
+ allow(constituency).to receive(:members).and_return([members])
29
35
  allow(constituency).to receive(:current?).and_return(true)
30
36
  allow(constituency).to receive(:name).and_return('Aberavon')
31
37
  allow(constituency).to receive(:graph_id).and_return('123')
32
38
  @constituencies = [constituency]
33
39
  end
34
40
 
35
- it "displays the member's name" do
41
+ it "displays the member's name" do
36
42
  render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
37
43
  expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon</a>\n</h2>")
38
44
  expect(response).to include("<p>Test Name</p>")
39
45
  end
46
+
47
+ it "displays the member's party" do
48
+ render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
49
+ expect(response).to include("<p>Test Party</p>")
50
+ end
40
51
  end
41
52
 
42
- context 'without a current member' do
53
+ context 'without a current member' do
43
54
 
44
- before :each do
55
+ before :each do
45
56
  constituency = Class.new
46
57
  allow(constituency).to receive(:current?).and_return(true)
47
58
  allow(constituency).to receive(:name).and_return('Aberavon')
48
59
  allow(constituency).to receive(:graph_id).and_return('123')
49
- allow(constituency).to receive(:members).and_return([])
60
+ allow(constituency).to receive(:members).and_return([])
50
61
  @constituencies = [constituency]
51
62
  end
52
63
 
53
- it 'displays the vacant i18n message' do
64
+ it 'displays the vacant i18n message' do
54
65
  render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
55
66
  expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon</a>\n</h2>")
56
67
  expect(response).to include("<p>Vacant</p>")
@@ -58,19 +69,22 @@ describe 'pugin/constituencies/list/_list.html.haml', type: :view do
58
69
  end
59
70
  end
60
71
 
61
- context 'with a previous constituency data set' do
72
+ context 'with a previous constituency data set' do
62
73
 
63
- before :each do
74
+ before :each do
64
75
  constituency = Class.new
65
76
  allow(constituency).to receive(:current?).and_return(false)
66
77
  allow(constituency).to receive(:name).and_return('Aberavon')
67
78
  allow(constituency).to receive(:graph_id).and_return('123')
79
+ allow(constituency).to receive(:start_date).and_return(DateTime.new(1929))
80
+ allow(constituency).to receive(:end_date).and_return(DateTime.new(1950))
81
+
68
82
  @constituencies = [constituency]
69
83
  end
70
84
 
71
- it 'displays the previous constituency i18n message' do
85
+ it 'displays the previous constituency i18n message' do
72
86
  render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
73
- expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon</a>\n</h2>")
87
+ expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon (1929 - 1950)</a>\n</h2>")
74
88
  expect(response).to include("<p>Former constituency</p>")
75
89
  end
76
90
  end
@@ -27,6 +27,8 @@ describe 'pugin/components/_status.html.haml', type: :view do
27
27
  allow(constituency).to receive(:current?).and_return(false)
28
28
  allow(constituency).to receive(:name).and_return('Aberavon')
29
29
  allow(constituency).to receive(:graph_id).and_return('123')
30
+ allow(constituency).to receive(:start_date).and_return(DateTime.new(1929))
31
+ allow(constituency).to receive(:end_date).and_return(DateTime.new(1950))
30
32
  @constituencies = [constituency]
31
33
  end
32
34
 
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: 1.0.1
4
+ version: 1.1.2
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-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails