Move create question to admin poll questions
Also move question actions to admin polls questions
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<h3><%= t("admin.polls.show.questions_title") %></h3>
|
||||
<h3 class="inline-block"><%= t("admin.polls.show.questions_title") %></h3>
|
||||
|
||||
<%= link_to t("admin.questions.index.create"), new_admin_question_path(poll_id: @poll.id),
|
||||
class: "button float-right" %>
|
||||
|
||||
<% if @poll.questions.empty? %>
|
||||
<div class="callout primary margin-top">
|
||||
@@ -9,6 +12,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.polls.show.table_title") %></th>
|
||||
<th class="small-6"><%= t("admin.actions.actions") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% @poll.questions.each do |question| %>
|
||||
@@ -17,6 +21,20 @@
|
||||
<strong>
|
||||
<%= link_to question.title, admin_question_path(question) %>
|
||||
</strong>
|
||||
<td>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
|
||||
class: "button hollow expanded" %>
|
||||
</div>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("shared.edit"), edit_admin_question_path(question),
|
||||
class: "button hollow expanded" %>
|
||||
</div>
|
||||
<div class="small-4 column">
|
||||
<%= link_to t("shared.delete"), admin_question_path(question),
|
||||
class: "button hollow alert expanded",
|
||||
method: :delete %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -7,13 +7,19 @@
|
||||
<%= f.hidden_field :proposal_id %>
|
||||
|
||||
<div class="small-12">
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(select_options),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
<% if @poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @poll.id %>
|
||||
<% elsif @question.poll.present? %>
|
||||
<%= f.hidden_field :poll_id, value: @question.poll.id %>
|
||||
<% else %>
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(select_options),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= f.translatable_fields do |translations_form| %>
|
||||
<%= translations_form.text_field :title %>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<%= back_link_to %>
|
||||
|
||||
<h2 class="margin-top"><%= t("admin.questions.new.title") %></h2>
|
||||
<h2 class="margin-top">
|
||||
<% if @poll.present? %>
|
||||
<%= t("admin.questions.new.title", poll: @poll.name) %>
|
||||
<% else %>
|
||||
<%= t("admin.questions.new.title_proposal") %>
|
||||
<% end %>
|
||||
</h2>
|
||||
|
||||
<div class="poll-question-form">
|
||||
<%= render "form", form_url: admin_questions_path %>
|
||||
|
||||
Reference in New Issue
Block a user