Restored views
This commit is contained in:
@@ -34,12 +34,6 @@
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.description") %></strong>
|
||||
<br>
|
||||
<%= @question.description %>
|
||||
</p>
|
||||
|
||||
<% if @question.video_url.present? %>
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.video_url") %></strong>
|
||||
@@ -55,7 +49,5 @@
|
||||
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<%= link_to t("admin.questions.show.preview"), question_path(@question) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
22
app/views/polls/questions/_answers.html.erb
Normal file
22
app/views/polls/questions/_answers.html.erb
Normal 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>
|
||||
9
app/views/polls/questions/_question.html.erb
Normal file
9
app/views/polls/questions/_question.html.erb
Normal 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>
|
||||
1
app/views/polls/questions/answer.js.erb
Normal file
1
app/views/polls/questions/answer.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#<%= dom_id(@question) %>_answers").html('<%= j render("polls/questions/answers", question: @question) %>');
|
||||
@@ -112,7 +112,11 @@ Rails.application.routes.draw do
|
||||
get :search, on: :collection
|
||||
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
|
||||
resources :processes, only: [:index, :show] do
|
||||
|
||||
Reference in New Issue
Block a user