Move proposals form partial to a component
Since now categories are loaded in both the investment form component and proposal form component, and their controllers are the only "commentable" controllers using the `@categories` instance variable, we can remove the `load_categories` call in `CommentableActions` affecting the create and update actions.
This commit is contained in:
17
app/components/proposals/form_component.rb
Normal file
17
app/components/proposals/form_component.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Proposals::FormComponent < ApplicationComponent
|
||||
include TranslatableFormHelper
|
||||
include GlobalizeHelper
|
||||
attr_reader :proposal, :url
|
||||
delegate :current_user, :suggest_data, :geozone_select_options, to: :helpers
|
||||
|
||||
def initialize(proposal, url:)
|
||||
@proposal = proposal
|
||||
@url = url
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def categories
|
||||
Tag.category.order(:name)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user