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