Simplify using helper methods in components

The `use_helpers` method was added in ViewComponent 3.8.0, and it's
included by default in all components since version 3.11.0.

Note we sometimes delegated the `can?` method to the controller instead
of the helpers, for no particularly reason. We're unifying that code as
well.
This commit is contained in:
Javi Martín
2024-02-23 22:34:01 +01:00
parent 52ec5094f0
commit 1d955b7a20
70 changed files with 70 additions and 70 deletions

View File

@@ -1,6 +1,6 @@
class Admin::AllowedTableActionsComponent < ApplicationComponent class Admin::AllowedTableActionsComponent < ApplicationComponent
attr_reader :record, :options attr_reader :record, :options
delegate :can?, to: :helpers use_helpers :can?
delegate :action, to: :table_actions_component delegate :action, to: :table_actions_component
def initialize(record, **options) def initialize(record, **options)

View File

@@ -1,6 +1,6 @@
class Admin::Budgets::CalculateWinnersButtonComponent < ApplicationComponent class Admin::Budgets::CalculateWinnersButtonComponent < ApplicationComponent
attr_reader :budget, :from_investments attr_reader :budget, :from_investments
delegate :can?, to: :helpers use_helpers :can?
def initialize(budget, from_investments: false) def initialize(budget, from_investments: false)
@budget = budget @budget = budget

View File

@@ -1,5 +1,5 @@
class Admin::Budgets::DraftingComponent < ApplicationComponent class Admin::Budgets::DraftingComponent < ApplicationComponent
delegate :can?, to: :controller use_helpers :can?
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)

View File

@@ -1,6 +1,6 @@
class Admin::Budgets::LinksComponent < ApplicationComponent class Admin::Budgets::LinksComponent < ApplicationComponent
attr_reader :budget attr_reader :budget
delegate :can?, to: :helpers use_helpers :can?
def initialize(budget) def initialize(budget)
@budget = budget @budget = budget

View File

@@ -1,5 +1,5 @@
class Admin::BudgetsWizard::BaseComponent < ApplicationComponent class Admin::BudgetsWizard::BaseComponent < ApplicationComponent
delegate :single_heading?, :url_params, to: :helpers use_helpers :single_heading?, :url_params
def budget_mode def budget_mode
helpers.budget_mode || "multiple" helpers.budget_mode || "multiple"

View File

@@ -1,7 +1,7 @@
class Admin::BudgetsWizard::Budgets::NewComponent < ApplicationComponent class Admin::BudgetsWizard::Budgets::NewComponent < ApplicationComponent
include Header include Header
attr_reader :budget attr_reader :budget
delegate :single_heading?, to: :helpers use_helpers :single_heading?
def initialize(budget) def initialize(budget)
@budget = budget @budget = budget

View File

@@ -1,6 +1,6 @@
class Admin::MenuComponent < ApplicationComponent class Admin::MenuComponent < ApplicationComponent
include LinkListHelper include LinkListHelper
delegate :can?, to: :helpers use_helpers :can?
def links def links
[ [

View File

@@ -1,5 +1,5 @@
class Admin::Organizations::TableActionsComponent < ApplicationComponent class Admin::Organizations::TableActionsComponent < ApplicationComponent
delegate :can?, to: :controller use_helpers :can?
attr_reader :organization attr_reader :organization
def initialize(organization) def initialize(organization)

View File

@@ -1,6 +1,6 @@
class Admin::Poll::Questions::Answers::Documents::IndexComponent < ApplicationComponent class Admin::Poll::Questions::Answers::Documents::IndexComponent < ApplicationComponent
attr_reader :answer attr_reader :answer
delegate :can?, to: :helpers use_helpers :can?
def initialize(answer) def initialize(answer)
@answer = answer @answer = answer

View File

@@ -1,6 +1,6 @@
class Admin::Poll::Questions::FilterComponent < ApplicationComponent class Admin::Poll::Questions::FilterComponent < ApplicationComponent
attr_reader :polls attr_reader :polls
delegate :current_path_with_query_params, to: :helpers use_helpers :current_path_with_query_params
def initialize(polls) def initialize(polls)
@polls = polls @polls = polls

View File

@@ -2,7 +2,7 @@ class Admin::Poll::Questions::FormComponent < ApplicationComponent
include TranslatableFormHelper include TranslatableFormHelper
include GlobalizeHelper include GlobalizeHelper
attr_reader :question, :url attr_reader :question, :url
delegate :can?, to: :helpers use_helpers :can?
def initialize(question, url:) def initialize(question, url:)
@question = question @question = question

View File

@@ -1,6 +1,6 @@
class Admin::Settings::ContentTypesFormComponent < ApplicationComponent class Admin::Settings::ContentTypesFormComponent < ApplicationComponent
attr_reader :setting, :tab attr_reader :setting, :tab
delegate :dom_id, to: :helpers use_helpers :dom_id
def initialize(setting, tab: nil) def initialize(setting, tab: nil)
@setting = setting @setting = setting

View File

@@ -1,6 +1,6 @@
class Admin::Settings::RowComponent < ApplicationComponent class Admin::Settings::RowComponent < ApplicationComponent
attr_reader :key, :tab, :type attr_reader :key, :tab, :type
delegate :dom_id, to: :helpers use_helpers :dom_id
def initialize(key, type: :text, tab: nil) def initialize(key, type: :text, tab: nil)
@key = key @key = key

View File

@@ -1,6 +1,6 @@
class Admin::Settings::TextFormComponent < ApplicationComponent class Admin::Settings::TextFormComponent < ApplicationComponent
attr_reader :setting, :tab attr_reader :setting, :tab
delegate :dom_id, to: :helpers use_helpers :dom_id
def initialize(setting, tab: nil) def initialize(setting, tab: nil)
@setting = setting @setting = setting

View File

@@ -1,6 +1,6 @@
class Admin::SiteCustomization::InformationTexts::FormFieldComponent < ApplicationComponent class Admin::SiteCustomization::InformationTexts::FormFieldComponent < ApplicationComponent
attr_reader :i18n_content, :locale attr_reader :i18n_content, :locale
delegate :globalize, :site_customization_display_translation_style, to: :helpers use_helpers :globalize, :site_customization_display_translation_style
def initialize(i18n_content, locale:) def initialize(i18n_content, locale:)
@i18n_content = i18n_content @i18n_content = i18n_content

View File

@@ -1,7 +1,7 @@
class Admin::Tenants::NewComponent < ApplicationComponent class Admin::Tenants::NewComponent < ApplicationComponent
include Header include Header
attr_reader :tenant attr_reader :tenant
delegate :current_user, to: :helpers use_helpers :current_user
def initialize(tenant) def initialize(tenant)
@tenant = tenant @tenant = tenant

View File

@@ -1,5 +1,5 @@
class ApplicationComponent < ViewComponent::Base class ApplicationComponent < ViewComponent::Base
include SettingsHelper include SettingsHelper
delegate :back_link_to, :t, to: :helpers use_helpers :back_link_to, :t
delegate :default_form_builder, to: :controller delegate :default_form_builder, to: :controller
end end

View File

@@ -1,6 +1,6 @@
class Attachable::FieldsComponent < ApplicationComponent class Attachable::FieldsComponent < ApplicationComponent
attr_reader :f, :resource_type, :resource_id, :relation_name attr_reader :f, :resource_type, :resource_id, :relation_name
delegate :current_user, :render_image, to: :helpers use_helpers :current_user, :render_image
def initialize(f, resource_type:, resource_id:, relation_name:) def initialize(f, resource_type:, resource_id:, relation_name:)
@f = f @f = f

View File

@@ -1,6 +1,6 @@
class Budgets::BudgetComponent < ApplicationComponent class Budgets::BudgetComponent < ApplicationComponent
attr_reader :budget attr_reader :budget
delegate :attached_background_css, to: :helpers use_helpers :attached_background_css
def initialize(budget) def initialize(budget)
@budget = budget @budget = budget

View File

@@ -1,6 +1,6 @@
class Budgets::Executions::ImageComponent < ApplicationComponent class Budgets::Executions::ImageComponent < ApplicationComponent
attr_reader :investment attr_reader :investment
delegate :image_path_for, to: :helpers use_helpers :image_path_for
def initialize(investment) def initialize(investment)
@investment = investment @investment = investment

View File

@@ -1,5 +1,5 @@
class Budgets::InvestmentComponent < ApplicationComponent class Budgets::InvestmentComponent < ApplicationComponent
delegate :locale_and_user_status, :namespaced_budget_investment_path, :image_path_for, to: :helpers use_helpers :locale_and_user_status, :namespaced_budget_investment_path, :image_path_for
attr_reader :investment attr_reader :investment
def initialize(investment) def initialize(investment)

View File

@@ -1,6 +1,6 @@
class Budgets::Investments::BallotComponent < ApplicationComponent class Budgets::Investments::BallotComponent < ApplicationComponent
attr_reader :investment, :investment_ids, :ballot attr_reader :investment, :investment_ids, :ballot
delegate :current_user, :heading_link, :link_to_verify_account, to: :helpers use_helpers :current_user, :heading_link, :link_to_verify_account
def initialize(investment:, investment_ids:, ballot:) def initialize(investment:, investment_ids:, ballot:)
@investment = investment @investment = investment

View File

@@ -1,5 +1,5 @@
class Budgets::Investments::FiltersComponent < ApplicationComponent class Budgets::Investments::FiltersComponent < ApplicationComponent
delegate :valid_filters, :current_filter, :link_list, :current_path_with_query_params, to: :helpers use_helpers :valid_filters, :current_filter, :link_list, :current_path_with_query_params
def render? def render?
valid_filters&.any? valid_filters&.any?

View File

@@ -2,7 +2,7 @@ class Budgets::Investments::FormComponent < ApplicationComponent
include TranslatableFormHelper include TranslatableFormHelper
include GlobalizeHelper include GlobalizeHelper
attr_reader :investment, :url attr_reader :investment, :url
delegate :current_user, :budget_heading_select_options, :suggest_data, to: :helpers use_helpers :current_user, :budget_heading_select_options, :suggest_data
def initialize(investment, url:) def initialize(investment, url:)
@investment = investment @investment = investment

View File

@@ -1,6 +1,6 @@
class Budgets::Investments::MapComponent < ApplicationComponent class Budgets::Investments::MapComponent < ApplicationComponent
attr_reader :heading, :investments attr_reader :heading, :investments
delegate :render_map, to: :helpers use_helpers :render_map
def initialize(investments, heading:) def initialize(investments, heading:)
@investments = investments @investments = investments

View File

@@ -1,6 +1,6 @@
class Budgets::Investments::MyBallotComponent < ApplicationComponent class Budgets::Investments::MyBallotComponent < ApplicationComponent
attr_reader :ballot, :heading, :investment_ids, :assigned_heading attr_reader :ballot, :heading, :investment_ids, :assigned_heading
delegate :can?, :heading_link, to: :helpers use_helpers :can?, :heading_link
def initialize(ballot:, heading:, investment_ids:, assigned_heading: nil) def initialize(ballot:, heading:, investment_ids:, assigned_heading: nil)
@ballot = ballot @ballot = ballot

View File

@@ -1,6 +1,6 @@
class Budgets::Investments::VotesComponent < ApplicationComponent class Budgets::Investments::VotesComponent < ApplicationComponent
attr_reader :investment attr_reader :investment
delegate :namespace, :current_user, :image_absolute_url, :link_to_verify_account, to: :helpers use_helpers :namespace, :current_user, :image_absolute_url, :link_to_verify_account
def initialize(investment) def initialize(investment)
@investment = investment @investment = investment

View File

@@ -1,5 +1,5 @@
class Budgets::MapComponent < ApplicationComponent class Budgets::MapComponent < ApplicationComponent
delegate :render_map, to: :helpers use_helpers :render_map
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)

View File

@@ -1,5 +1,5 @@
class Budgets::PhasesComponent < ApplicationComponent class Budgets::PhasesComponent < ApplicationComponent
delegate :wysiwyg, :auto_link_already_sanitized_html, to: :helpers use_helpers :wysiwyg, :auto_link_already_sanitized_html
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)

View File

@@ -1,5 +1,5 @@
class Budgets::SubheaderComponent < ApplicationComponent class Budgets::SubheaderComponent < ApplicationComponent
delegate :current_user, :link_to_signin, :link_to_signup, :link_to_verify_account, :can?, to: :helpers use_helpers :current_user, :link_to_signin, :link_to_signup, :link_to_verify_account, :can?
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)

View File

@@ -1,5 +1,5 @@
class Budgets::SupportsInfoComponent < ApplicationComponent class Budgets::SupportsInfoComponent < ApplicationComponent
delegate :current_user, to: :helpers use_helpers :current_user
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)

View File

@@ -2,7 +2,7 @@ class Debates::FormComponent < ApplicationComponent
include TranslatableFormHelper include TranslatableFormHelper
include GlobalizeHelper include GlobalizeHelper
attr_reader :debate attr_reader :debate
delegate :suggest_data, to: :helpers use_helpers :suggest_data
def initialize(debate) def initialize(debate)
@debate = debate @debate = debate

View File

@@ -1,7 +1,7 @@
class Debates::NewComponent < ApplicationComponent class Debates::NewComponent < ApplicationComponent
include Header include Header
attr_reader :debate attr_reader :debate
delegate :new_window_link_to, to: :helpers use_helpers :new_window_link_to
def initialize(debate) def initialize(debate)
@debate = debate @debate = debate

View File

@@ -1,6 +1,6 @@
class Debates::VotesComponent < ApplicationComponent class Debates::VotesComponent < ApplicationComponent
attr_reader :debate attr_reader :debate
delegate :current_user, :link_to_verify_account, to: :helpers use_helpers :current_user, :link_to_verify_account
def initialize(debate) def initialize(debate)
@debate = debate @debate = debate

View File

@@ -1,7 +1,7 @@
class Documents::DocumentComponent < ApplicationComponent class Documents::DocumentComponent < ApplicationComponent
attr_reader :document, :show_destroy_link attr_reader :document, :show_destroy_link
alias_method :show_destroy_link?, :show_destroy_link alias_method :show_destroy_link?, :show_destroy_link
delegate :can?, to: :helpers use_helpers :can?
def initialize(document, show_destroy_link: false) def initialize(document, show_destroy_link: false)
@document = document @document = document

View File

@@ -1,6 +1,6 @@
class Layout::AdminHeaderComponent < ApplicationComponent class Layout::AdminHeaderComponent < ApplicationComponent
attr_reader :user attr_reader :user
delegate :namespace, :namespaced_root_path, :show_admin_menu?, to: :helpers use_helpers :namespace, :namespaced_root_path, :show_admin_menu?
def initialize(user) def initialize(user)
@user = user @user = user

View File

@@ -1,6 +1,6 @@
class Layout::AdminLoginItemsComponent < ApplicationComponent class Layout::AdminLoginItemsComponent < ApplicationComponent
attr_reader :user attr_reader :user
delegate :link_list, :show_admin_menu?, to: :helpers use_helpers :link_list, :show_admin_menu?
def initialize(user) def initialize(user)
@user = user @user = user

View File

@@ -1,5 +1,5 @@
class Layout::CommonHTMLAttributesComponent < ApplicationComponent class Layout::CommonHTMLAttributesComponent < ApplicationComponent
delegate :rtl?, to: :helpers use_helpers :rtl?
private private

View File

@@ -1,5 +1,5 @@
class Layout::FooterComponent < ApplicationComponent class Layout::FooterComponent < ApplicationComponent
delegate :content_block, to: :helpers use_helpers :content_block
def footer_legal_content_block def footer_legal_content_block
content_block("footer_legal") content_block("footer_legal")

View File

@@ -1,5 +1,5 @@
class Layout::LocaleSwitcherComponent < ApplicationComponent class Layout::LocaleSwitcherComponent < ApplicationComponent
delegate :name_for_locale, :link_list, :current_path_with_query_params, :rtl?, to: :helpers use_helpers :name_for_locale, :link_list, :current_path_with_query_params, :rtl?
def render? def render?
locales.size > 1 locales.size > 1

View File

@@ -1,6 +1,6 @@
class Layout::LoginItemsComponent < ApplicationComponent class Layout::LoginItemsComponent < ApplicationComponent
attr_reader :user attr_reader :user
delegate :layout_menu_link_to, to: :helpers use_helpers :layout_menu_link_to
def initialize(user) def initialize(user)
@user = user @user = user

View File

@@ -1,5 +1,5 @@
class Layout::SocialComponent < ApplicationComponent class Layout::SocialComponent < ApplicationComponent
delegate :content_block, to: :helpers use_helpers :content_block
def render? def render?
sites.any? || footer_content_block.present? sites.any? || footer_content_block.present?

View File

@@ -1,3 +1,3 @@
class Layout::SubnavigationComponent < ApplicationComponent class Layout::SubnavigationComponent < ApplicationComponent
delegate :content_block, :layout_menu_link_to, to: :helpers use_helpers :content_block, :layout_menu_link_to
end end

View File

@@ -1,5 +1,5 @@
class Layout::TopLinksComponent < ApplicationComponent class Layout::TopLinksComponent < ApplicationComponent
delegate :content_block, to: :helpers use_helpers :content_block
def render? def render?
top_links_content_block.present? top_links_content_block.present?

View File

@@ -1,6 +1,6 @@
class Legislation::Proposals::VotesComponent < ApplicationComponent class Legislation::Proposals::VotesComponent < ApplicationComponent
attr_reader :proposal attr_reader :proposal
delegate :current_user, :link_to_verify_account, :can?, to: :helpers use_helpers :current_user, :link_to_verify_account, :can?
def initialize(proposal) def initialize(proposal)
@proposal = proposal @proposal = proposal

View File

@@ -1,3 +1,3 @@
class MachineLearning::InfoComponent < ApplicationComponent class MachineLearning::InfoComponent < ApplicationComponent
delegate :current_user, to: :helpers use_helpers :current_user
end end

View File

@@ -1,6 +1,6 @@
class Management::Budgets::PrintInvestments::TableComponent < ApplicationComponent class Management::Budgets::PrintInvestments::TableComponent < ApplicationComponent
attr_reader :budgets attr_reader :budgets
delegate :paginate, to: :helpers use_helpers :paginate
def initialize(budgets) def initialize(budgets)
@budgets = budgets @budgets = budgets

View File

@@ -1,6 +1,6 @@
class Polls::Questions::AnswersComponent < ApplicationComponent class Polls::Questions::AnswersComponent < ApplicationComponent
attr_reader :question attr_reader :question
delegate :can?, :current_user, :user_signed_in?, to: :helpers use_helpers :can?, :current_user, :user_signed_in?
def initialize(question) def initialize(question)
@question = question @question = question

View File

@@ -1,7 +1,7 @@
class Polls::Questions::ReadMoreComponent < ApplicationComponent class Polls::Questions::ReadMoreComponent < ApplicationComponent
with_collection_parameter :question with_collection_parameter :question
attr_reader :question attr_reader :question
delegate :wysiwyg, to: :helpers use_helpers :wysiwyg
def initialize(question:) def initialize(question:)
@question = question @question = question

View File

@@ -2,7 +2,7 @@ class Proposals::FormComponent < ApplicationComponent
include TranslatableFormHelper include TranslatableFormHelper
include GlobalizeHelper include GlobalizeHelper
attr_reader :proposal, :url attr_reader :proposal, :url
delegate :current_user, :suggest_data, :geozone_select_options, to: :helpers use_helpers :current_user, :suggest_data, :geozone_select_options
def initialize(proposal, url:) def initialize(proposal, url:)
@proposal = proposal @proposal = proposal

View File

@@ -1,5 +1,5 @@
class Proposals::GeozonesComponent < ApplicationComponent class Proposals::GeozonesComponent < ApplicationComponent
delegate :image_path_for, to: :helpers use_helpers :image_path_for
def render? def render?
Geozone.any? Geozone.any?

View File

@@ -1,7 +1,7 @@
class Proposals::NewComponent < ApplicationComponent class Proposals::NewComponent < ApplicationComponent
include Header include Header
attr_reader :proposal attr_reader :proposal
delegate :new_window_link_to, to: :helpers use_helpers :new_window_link_to
def initialize(proposal) def initialize(proposal)
@proposal = proposal @proposal = proposal

View File

@@ -1,6 +1,6 @@
class Proposals::VotesComponent < ApplicationComponent class Proposals::VotesComponent < ApplicationComponent
attr_reader :proposal attr_reader :proposal
delegate :current_user, :link_to_verify_account, to: :helpers use_helpers :current_user, :link_to_verify_account
def initialize(proposal, vote_url: nil) def initialize(proposal, vote_url: nil)
@proposal = proposal @proposal = proposal

View File

@@ -1,6 +1,6 @@
class Relationable::RelatedListComponent < ApplicationComponent class Relationable::RelatedListComponent < ApplicationComponent
attr_reader :relationable attr_reader :relationable
delegate :current_user, to: :helpers use_helpers :current_user
def initialize(relationable) def initialize(relationable)
@relationable = relationable @relationable = relationable

View File

@@ -1,6 +1,6 @@
class SDG::FilterLinksComponent < ApplicationComponent class SDG::FilterLinksComponent < ApplicationComponent
attr_reader :records, :related_model, :see_more_link attr_reader :records, :related_model, :see_more_link
delegate :link_list, to: :helpers use_helpers :link_list
def initialize(records, related_model, see_more_link: nil) def initialize(records, related_model, see_more_link: nil)
@records = records @records = records

View File

@@ -1,6 +1,6 @@
class SDG::Goals::IndexComponent < ApplicationComponent class SDG::Goals::IndexComponent < ApplicationComponent
attr_reader :goals, :header, :phases attr_reader :goals, :header, :phases
delegate :link_list, to: :helpers use_helpers :link_list
def initialize(goals, header:, phases:) def initialize(goals, header:, phases:)
@goals = goals @goals = goals

View File

@@ -1,6 +1,6 @@
class SDG::RelatedListSelectorComponent < ApplicationComponent class SDG::RelatedListSelectorComponent < ApplicationComponent
attr_reader :f attr_reader :f
delegate :new_window_link_to, to: :helpers use_helpers :new_window_link_to
def initialize(form) def initialize(form)
@f = form @f = form

View File

@@ -1,6 +1,6 @@
class Shared::AgreeWithTermsOfServiceFieldComponent < ApplicationComponent class Shared::AgreeWithTermsOfServiceFieldComponent < ApplicationComponent
attr_reader :form attr_reader :form
delegate :new_window_link_to, to: :helpers use_helpers :new_window_link_to
def initialize(form) def initialize(form)
@form = form @form = form

View File

@@ -1,6 +1,6 @@
class Shared::AvatarComponent < ApplicationComponent class Shared::AvatarComponent < ApplicationComponent
attr_reader :record, :given_options attr_reader :record, :given_options
delegate :avatar_image, to: :helpers use_helpers :avatar_image
def initialize(record, **given_options) def initialize(record, **given_options)
@record = record @record = record

View File

@@ -1,6 +1,6 @@
class Shared::CommentsComponent < ApplicationComponent class Shared::CommentsComponent < ApplicationComponent
attr_reader :record, :comment_tree attr_reader :record, :comment_tree
delegate :current_user, :current_order, :locale_and_user_status, :commentable_cache_key, to: :helpers use_helpers :current_user, :current_order, :locale_and_user_status, :commentable_cache_key
def initialize(record, comment_tree) def initialize(record, comment_tree)
@record = record @record = record

View File

@@ -1,6 +1,6 @@
class Shared::GeozoneLinkComponent < ApplicationComponent class Shared::GeozoneLinkComponent < ApplicationComponent
attr_reader :geozonable, :link attr_reader :geozonable, :link
delegate :geozone_name, to: :helpers use_helpers :geozone_name
def initialize(geozonable, link) def initialize(geozonable, link)
@geozonable = geozonable @geozonable = geozonable

View File

@@ -1,6 +1,6 @@
class Shared::InFavorAgainstComponent < ApplicationComponent class Shared::InFavorAgainstComponent < ApplicationComponent
attr_reader :votable attr_reader :votable
delegate :votes_percentage, to: :helpers use_helpers :votes_percentage
def initialize(votable) def initialize(votable)
@votable = votable @votable = votable

View File

@@ -1,6 +1,6 @@
class Shared::ModerationActionsComponent < ApplicationComponent class Shared::ModerationActionsComponent < ApplicationComponent
attr_reader :record attr_reader :record
delegate :can?, to: :helpers use_helpers :can?
def initialize(record) def initialize(record)
@record = record @record = record

View File

@@ -1,6 +1,6 @@
class Shared::OrderLinksComponent < ApplicationComponent class Shared::OrderLinksComponent < ApplicationComponent
attr_reader :i18n_namespace, :anchor attr_reader :i18n_namespace, :anchor
delegate :current_path_with_query_params, :current_order, :valid_orders, to: :helpers use_helpers :current_path_with_query_params, :current_order, :valid_orders
def initialize(i18n_namespace, anchor: nil) def initialize(i18n_namespace, anchor: nil)
@i18n_namespace = i18n_namespace @i18n_namespace = i18n_namespace

View File

@@ -1,6 +1,6 @@
class Shared::ParticipationNotAllowedComponent < ApplicationComponent class Shared::ParticipationNotAllowedComponent < ApplicationComponent
attr_reader :votable, :cannot_vote_text attr_reader :votable, :cannot_vote_text
delegate :current_user, :link_to_signin, :link_to_signup, to: :helpers use_helpers :current_user, :link_to_signin, :link_to_signup
def initialize(votable, cannot_vote_text:) def initialize(votable, cannot_vote_text:)
@votable = votable @votable = votable

View File

@@ -1,6 +1,6 @@
class Shared::TagListComponent < ApplicationComponent class Shared::TagListComponent < ApplicationComponent
attr_reader :taggable, :limit attr_reader :taggable, :limit
delegate :link_list, to: :helpers use_helpers :link_list
def initialize(taggable, limit:) def initialize(taggable, limit:)
@taggable = taggable @taggable = taggable

View File

@@ -1,6 +1,6 @@
class Shared::VoteButtonComponent < ApplicationComponent class Shared::VoteButtonComponent < ApplicationComponent
attr_reader :votable, :value, :options attr_reader :votable, :value, :options
delegate :current_user, :can?, to: :helpers use_helpers :current_user, :can?
def initialize(votable, value:, **options) def initialize(votable, value:, **options)
@votable = votable @votable = votable

View File

@@ -1,6 +1,6 @@
class Users::PublicActivityComponent < ApplicationComponent class Users::PublicActivityComponent < ApplicationComponent
attr_reader :user attr_reader :user
delegate :current_user, :valid_interests_access?, :current_path_with_query_params, to: :helpers use_helpers :current_user, :valid_interests_access?, :current_path_with_query_params
def initialize(user) def initialize(user)
@user = user @user = user

View File

@@ -2,7 +2,7 @@ class Valuation::Budgets::RowComponent < ApplicationComponent
attr_reader :budget attr_reader :budget
with_collection_parameter :budget with_collection_parameter :budget
delegate :current_user, to: :helpers use_helpers :current_user
def initialize(budget:) def initialize(budget:)
@budget = budget @budget = budget

View File

@@ -1,5 +1,5 @@
class Widget::Feeds::ProcessComponent < ApplicationComponent class Widget::Feeds::ProcessComponent < ApplicationComponent
delegate :image_path_for, to: :helpers use_helpers :image_path_for
attr_reader :process attr_reader :process
def initialize(process) def initialize(process)