adds admin poll question's show

This commit is contained in:
rgarcia
2016-11-17 10:45:37 +01:00
parent d9ad658758
commit 198b0018f7
5 changed files with 57 additions and 4 deletions

View File

@@ -17,19 +17,21 @@ class Admin::Poll::QuestionsController < Admin::BaseController
@question.author = @question.proposal.try(:author) || current_user
if @question.save
redirect_to question_path(@question)
redirect_to admin_question_path(@question)
else
render :new
end
end
def edit
def show
end
def edit
end
def update
if @question.update(question_params)
redirect_to question_path(@question), notice: t("flash.actions.save_changes.notice")
redirect_to admin_question_path(@question), notice: t("flash.actions.save_changes.notice")
else
render :edit
end

View File

@@ -0,0 +1,37 @@
<% if @question.proposal.present? %>
<div>
<%= I18n.t("admin.questions.show.proposal") %>:
<%= @question.proposal.title %>
</div>
<% end %>
<div class="small-12 column">
<div>
<%= I18n.t("admin.questions.show.title") %>:
<%= @question.title %>
</div>
<div>
<%= I18n.t("admin.questions.show.valid_answers") %>:
<%= @question.valid_answers.join(", ") %>
</div>
<div>
<%= I18n.t("admin.questions.show.summary") %>:
<%= @question.summary %>
</div>
<div>
<%= I18n.t("admin.questions.show.description") %>:
<%= @question.description %>
</div>
<div>
<%= I18n.t("admin.questions.show.geozones") %>:
<% @question.geozones.each do |geozone| %>
<div>
<% geozone.name %>
</div>
<% end %>
</div>
</div>

View File

@@ -185,6 +185,13 @@ en:
title: "Edit Question"
new:
title: "Create Question"
show:
proposal: Proposal
title: Title
valid_answers: Valid answers
summary: Summary
description: Description
geozones: Geozones
booths:
index:
title: "List of booths"

View File

@@ -185,6 +185,13 @@ es:
title: "Editar pregunta ciudadana"
new:
title: "Crear pregunta ciudadana"
show:
proposal: Propuesta Ciudadana
title: Título
valid_answers: Respuestas válidas
summary: Resumen
description: Descripción
geozones: Distritos
booths:
index:
title: "Lista de urnas"

View File

@@ -190,7 +190,7 @@ Rails.application.routes.draw do
resources :polls do
resources :booths
end
resources :questions, except: :show
resources :questions
end
resources :verifications, controller: :verifications, only: :index do