Skip to content

Commit

Permalink
Rename to show_check_census
Browse files Browse the repository at this point in the history
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
  • Loading branch information
oriolgual and andreslucena committed May 8, 2022
1 parent 2006a31 commit 6a13ebf
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_voting!
introductory_image: form.introductory_image,
voting_type: form.voting_type,
census_contact_information: form.census_contact_information,
hide_can_i_vote: form.hide_can_i_vote
show_check_census: form.show_check_census
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def attributes
promoted: form.promoted,
voting_type: form.voting_type,
census_contact_information: form.census_contact_information,
hide_can_i_vote: form.hide_can_i_vote
show_check_census: form.show_check_census
}.merge(attachment_attributes(*image_fields))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VotingForm < Decidim::Form
attribute :introductory_image
attribute :voting_type, String
attribute :census_contact_information, String
attribute :hide_can_i_vote, Boolean, default: false
attribute :show_check_census, Boolean, default: false

validates :title, translatable_presence: true
validates :description, translatable_presence: true
Expand Down
2 changes: 1 addition & 1 deletion decidim-elections/app/models/decidim/votings/voting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def has_ballot_styles?
end

def check_census_enabled?
dataset.present? && !hide_can_i_vote?
dataset.present? && show_check_census?
end

def elections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
</div>

<div class="row">
<div class="columns xlarge-6 hide_can_i_vote">
<%= form.check_box :hide_can_i_vote %>
<div class="columns xlarge-6 show_check_census">
<%= form.check_box :show_check_census %>
<p class="help-text">
<%== t(".hide_can_i_vote_help") %>
<%== t(".show_check_census_help") %>
</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions decidim-elections/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ en:
census_contact_information: Census contact information
description: Description
end_time: Voting ends
hide_can_i_vote: Hide "Can I vote?"
introductory_image: Introductory image
promoted: Promoted
scope: Scope
show_check_census: Show "check census" page
start_time: Voting begins
title: Title
voting_type: Voting type
Expand Down Expand Up @@ -1007,7 +1007,7 @@ en:
banner_image: Banner image
census_contact_information: Census contact information
census_contact_information_help: This contact information is for a participant who wants to report issues with the census. It can be an email address, a contact form on another site, a survey for visitors, etc.
hide_can_i_vote_help: Whether to show the "Can I vote?" link at the public votings menu
show_check_census_help: Whether to show the "Can I vote?" link at the public votings menu
introductory_image: Introductory image
promoted: Promoted
select_a_voting_type: Please select a voting type
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddShowCheckCensusToVotings < ActiveRecord::Migration[6.1]
def change
add_column :decidim_votings_votings, :show_check_census, :boolean, default: true
end
end
2 changes: 1 addition & 1 deletion decidim-elections/lib/decidim/votings/test/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def hash_for(*data)
introductory_image { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }
voting_type { "hybrid" }
census_contact_information { nil }
hide_can_i_vote { false }
show_check_census { true }

trait :unpublished do
published_at { nil }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Admin
promoted: promoted,
voting_type: voting_type,
census_contact_information: census_contact_information,
hide_can_i_vote: hide_can_i_vote
show_check_census: show_check_census
)
end

Expand All @@ -41,7 +41,7 @@ module Admin
let(:promoted) { true }
let(:voting_type) { "online" }
let(:census_contact_information) { nil }
let(:hide_can_i_vote) { false }
let(:show_check_census) { true }

let(:voting) { Decidim::Votings::Voting.last }

Expand All @@ -64,7 +64,7 @@ module Admin
expect(voting.organization).to eq organization
expect(voting.promoted).to eq promoted
expect(voting.voting_type).to eq voting_type
expect(voting.hide_can_i_vote).to eq hide_can_i_vote
expect(voting.show_check_census).to eq show_check_census
end

it "traces the action", versioning: true do
Expand Down
2 changes: 1 addition & 1 deletion decidim-elections/spec/system/check_census_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

context "when the page has been hidden" do
before do
voting.update!(hide_can_i_vote: true)
voting.update!(show_check_census: false)
end

it "returns a not found page" do
Expand Down

0 comments on commit 6a13ebf

Please sign in to comment.