Moves attributes to a concern.

This commit is contained in:
rogelio-o
2019-01-14 20:26:47 +01:00
parent ea76179002
commit f1bb1ff8de
8 changed files with 14 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
class Admin::MilestonesController < Admin::BaseController class Admin::MilestonesController < Admin::BaseController
include Translatable include Translatable
include ImagesHelper include ImageAttributes
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]

View File

@@ -1,6 +1,6 @@
class Admin::Poll::PollsController < Admin::Poll::BaseController class Admin::Poll::PollsController < Admin::Poll::BaseController
include Translatable include Translatable
include ImagesHelper include ImageAttributes
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]

View File

@@ -1,6 +1,6 @@
class Admin::Widget::CardsController < Admin::BaseController class Admin::Widget::CardsController < Admin::BaseController
include Translatable include Translatable
include ImagesHelper include ImageAttributes
def new def new
@card = ::Widget::Card.new(header: header_card?) @card = ::Widget::Card.new(header: header_card?)

View File

@@ -4,7 +4,7 @@ module Budgets
include FeatureFlags include FeatureFlags
include CommentableActions include CommentableActions
include FlagActions include FlagActions
include ImagesHelper include ImageAttributes
before_action :authenticate_user!, except: [:index, :show, :json_data] before_action :authenticate_user!, except: [:index, :show, :json_data]

View File

@@ -0,0 +1,8 @@
module ImageAttributes
extend ActiveSupport::Concern
def image_attributes
[:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
end
end

View File

@@ -1,7 +1,7 @@
class Legislation::ProposalsController < Legislation::BaseController class Legislation::ProposalsController < Legislation::BaseController
include CommentableActions include CommentableActions
include FlagActions include FlagActions
include ImagesHelper include ImageAttributes
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]

View File

@@ -2,7 +2,7 @@ class ProposalsController < ApplicationController
include FeatureFlags include FeatureFlags
include CommentableActions include CommentableActions
include FlagActions include FlagActions
include ImagesHelper include ImageAttributes
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]

View File

@@ -76,8 +76,4 @@ 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