Class: Decidim::ViewModel

Inherits:
Cell::ViewModel
  • Object
show all
Includes:
ActionController::Helpers, ActionView::Helpers::TranslationHelper, Cell::Caching::Notifications, Cell::Translation, ActionAuthorization, ActionAuthorizationHelper, MarkupHelper, ReplaceButtonsHelper, ResourceHelper, ScopesHelper, Webpacker::Helper
Defined in:
lib/decidim/view_model.rb

Direct Known Subclasses

ActivitiesCell, ActivityCell, AddressCell, Amendable::AmendButtonCardCell, Amendable::AmendersListCell, Amendable::AnnouncementCell, Amendable::EmendationActionsCell, Amendable::PromoteButtonCardCell, Amendable::WizardStepFormCell, AnnouncementCell, AuthorCell, BadgeCell, BadgesCell, CardCell, CardMCell, CoauthorshipsCell, CollapsibleListCell, ContentBlocks::CtaCell, ContentBlocks::CtaSettingsFormCell, ContentBlocks::FooterSubHeroCell, ContentBlocks::HeroCell, ContentBlocks::HeroSettingsFormCell, ContentBlocks::HighlightedContentBannerCell, ContentBlocks::HighlightedElementsCell, ContentBlocks::HighlightedElementsSettingsFormCell, ContentBlocks::HowToParticipateCell, ContentBlocks::HtmlCell, ContentBlocks::HtmlSettingsFormCell, ContentBlocks::LastActivityCell, ContentBlocks::MetricsCell, ContentBlocks::StatsCell, ContentBlocks::SubHeroCell, DataConsentCell, DateRangeCell, DiffCell, EndorsementButtonsCell, EndorsersListCell, FingerprintCell, FlagModalCell, FollowButtonCell, FollowersCell, FollowingCell, GroupsCell, MembersCell, NavbarAdminLinkCell, NewsletterTemplates::BaseCell, NewsletterTemplates::BaseSettingsFormCell, NotificationCell, NotificationsCell, PadIframeCell, ProfileCell, ProgressBarCell, PublicParticipationCell, ReportedContentCell, RepresentUserGroupCell, ScopesPickerCell, SearchResultsCell, SearchResultsSectionCell, StatisticCell, StatisticsCell, TagsCell, TosPageCell, TranslationBarCell, UploadModalCell, UserActivityCell, UserConversationCell, UserConversationsCell, UserGroupPendingInvitationsListCell, UserGroupPendingRequestsListCell, UserTimelineCell, VersionAuthorCell, VersionCell, VersionsListCell, VersionsListItemCell, WizardStepFormCell

Instance Method Summary collapse

Methods included from MarkupHelper

#element_id

Methods included from ReplaceButtonsHelper

#button_to, #submit_tag

Methods included from ActionAuthorizationHelper

#action_authorized_button_to, #action_authorized_link_to, #logged_button_to, #logged_link_to

Methods included from ScopesHelper

#has_visible_scopes?, #scope_name_for_picker, #scopes_picker_field, #scopes_picker_filter, #scopes_picker_tag

Methods included from TranslatableAttributes

#default_locale?

Methods included from DecidimFormHelper

#areas_for_select, #base_error_messages, #decidim_form_for, #decidim_form_slug_url, #editor_field_tag, #form_field_has_error?, #form_required_explanation, #name_with_locale, #scopes_picker_field_tag, #tab_element_class_for, #translated_field_tag

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #linked_resources_for, #resource_locator, #resource_title

Instance Method Details

#callObject



30
31
32
33
34
35
# File 'lib/decidim/view_model.rb', line 30

def call(*)
  identifier = self.class.name.sub(/Cell$/, "").underscore
  instrument(:cell, identifier: identifier) do |_payload|
    super
  end
end

#current_userObject



26
27
28
# File 'lib/decidim/view_model.rb', line 26

def current_user
  context&.dig(:current_user) || controller&.current_user
end