Merge branch 'master' into question-answer-documents
This commit is contained in:
@@ -56,8 +56,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
||||
private
|
||||
|
||||
def question_params
|
||||
params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :valid_answers, :video_url,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||
params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :valid_answers, :video_url)
|
||||
end
|
||||
|
||||
def search_params
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
class Poll::Question < ActiveRecord::Base
|
||||
include Measurable
|
||||
include Searchable
|
||||
include Documentable
|
||||
documentable max_documents_allowed: 1,
|
||||
max_file_size: 3.megabytes,
|
||||
accepted_content_types: [ "application/pdf" ]
|
||||
accepts_nested_attributes_for :documents, allow_destroy: true
|
||||
|
||||
acts_as_paranoid column: :hidden_at
|
||||
include ActsAsParanoidAliases
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
<%= f.hidden_field :proposal_id %>
|
||||
|
||||
|
||||
<div class="small-12">
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<%= f.select :poll_id,
|
||||
@@ -15,10 +14,6 @@
|
||||
|
||||
<%= 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="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>
|
||||
|
||||
@@ -79,11 +79,3 @@
|
||||
<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 %>
|
||||
|
||||
@@ -601,7 +601,6 @@ en:
|
||||
valid_answers: Valid answers
|
||||
add_answer: Add answer
|
||||
video_url: External video
|
||||
documents: Documents
|
||||
answers:
|
||||
title: Answer
|
||||
description: Description
|
||||
|
||||
@@ -601,7 +601,6 @@ es:
|
||||
valid_answers: Respuestas válidas
|
||||
add_answer: Añadir respuesta
|
||||
video_url: Video externo
|
||||
documents: Documentos
|
||||
answers:
|
||||
title: Respuesta
|
||||
description: Descripción
|
||||
|
||||
@@ -111,22 +111,4 @@ feature 'Admin poll questions' do
|
||||
|
||||
pending "Mark all city by default when creating a poll question from a successful proposal"
|
||||
|
||||
it_behaves_like "nested documentable",
|
||||
"administrator",
|
||||
"poll_question",
|
||||
"new_admin_question_path",
|
||||
{ },
|
||||
"documentable_fill_new_valid_poll_question",
|
||||
"Save",
|
||||
"Star Wars: Episode IV - A New Hope"
|
||||
|
||||
it_behaves_like "nested documentable",
|
||||
"administrator",
|
||||
"poll_question",
|
||||
"edit_admin_question_path",
|
||||
{ "id": "id" },
|
||||
nil,
|
||||
"Save",
|
||||
"Changes saved"
|
||||
|
||||
end
|
||||
|
||||
@@ -264,7 +264,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -276,7 +275,7 @@ rescue
|
||||
return
|
||||
end
|
||||
|
||||
def documentable_attach_new_file(documentable_factory_name, index, path, success = true)
|
||||
def documentable_attach_new_file(_documentable_factory_name, index, path, success = true)
|
||||
click_link "Add new document"
|
||||
document = all(".document")[index]
|
||||
document_input = document.find("input[type=file]", visible: false)
|
||||
@@ -319,8 +318,3 @@ def documentable_fill_new_valid_budget_investment
|
||||
fill_in_ckeditor "budget_investment_description", with: "Budget investment description"
|
||||
check :budget_investment_terms_of_service
|
||||
end
|
||||
|
||||
def documentable_fill_new_valid_poll_question
|
||||
page.select documentable.poll.name, from: 'poll_question_poll_id'
|
||||
fill_in 'poll_question_title', with: "Star Wars: Episode IV - A New Hope"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user