Restored views

This commit is contained in:
María Checa
2017-10-03 21:00:40 +02:00
parent 348e4e54f3
commit 9871503c5e
5 changed files with 37 additions and 9 deletions

View File

@@ -34,12 +34,6 @@
</span> </span>
<% end %> <% end %>
<p>
<strong><%= t("admin.questions.show.description") %></strong>
<br>
<%= @question.description %>
</p>
<% if @question.video_url.present? %> <% if @question.video_url.present? %>
<p> <p>
<strong><%= t("admin.questions.show.video_url") %></strong> <strong><%= t("admin.questions.show.video_url") %></strong>
@@ -55,7 +49,5 @@
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a> <a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
</p> </p>
<% end %> <% end %>
<%= link_to t("admin.questions.show.preview"), question_path(@question) %>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,22 @@
<div class="poll-question-answers">
<% if can? :answer, question %>
<% question.valid_answers.each do |answer| %>
<% if @answers_by_question_id[question.id] == answer %>
<span class="button answered" title="<%= t("poll_questions.show.voted", answer: answer)%>">
<%= answer %>
</span>
<% else %>
<%= link_to answer,
answer_question_path(question, answer: answer),
method: :post,
remote: true,
title: t("poll_questions.show.vote_answer", answer: answer),
class: "button secondary hollow" %>
<% end %>
<% end %>
<% else %>
<% question.valid_answers.each do |answer| %>
<span class="button secondary hollow disabled"><%= answer %></span>
<% end %>
<% end %>
</div>

View File

@@ -0,0 +1,9 @@
<div id="<%= dom_id(question) %>" class="poll-question">
<h3>
<%= question.title %>
</h3>
<div id="<%= dom_id(question) %>_answers" class="padding">
<%= render 'polls/questions/answers', question: question %>
</div>
</div>

View File

@@ -0,0 +1 @@
$("#<%= dom_id(@question) %>_answers").html('<%= j render("polls/questions/answers", question: @question) %>');

View File

@@ -112,7 +112,11 @@ Rails.application.routes.draw do
get :search, on: :collection get :search, on: :collection
end end
resources :polls, only: [:show, :index] resources :polls, only: [:show, :index] do
resources :questions, controller: 'polls/questions', shallow: true do
post :answer, on: :member
end
end
namespace :legislation do namespace :legislation do
resources :processes, only: [:index, :show] do resources :processes, only: [:index, :show] do