From 4e7e0e3a7a221e5a7b4a981551c8f4fcc2b661fe Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 26 Jan 2016 18:03:45 +0100 Subject: [PATCH 1/3] makes geozone clickable in proposal show --- app/views/shared/_geozone.html.erb | 2 +- spec/features/debates_spec.rb | 34 ++++++++++++++++++++++++------ spec/features/proposals_spec.rb | 34 ++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/app/views/shared/_geozone.html.erb b/app/views/shared/_geozone.html.erb index 491cec031..7bfdd07a3 100644 --- a/app/views/shared/_geozone.html.erb +++ b/app/views/shared/_geozone.html.erb @@ -1,3 +1,3 @@ - <%= geozone_name(geozonable) %> + <%= link_to geozone_name(geozonable), proposals_path(search: geozone_name(geozonable)) %> diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 69d764c69..c6876fc67 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -889,11 +889,12 @@ feature 'Debates' do context "By geozone" do background do - geozone1 = Geozone.create(name: "California") - geozone2 = Geozone.create(name: "New York") + @california = Geozone.create(name: "California") + @new_york = Geozone.create(name: "New York") - @debate1 = create(:debate, geozone: geozone1) - @debate2 = create(:debate, geozone: geozone2) + @debate1 = create(:debate, geozone: @california) + @debate2 = create(:debate, geozone: @california) + @debate3 = create(:debate, geozone: @new_york) end pending "From map" do @@ -906,8 +907,10 @@ feature 'Debates' do end within("#debates") do - expect(page).to have_css('.debate', count: 1) + expect(page).to have_css('.debate', count: 2) expect(page).to have_content(@debate1.title) + expect(page).to have_content(@debate2.title) + expect(page).to_not have_content(@debate3.title) end end @@ -918,12 +921,29 @@ feature 'Debates' do within("#geozones") do click_link "California" end - within("#debates") do - expect(page).to have_css('.debate', count: 1) + expect(page).to have_css('.debate', count: 2) expect(page).to have_content(@debate1.title) + expect(page).to have_content(@debate2.title) + expect(page).to_not have_content(@debate3.title) end end + + pending "From debate" do + visit debate_path(@debate1) + + within("#geozone") do + click_link "California" + end + + within("#debates") do + expect(page).to have_css('.debate', count: 2) + expect(page).to have_content(@debate1.title) + expect(page).to have_content(@debate2.title) + expect(page).to_not have_content(@debate3.title) + end + end + end end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 0310e6311..08b99463c 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -1047,11 +1047,12 @@ feature 'Proposals' do context "By geozone" do background do - geozone1 = Geozone.create(name: "California") - geozone2 = Geozone.create(name: "New York") + @california = Geozone.create(name: "California") + @new_york = Geozone.create(name: "New York") - @proposal1 = create(:proposal, geozone: geozone1) - @proposal2 = create(:proposal, geozone: geozone2) + @proposal1 = create(:proposal, geozone: @california) + @proposal2 = create(:proposal, geozone: @california) + @proposal3 = create(:proposal, geozone: @new_york) end scenario "From map" do @@ -1064,8 +1065,10 @@ feature 'Proposals' do end within("#proposals") do - expect(page).to have_css('.proposal', count: 1) + expect(page).to have_css('.proposal', count: 2) expect(page).to have_content(@proposal1.title) + expect(page).to have_content(@proposal2.title) + expect(page).to_not have_content(@proposal3.title) end end @@ -1076,12 +1079,29 @@ feature 'Proposals' do within("#geozones") do click_link "California" end - within("#proposals") do - expect(page).to have_css('.proposal', count: 1) + expect(page).to have_css('.proposal', count: 2) expect(page).to have_content(@proposal1.title) + expect(page).to have_content(@proposal2.title) + expect(page).to_not have_content(@proposal3.title) end end + + scenario "From proposal" do + visit proposal_path(@proposal1) + + within("#geozone") do + click_link "California" + end + + within("#proposals") do + expect(page).to have_css('.proposal', count: 2) + expect(page).to have_content(@proposal1.title) + expect(page).to have_content(@proposal2.title) + expect(page).to_not have_content(@proposal3.title) + end + end + end end From fc857ea6032412327db99338f55c313e9dfb8e09 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 26 Jan 2016 18:42:28 +0100 Subject: [PATCH 2/3] Adds styles for geozone on proposal show --- app/assets/stylesheets/layout.scss | 38 ++++++++++------------- app/assets/stylesheets/participation.scss | 1 - app/views/shared/_geozone.html.erb | 2 +- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 586628556..7619683b3 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -605,34 +605,28 @@ footer { // 04. Tags // - - - - - - - - - - - - - - - - - - - - - - - - - -.tags, .tag-cloud { +.tags a , .tag-cloud a, .categories a, .geozone a { + background: #ececec; + border-radius: rem-calc(6); + color: $text; + display: inline-block; + font-size: $small-font-size; + margin-bottom: $line-height/3; + padding: $line-height/4 $line-height/3; + text-decoration: none; - a { - background: #ececec; - border-radius: rem-calc(6); - color: $text; - display: inline-block; - font-size: $small-font-size; - margin-bottom: $line-height/3; - padding: $line-height/4 $line-height/3; - text-decoration: none; - - &:hover { - background: #e0e0e0; - } + &:hover { + background: #e0e0e0; } } -.categories { +.categories a, .geozone a { + background: $highlight; + color: $link; - a { + &:hover { background: $highlight; - border-radius: rem-calc(6); - display: inline-block; - font-size: $small-font-size; - margin-bottom: $line-height/3; - padding: $line-height/4 $line-height/3; - text-decoration: none; + color: $link-hover; } } diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 87aed579d..4b4e3ec9c 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -521,7 +521,6 @@ .tags { display: block; - margin: rem-calc(24) 0; a { margin-right: rem-calc(6); diff --git a/app/views/shared/_geozone.html.erb b/app/views/shared/_geozone.html.erb index 7bfdd07a3..bdf5ce89a 100644 --- a/app/views/shared/_geozone.html.erb +++ b/app/views/shared/_geozone.html.erb @@ -1,3 +1,3 @@ - + <%= link_to geozone_name(geozonable), proposals_path(search: geozone_name(geozonable)) %> From 606a87bbbfa5244f316c3736060e25b21b696d32 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 26 Jan 2016 18:51:59 +0100 Subject: [PATCH 3/3] force build --- spec/features/debates_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index c6876fc67..44955bb29 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -947,4 +947,4 @@ feature 'Debates' do end end -end +end \ No newline at end of file