Allow Poll::Question::Answer edit

As requested by #1992
This commit is contained in:
Angel Perez
2017-10-06 09:48:17 -04:00
parent 806fd85246
commit 63eaa0bef6
13 changed files with 157 additions and 22 deletions

View File

@@ -2,17 +2,14 @@
<%= render 'shared/errors', resource: @answer %>
<%= f.hidden_field :question_id, value: @question.id %>
<%= f.hidden_field :question_id, value: @answer.question_id || @question.id %>
<%= f.label :title, t('admin.questions.new.form.title') %>
<%= f.text_field :title, label: false %>
<%= f.text_field :title %>
<div class="ckeditor">
<%= f.label :description, t('admin.questions.new.form.description') %>
<%= f.cktext_area :description,
maxlength: Poll::Question.description_max_length,
ckeditor: { language: I18n.locale },
label: false %>
ckeditor: { language: I18n.locale } %>
</div>
<div class="small-12 medium-6 large-4">

View File

@@ -0,0 +1,14 @@
<%= back_link_to %>
<ul class="breadcrumbs margin-top">
<li><%= @answer.title %></li>
<li><%= t('admin.answers.edit.title') %></li>
</ul>
<h2 class="margin-top">
<%= t("admin.answers.edit.title") %>
</h2>
<div class="poll-question-answer-form">
<%= render "form", form_url: admin_answer_path(@answer) %>
</div>

View File

@@ -0,0 +1,32 @@
<%= back_link_to %>
<%= link_to t('shared.edit'), edit_admin_answer_path(@answer),
class: "button hollow float-right" %>
<ul class="breadcrumbs margin-top">
<li><%= @answer.question.title %></li>
<li><%= @answer.title %></li>
</ul>
<div class="clear"></div>
<div class="small-12 medium-6">
<div class="callout highlight">
<p>
<strong><%= t("admin.answers.show.title") %></strong>
<br>
<%= @answer.title %>
</p>
<p>
<strong><%= t("admin.answers.show.description") %></strong>
<%= @answer.description %>
</p>
<p>
<strong><%= t("admin.answers.show.images") %></strong>
<br>
<%= link_to t("admin.answers.show.images_list"), admin_answer_images_path(@answer) %>
</p>
</div>
</div>

View File

@@ -31,7 +31,7 @@
<table class="margin-top">
<tr>
<th colspan="3" scope="col" class="with-button">
<th colspan="3" class="with-button">
<%= t('admin.questions.show.valid_answers') %>
<%= link_to t("admin.questions.show.add_answer"),
new_admin_question_answer_path(@question),
@@ -47,7 +47,7 @@
<% @question.question_answers.each do |answer| %>
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
<td><%= answer.title %></td>
<td><%= link_to answer.title, admin_answer_path(answer) %></td>
<td><%= answer.description %></td>
<td class="text-center">
(<%= answer.images.count %>)<br>