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 55d809d commit 9a54e35
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 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 @@ -46,7 +46,7 @@

<div class="row">
<div class="columns xlarge-6 hide_can_i_vote">
<%= form.check_box :hide_can_i_vote %>
<%= form.check_box :show_check_census %>
<p class="help-text">
<%== t(".hide_can_i_vote_help") %>
</p>
Expand Down
2 changes: 1 addition & 1 deletion 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

class AddHideCanIVoteToVotings < ActiveRecord::Migration[6.1]
def change
add_column :decidim_votings_votings, :hide_can_i_vote, :boolean, default: false
add_column :decidim_votings_votings, :show_check_census, :boolean, default: false
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 { false }

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) { false }

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: true)
end

it "returns a not found page" do
Expand Down

0 comments on commit 9a54e35

Please sign in to comment.