Solves #3153. It refactors images attributes.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class Admin::MilestonesController < Admin::BaseController
|
||||
include Translatable
|
||||
include ImagesHelper
|
||||
|
||||
before_action :load_milestoneable, only: [:index, :new, :create, :edit, :update, :destroy]
|
||||
before_action :load_milestone, only: [:edit, :update, :destroy]
|
||||
@@ -41,7 +42,6 @@ class Admin::MilestonesController < Admin::BaseController
|
||||
private
|
||||
|
||||
def milestone_params
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
documents_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
attributes = [:publication_date, :status_id,
|
||||
translation_params(Milestone),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
include Translatable
|
||||
include ImagesHelper
|
||||
load_and_authorize_resource
|
||||
|
||||
before_action :load_search, only: [:search_booths, :search_officers]
|
||||
@@ -60,7 +61,6 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
end
|
||||
|
||||
def poll_params
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :results_enabled,
|
||||
:stats_enabled, geozone_ids: [],
|
||||
image_attributes: image_attributes]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Admin::Widget::CardsController < Admin::BaseController
|
||||
include Translatable
|
||||
include ImagesHelper
|
||||
|
||||
def new
|
||||
@card = ::Widget::Card.new(header: header_card?)
|
||||
@@ -40,8 +41,6 @@ class Admin::Widget::CardsController < Admin::BaseController
|
||||
private
|
||||
|
||||
def card_params
|
||||
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
|
||||
params.require(:widget_card).permit(
|
||||
:link_url, :button_text, :button_url, :alignment, :header,
|
||||
translation_params(Widget::Card),
|
||||
|
||||
@@ -4,6 +4,7 @@ module Budgets
|
||||
include FeatureFlags
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImagesHelper
|
||||
|
||||
before_action :authenticate_user!, except: [:index, :show, :json_data]
|
||||
|
||||
@@ -136,7 +137,7 @@ module Budgets
|
||||
params.require(:budget_investment)
|
||||
.permit(:title, :description, :heading_id, :tag_list,
|
||||
:organization_name, :location, :terms_of_service, :skip_map,
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom])
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Legislation::ProposalsController < Legislation::BaseController
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImagesHelper
|
||||
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||
@@ -54,7 +55,7 @@ class Legislation::ProposalsController < Legislation::BaseController
|
||||
params.require(:legislation_proposal).permit(:legislation_process_id, :title,
|
||||
:question, :summary, :description, :video_url, :tag_list,
|
||||
:terms_of_service, :geozone_id,
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id])
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ class ProposalsController < ApplicationController
|
||||
include FeatureFlags
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImagesHelper
|
||||
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||
@@ -92,7 +93,7 @@ class ProposalsController < ApplicationController
|
||||
def proposal_params
|
||||
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, :video_url,
|
||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id, :skip_map,
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
image_attributes: image_attributes,
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
map_location_attributes: [:latitude, :longitude, :zoom])
|
||||
end
|
||||
|
||||
@@ -76,4 +76,8 @@ module ImagesHelper
|
||||
"direct_upload[resource_relation]": "image")
|
||||
end
|
||||
|
||||
def image_attributes
|
||||
[:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user