Class: Decidim::AuthorCell

Inherits:
ViewModel
  • Object
show all
Includes:
CellsHelper, FollowableHelper, Messaging::ConversationHelper, Devise::Controllers::Helpers, Devise::Controllers::UrlHelpers, ERB::Util
Defined in:
app/cells/decidim/author_cell.rb

Overview

This cell renders the author of a resource. It is intended to be used below resource titles to indicate its authorship & such, and is intended for resources that have a single author.

Direct Known Subclasses

VersionAuthorCell

Constant Summary collapse

LAYOUTS =
[:default, :compact, :avatar].freeze

Instance Method Summary collapse

Methods included from FollowableHelper

#follow_button_for

Methods included from Messaging::ConversationHelper

#conversation_between, #conversation_between_multiple, #conversation_label_for, #conversation_name_for, #current_or_new_conversation_path_with, #current_or_new_conversation_path_with_multiple, #current_or_new_profile_conversation_path, #current_or_new_user_conversation_path, #link_to_current_or_new_conversation_with, #text_link_to_current_or_new_conversation_with, #username_list

Methods included from CellsHelper

#current_component, #flaggable?, #from_context, #index_action?, #show_action?, #user_flaggable?, #withdrawable?

Instance Method Details

#author_nameObject



22
23
24
# File 'app/cells/decidim/author_cell.rb', line 22

def author_name
  options[:author_name_text] || model.name
end

#context_actions_optionsObject



38
39
40
41
42
43
# File 'app/cells/decidim/author_cell.rb', line 38

def context_actions_options
  return unless options.has_key?(:context_actions)
  return [] if options[:context_actions].blank?

  @context_actions_options ||= options[:context_actions].map(&:to_sym)
end

#display_nameObject



26
27
28
# File 'app/cells/decidim/author_cell.rb', line 26

def display_name
  model.deleted? ? t("decidim.profile.deleted") : decidim_sanitize(author_name)
end

#flag_userObject



30
31
32
# File 'app/cells/decidim/author_cell.rb', line 30

def flag_user
  render unless current_user == model
end

#raw_modelObject



34
35
36
# File 'app/cells/decidim/author_cell.rb', line 34

def raw_model
  model.try(:__getobj__) || model
end