app/controllers/decidim/votings/votings_controller.rb in decidim-elections-0.26.10 vs app/controllers/decidim/votings/votings_controller.rb in decidim-elections-0.27.0.rc1
- old
+ new
@@ -47,15 +47,19 @@
render :login,
layout: "decidim/election_votes"
end
def show_check_census
+ raise ActionController::RoutingError, "Not Found" unless current_participatory_space.check_census_enabled?
+
@form = form(Census::CheckForm).instance
render :check_census, locals: { success: false, not_found: false }
end
def check_census
+ raise ActionController::RoutingError, "Not Found" unless current_participatory_space.check_census_enabled?
+
@form = form(Census::CheckForm).from_params(params).with_context(
current_participatory_space: current_participatory_space
)
success = not_found = false
@@ -97,11 +101,11 @@
def datum
@datum ||= Decidim::Votings::Census::Datum.find(params[:datum_id])
end
def election
- @election ||= Decidim::Elections::Election.where(component: current_participatory_space.components).find(params[:election_id])
+ @election ||= Decidim::Elections::Election.find(params[:election_id])
end
def elections
raise ActionController::RoutingError, "Not Found" unless current_participatory_space
@@ -127,42 +131,35 @@
def published_votings
@published_votings ||= Voting.where(organization: current_organization).published
end
def paginated_votings
- @paginated_votings ||= reorder(search.results.published)
- @paginated_votings = paginate(@paginated_votings)
+ @paginated_votings ||= paginate(search.result.published)
+ @paginated_votings = reorder(@paginated_votings)
end
def promoted_votings
@promoted_votings ||= OrganizationPromotedVotings.new(current_organization)
end
def finished_votings
- @finished_votings ||= search_klass.new(search_params.merge(state: ["finished"])).results
+ @finished_votings ||= search_with(filter_params.merge(with_any_date: %w(finished))).result
end
def only_finished_votings?
return if finished_votings.blank?
published_votings.count == finished_votings.count
end
- def search_klass
- VotingSearch
+ def search_collection
+ Voting.where(organization: current_organization).published
end
def default_filter_params
{
- search_text: "",
- state: [""]
- }
- end
-
- def context_params
- {
- organization: current_organization,
- current_user: current_user
+ search_text_cont: "",
+ with_any_date: [""]
}
end
# Public: Checks if the component has only one election resource.
#