Moves attributes to a concern.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Admin::MilestonesController < Admin::BaseController
|
||||
include Translatable
|
||||
include ImagesHelper
|
||||
include ImageAttributes
|
||||
|
||||
before_action :load_milestoneable, only: [:index, :new, :create, :edit, :update, :destroy]
|
||||
before_action :load_milestone, only: [:edit, :update, :destroy]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
include Translatable
|
||||
include ImagesHelper
|
||||
include ImageAttributes
|
||||
load_and_authorize_resource
|
||||
|
||||
before_action :load_search, only: [:search_booths, :search_officers]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Admin::Widget::CardsController < Admin::BaseController
|
||||
include Translatable
|
||||
include ImagesHelper
|
||||
include ImageAttributes
|
||||
|
||||
def new
|
||||
@card = ::Widget::Card.new(header: header_card?)
|
||||
|
||||
@@ -4,7 +4,7 @@ module Budgets
|
||||
include FeatureFlags
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImagesHelper
|
||||
include ImageAttributes
|
||||
|
||||
before_action :authenticate_user!, except: [:index, :show, :json_data]
|
||||
|
||||
|
||||
8
app/controllers/concerns/image_attributes.rb
Normal file
8
app/controllers/concerns/image_attributes.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
module ImageAttributes
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def image_attributes
|
||||
[:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
class Legislation::ProposalsController < Legislation::BaseController
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImagesHelper
|
||||
include ImageAttributes
|
||||
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||
|
||||
@@ -2,7 +2,7 @@ class ProposalsController < ApplicationController
|
||||
include FeatureFlags
|
||||
include CommentableActions
|
||||
include FlagActions
|
||||
include ImagesHelper
|
||||
include ImageAttributes
|
||||
|
||||
before_action :parse_tag_filter, only: :index
|
||||
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||
|
||||
@@ -76,8 +76,4 @@ 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