Removed poll question show

This commit is contained in:
María Checa
2017-10-03 19:11:39 +02:00
parent 21e14776fc
commit 5bb831e959
9 changed files with 2 additions and 192 deletions

View File

@@ -5,15 +5,6 @@ class Polls::QuestionsController < ApplicationController
has_orders %w{most_voted newest oldest}, only: :show
def show
@commentable = @question.proposal.present? ? @question.proposal : @question
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
set_comment_flags(@comment_tree.comments)
question_answer = @question.answers.where(author_id: current_user.try(:id)).first
@answers_by_question_id = {@question.id => question_answer.try(:answer)}
end
def answer
answer = @question.answers.find_or_initialize_by(author: current_user)

View File

@@ -51,7 +51,7 @@
<%= poll_dates(poll) %>
<ul class="margin-top">
<% poll.questions.each do |question| %>
<li><%= link_to question.title, question_path(question) %></li>
<li><%= question.title %></li>
<% end %>
</ul>
<% end %>

View File

@@ -1,22 +0,0 @@
<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

@@ -1,31 +0,0 @@
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@commentable), @comment_tree.comments, @comment_tree.comment_authors, @commentable.comments_count, @comment_flags] do %>
<section class="row-full comments">
<div class="row">
<div id="comments" class="small-12 column">
<h2>
<%= t("shared.comments.title") %>
<span class="js-comments-count">(<%= @commentable.comments_count %>)</span>
</h2>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
<% if user_signed_in? %>
<%= render 'comments/form', {commentable: @commentable, parent_id: nil, toggeable: false} %>
<% else %>
<br>
<div data-alert class="callout primary">
<%= t("shared.comments.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
<% @comment_tree.root_comments.each do |comment| %>
<%= render 'comments/comment', comment: comment %>
<% end %>
<%= paginate @comment_tree.root_comments %>
</div>
</div>
</section>
<% end %>

View File

@@ -1,22 +0,0 @@
<div class="row">
<div class="small-12 column">
<ul class="tabs" data-tabs id="questions-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-comments" do %>
<h3>
<%= t("proposals.show.comments_tab") %>
<span class="js-comments-count">(<%= @question.comments_count %>)</span>
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-documents" do %>
<h3>
<%= t("documents.tab") %>
(<%= @question.documents.count %>)
</h3>
<% end %>
</li>
</ul>
</div>
</div>

View File

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

View File

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

View File

@@ -1,92 +0,0 @@
<% provide :title do %><%= @question.title %><% end %>
<div class="expanded no-margin-top dark-heading">
<div class="row">
<div class="small-12 medium-9 column padding">
<%= back_link_to %>
<h1><%= @question.title %></h1>
<% if @question.proposal.present? %>
<div class="margin-bottom">
<%= link_to t('poll_questions.show.original_proposal'), @question.proposal %>
</div>
<% end %>
<% if can? :answer, @question %>
<%= link_to t('poll_questions.show.answer_this_question'),
@question.poll,
class: 'large button' %>
<% else %>
<%= render 'polls/reasons_for_not_answering', poll: @question.poll %>
<% end %>
</div>
<div class="small-12 medium-3 column info">
<p>
<span class="title">
<strong><%= t('poll_questions.show.author') %></strong>
</span>
<br>
<% if @question.author_visible_name.present? %>
<%= @question.author_visible_name %>
<% else %>
<%= link_to @question.author.name, @question.author %>
<% end %>
</p>
<p>
<span class="title">
<strong><%= t('poll_questions.show.poll') %></strong>
</span>
<br>
<%= link_to @question.poll.name, @question.poll %>
</p>
<p>
<span class="title">
<strong><%= t('poll_questions.show.dates_title') %></strong>
</span>
<br>
<%= poll_dates(@question.poll) %>
</p>
</div>
</div>
</div>
<% if @question.video_url.present? %>
<div class="row margin-top poll-question-show">
<div class="small-12 medium-9 column">
<div class="video-link">
<p>
<span class="icon-video"></span>&nbsp;
<strong><%= t('proposals.show.title_video_url') %></strong>
</p>
<%= text_with_links @question.video_url %>
</div>
</div>
</div>
<% end %>
<div class="row margin-top">
<div class="small-12 medium-9 column">
<h3><%= t('poll_questions.show.more_info') %></h3>
<%= @question.description %>
</div>
</div>
<div class="tabs-content" data-tabs-content="questions-tabs" role="tablist">
<%= render "polls/questions/filter_subnav" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render "polls/questions/comments" %>
</div>
<div class="tabs-panel" id="tab-documents">
<%= render 'documents/documents',
documents: @question.documents,
max_documents_allowed: Poll::Question.max_documents_allowed %>
</div>
</div>

View File

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