Added results_enabled and stats_enabled to Poll admin form
This commit is contained in:
@@ -54,9 +54,10 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
end
|
||||
|
||||
def poll_params
|
||||
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
|
||||
geozone_ids: [],
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted,
|
||||
:summary, :description, :results_enabled,:stats_enabled,
|
||||
geozone_ids: [],
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||
end
|
||||
|
||||
def search_params
|
||||
|
||||
@@ -90,4 +90,12 @@ class Poll < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def results_enabled?
|
||||
results_enabled
|
||||
end
|
||||
|
||||
def stats_enabled?
|
||||
stats_enabled
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -53,6 +53,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<fieldset class="fieldset">
|
||||
<legend><%= t('admin.polls.new.show_results_and_stats') %></legend>
|
||||
<%= f.check_box :results_enabled, checked: @poll.results_enabled?, label: t('admin.polls.new.show_results') %>
|
||||
<%= f.check_box :stats_enabled, checked: @poll.stats_enabled?, label: t('admin.polls.new.show_stats') %>
|
||||
<p class="small"><%= t('admin.polls.new.results_and_stats_reminder') %>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-4 column">
|
||||
<%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"),
|
||||
|
||||
Reference in New Issue
Block a user