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