Move map_location attributes to concern
This commit is contained in:
@@ -5,6 +5,7 @@ module Budgets
|
||||
include FlagActions
|
||||
include RandomSeed
|
||||
include ImageAttributes
|
||||
include MapLocationAttributes
|
||||
include Translatable
|
||||
include InvestmentFilters
|
||||
|
||||
@@ -136,7 +137,7 @@ module Budgets
|
||||
:terms_of_service, :skip_map, :related_sdg_list,
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom]]
|
||||
map_location_attributes: map_location_attributes]
|
||||
params.require(:budget_investment).permit(attributes, translation_params(Budget::Investment))
|
||||
end
|
||||
|
||||
|
||||
7
app/controllers/concerns/map_location_attributes.rb
Normal file
7
app/controllers/concerns/map_location_attributes.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module MapLocationAttributes
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def map_location_attributes
|
||||
[:latitude, :longitude, :zoom]
|
||||
end
|
||||
end
|
||||
@@ -2,6 +2,7 @@ class Management::ProposalsController < Management::BaseController
|
||||
include HasOrders
|
||||
include CommentableActions
|
||||
include Translatable
|
||||
include MapLocationAttributes
|
||||
|
||||
before_action :only_verified_users, except: :print
|
||||
before_action :set_proposal, only: [:vote, :show]
|
||||
@@ -56,7 +57,7 @@ class Management::ProposalsController < Management::BaseController
|
||||
def proposal_params
|
||||
attributes = [:video_url, :responsible_name, :tag_list,
|
||||
:terms_of_service, :geozone_id,
|
||||
:skip_map, map_location_attributes: [:latitude, :longitude, :zoom]]
|
||||
:skip_map, map_location_attributes: map_location_attributes]
|
||||
params.require(:proposal).permit(attributes, translation_params(Proposal))
|
||||
end
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ class ProposalsController < ApplicationController
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImageAttributes
|
||||
include MapLocationAttributes
|
||||
include Translatable
|
||||
|
||||
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||
@@ -103,7 +104,7 @@ class ProposalsController < ApplicationController
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment,
|
||||
:user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom]]
|
||||
map_location_attributes: map_location_attributes]
|
||||
translations_attributes = translation_params(Proposal, except: :retired_explanation)
|
||||
params.require(:proposal).permit(attributes, translations_attributes)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user