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:
Javi Martín
2021-07-09 16:03:44 +02:00
parent 755ad330a2
commit 4150d7f1be
6 changed files with 128 additions and 116 deletions

View 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