Class: Decidim::ViewModel

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

Direct Known Subclasses

Accountability::HighlightedResultsCell, Accountability::HighlightedResultsForComponentCell, Accountability::ResultCell, ActivitiesCell, ActivityCell, AddressCell, Admin::ContentBlockCell, Admin::ResultsPerPageCell, Amendable::AmendButtonCardCell, Amendable::AmendersListCell, Amendable::AnnouncementCell, Amendable::EmendationActionsCell, Amendable::PromoteButtonCardCell, Amendable::WizardStepFormCell, AnnouncementCell, Assemblies::AssemblyCell, Assemblies::AssemblyMemberCell, Assemblies::ContentBlocks::HighlightedAssembliesCell, Assemblies::ContentBlocks::HighlightedAssembliesSettingsFormCell, AuthorCell, BadgeCell, BadgesCell, Blogs::PostCell, Budgets::BaseCell, Budgets::BudgetCell, Budgets::ProjectCell, Budgets::ProjectListItemCell, Budgets::ProjectSelectedStatusCell, Budgets::ProjectVotesCountCell, CardCell, CardMCell, CoauthorshipsCell, CollapsibleListCell, Comments::CommentCardCell, Comments::CommentCell, Comments::CommentFormCell, Comments::CommentThreadCell, Comments::CommentsCell, Conferences::ConferenceAddressCell, Conferences::ConferenceCell, Conferences::ContentBlocks::HighlightedConferencesCell, Conferences::LinkedParticipatorySpacesCell, Conferences::MediaLinkCell, Conferences::PartnerCell, Conferences::PhotoCell, Conferences::PhotosListCell, Conferences::RegistrationTypeCell, Consultations::ConsultationCell, Consultations::ContentBlocks::HighlightedConsultationsCell, Consultations::ContentBlocks::HighlightedConsultationsSettingsFormCell, 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, DateRangeCell, Debates::DebateCell, DiffCell, Elections::ElectionCell, Elections::ElectionPreviewCell, Elections::ElectionResultsCell, Elections::ElectionVoteCtaCell, Elections::RemainingTimeCalloutCell, Elections::VotingStepNavigationCell, EndorsementButtonsCell, EndorsersListCell, FingerprintCell, FlagModalCell, FollowButtonCell, FollowersCell, FollowingCell, Forms::AnswerReadonlyCell, Forms::MatrixReadonlyCell, Forms::QuestionReadonlyCell, Forms::StepNavigationCell, GroupsCell, Initiatives::ContentBlocks::HighlightedInitiativesCell, Initiatives::ContentBlocks::HighlightedInitiativesSettingsFormCell, Initiatives::InitiativeCell, InitiativesVotes::VoteCell, Meetings::ContentBlocks::UpcomingEventsCell, Meetings::HighlightedMeetingsCell, Meetings::HighlightedMeetingsForComponentCell, Meetings::JoinMeetingButtonCell, Meetings::MeetingCell, Meetings::MeetingUrlCell, Meetings::PublicParticipantsListCell, MembersCell, NavbarAdminLinkCell, NewsletterTemplates::BaseCell, NewsletterTemplates::BaseSettingsFormCell, NotificationsCell, PadIframeCell, ParticipatoryProcessGroups::ContentBlocks::HighlightedParticipatoryProcessesCell, ParticipatoryProcessGroups::ContentBlocks::MetadataCell, ParticipatoryProcessGroups::ContentBlocks::TitleCell, ParticipatoryProcesses::ContentBlocks::HighlightedProcessesCell, ParticipatoryProcesses::ContentBlocks::HighlightedProcessesSettingsFormCell, ParticipatoryProcesses::FilteredParticipatoryProcessesCell, ParticipatoryProcesses::ProcessCell, ParticipatoryProcesses::ProcessFiltersCell, ParticipatoryProcesses::ProcessGroupCell, ProfileCell, ProgressBarCell, Proposals::CollaborativeDraftCell, Proposals::CollaborativeDraftLinkToProposalCell, Proposals::CostReportCell, Proposals::HighlightedProposalsCell, Proposals::HighlightedProposalsForComponentCell, Proposals::IrreversibleActionModalCell, Proposals::ParticipatoryTextProposalCell, Proposals::ProposalCell, Proposals::ProposalLinkedResourcesCell, Proposals::ProposalTagsCell, Proposals::ProposalsPickerCell, PublicParticipationCell, ReportedContentCell, RepresentUserGroupCell, ScopesPickerCell, SearchResultsCell, SearchResultsSectionCell, Sortitions::SortitionCell, StatisticCell, StatisticsCell, TagsCell, TosPageCell, TranslationBarCell, UserActivityCell, UserConversationCell, UserConversationsCell, UserGroupPendingInvitationsListCell, UserGroupPendingRequestsListCell, UserTimelineCell, Decidim::Verifications::AuthorizationMetadataCell, Decidim::Verifications::RevocationsCell, VersionAuthorCell, VersionCell, VersionsListCell, VersionsListItemCell, Decidim::Votings::ContentBlocks::HighlightedVotingsCell, Decidim::Votings::ContentBlocks::HighlightedVotingsSettingsFormCell, Decidim::Votings::ContentBlocks::LandingPage::AttachmentsAndFoldersCell, Decidim::Votings::ContentBlocks::LandingPage::DescriptionCell, Decidim::Votings::ContentBlocks::LandingPage::ElectionsCell, Decidim::Votings::ContentBlocks::LandingPage::HeaderCell, Decidim::Votings::ContentBlocks::LandingPage::HeaderSettingsFormCell, Decidim::Votings::ContentBlocks::LandingPage::MetricsCell, Decidim::Votings::ContentBlocks::LandingPage::PollingStationsCell, Decidim::Votings::ContentBlocks::LandingPage::TimelineCell, Decidim::Votings::PollingOfficers::PollingOfficersPickerCell, Decidim::Votings::PollingStationClosureCertificateCell, Decidim::Votings::PollingStationClosureRecountCell, Decidim::Votings::VotingCell, WizardStepFormCell

Instance Method Summary collapse

Methods included from FilterParamsHelper

#filter_link_params

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


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

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

#current_userObject


27
28
29
# File 'decidim-core/lib/decidim/view_model.rb', line 27

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