Add proposals translation interface

* Convert proposal form into translatable one.
 * Adapt translatable shared spec to define an owner when running at
   frontend feature specs.
 * Remove old attributes from strong parameters.
This commit is contained in:
Senén Rodero Rodríguez
2018-12-23 17:40:10 +01:00
committed by voodoorai2000
parent 4ce006ec96
commit bd3bb72370
5 changed files with 60 additions and 31 deletions

View File

@@ -3,6 +3,7 @@ class ProposalsController < ApplicationController
include CommentableActions
include FlagActions
include ImageAttributes
include Translatable
before_action :parse_tag_filter, only: :index
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
@@ -37,7 +38,6 @@ class ProposalsController < ApplicationController
def create
@proposal = Proposal.new(proposal_params.merge(author: current_user))
if @proposal.save
redirect_to created_proposal_path(@proposal), notice: I18n.t("flash.actions.create.proposal")
else
@@ -98,12 +98,13 @@ class ProposalsController < ApplicationController
private
def proposal_params
params.require(:proposal).permit(:title, :summary, :description, :video_url,
:responsible_name, :tag_list, :terms_of_service,
:geozone_id, :skip_map, image_attributes: image_attributes,
documents_attributes: [:id, :title, :attachment,
:cached_attachment, :user_id, :_destroy],
map_location_attributes: [:latitude, :longitude, :zoom])
attributes = [:video_url,:responsible_name, :tag_list,
:terms_of_service, :geozone_id, :skip_map,
image_attributes: image_attributes,
documents_attributes: [:id, :title, :attachment, :cached_attachment,
:user_id, :_destroy],
map_location_attributes: [:latitude, :longitude, :zoom]]
params.require(:proposal).permit(attributes, translation_params(Proposal))
end
def retired_params