improves layout for poll questions views

This commit is contained in:
decabeza
2017-10-05 11:06:00 +02:00
parent 52b68aa0df
commit ea4b534ee9
7 changed files with 85 additions and 85 deletions

View File

@@ -4,34 +4,30 @@
<%= f.hidden_field :proposal_id %>
<div class="row">
<div class="small-12 column">
<div class="small-12 medium-6 large-4">
<%= f.select :poll_id,
options_for_select(Poll.pluck(:name, :id)),
prompt: t("admin.questions.index.select_poll"),
label: t("admin.questions.new.poll_label") %>
</div>
<div class="small-12">
<div class="small-12 medium-6 large-4">
<%= f.select :poll_id,
options_for_select(Poll.pluck(:name, :id)),
prompt: t("admin.questions.index.select_poll"),
label: t("admin.questions.new.poll_label") %>
</div>
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
<div class="documents small-12">
<%= render 'documents/nested_documents', documentable: @question, f: f %>
</div>
<div class="documents small-12">
<%= render 'documents/nested_documents', documentable: @question, f: f %>
</div>
<div class="small-12">
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
aria: {describedby: "video-url-help-text"} %>
</div>
<div class="small-12">
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
aria: {describedby: "video-url-help-text"} %>
</div>
<div class="row">
<div class="actions small-12 medium-4 column margin-top">
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
</div>
</div>
<div class="small-12 medium-6 large-4 margin-top">
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<%= back_link_to %>
<h2><%= t("admin.questions.edit.title") %></h2>
<h2 class="margin-top"><%= t("admin.questions.edit.title") %></h2>
<div class="poll-question-form">
<%= render "form", form_url: admin_question_path(@question) %>

View File

@@ -3,10 +3,8 @@
<%= link_to t('admin.questions.index.create'), new_admin_question_path,
class: "button success float-right" %>
<div class="row">
<div class="small-12 medium-6 column">
<%= render 'search' %>
</div>
<div class="small-12 medium-6">
<%= render 'search' %>
</div>
<div class="tabs-content" data-tabs-content="questions-tabs">

View File

@@ -1,6 +1,6 @@
<%= back_link_to %>
<h2><%= t("admin.questions.new.title") %></h2>
<h2 class="margin-top"><%= t("admin.questions.new.title") %></h2>
<div class="poll-question-form">
<%= render "form", form_url: admin_questions_path %>

View File

@@ -5,10 +5,19 @@
<div class="clear"></div>
<div class="row">
<div class="small-12 medium-9 column">
<strong><%= t("admin.questions.show.title") %></strong>
<h1><%= @question.title %></h1>
<div class="small-12 medium-6">
<div class="callout highlight">
<p>
<strong><%= t("admin.questions.show.title") %></strong>
<br>
<%= @question.title %>
</p>
<p>
<strong><%= t("admin.questions.show.author") %></strong>
<br>
<%= link_to @question.author.name, user_path(@question.author) %>
</p>
<% if @question.proposal.present? %>
<p>
@@ -17,57 +26,50 @@
<%= link_to @question.proposal.title, proposal_path(@question.proposal) %>
</p>
<% end %>
<p>
<strong><%= t("admin.questions.show.author") %></strong>
<br>
<%= link_to @question.author.name, user_path(@question.author) %>
</p>
<table>
<tr>
<th colspan="1" scope="colgroup">
<%= t('admin.questions.show.valid_answers') %>
</th>
<th colspan="1" scope="colgroup">
<%= link_to t("admin.questions.show.add_answer"),
new_admin_question_answer_path(@question),
class: "button hollow float-right" %>
</th>
</tr>
<tr>
<th scope="col"><%= t("admin.questions.show.answers.title") %></th>
<th scope="col"><%= t("admin.questions.show.answers.description") %></th>
<th scope="col">Imágenes</th>
</tr>
<% @question.question_answers.each do |answer| %>
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
<th scope="col"><%= answer.title %></th>
<th scope="col"><%= answer.description %></th>
<th scope="col">
<%= link_to "Lista de imágenes",
admin_answer_images_path(answer) %>
</th>
</tr>
<% end %>
</table>
<% if @question.video_url.present? %>
<p>
<strong><%= t("admin.questions.show.video_url") %></strong>
<br>
<a href="<%= @question.video_url %>"><%= @question.video_url %></a>
</p>
<% end %>
<% if @question.documents.any? %>
<p>
<strong><%= t("admin.questions.show.documents") %></strong>
<br>
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
</p>
<% end %>
</div>
</div>
<table class="margin-top">
<tr>
<th colspan="3" scope="col" class="with-button">
<%= t('admin.questions.show.valid_answers') %>
<%= link_to t("admin.questions.show.add_answer"),
new_admin_question_answer_path(@question),
class: "button hollow float-right" %>
</th>
</tr>
<tr>
<th><%= t("admin.questions.show.answers.title") %></th>
<th class="medium-7"><%= t("admin.questions.show.answers.description") %></th>
<th class="text-center"><%= t("admin.questions.show.answers.images") %></th>
</tr>
<% @question.question_answers.each do |answer| %>
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
<td><%= answer.title %></td>
<td><%= answer.description %></td>
<td class="text-center">
(<%= answer.images.count %>)<br>
<%= link_to t("admin.questions.show.answers.images_list"),
admin_answer_images_path(answer) %>
</td>
</tr>
<% end %>
</table>
<% if @question.video_url.present? %>
<p>
<strong><%= t("admin.questions.show.video_url") %></strong>
<br>
<a href="<%= @question.video_url %>"><%= @question.video_url %></a>
</p>
<% end %>
<% if @question.documents.any? %>
<p>
<strong><%= t("admin.questions.show.documents") %></strong>
<br>
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
</p>
<% end %>

View File

@@ -598,6 +598,8 @@ en:
answers:
title: Answer
description: Description
images: Images
images_list: Images list
answers:
new:
title: "New answer"

View File

@@ -600,6 +600,8 @@ es:
answers:
title: Respuesta
description: Descripción
images: Imágenes
images_list: Lista de imágenes
answers:
new:
title: "Nueva respuesta"