Class: Decidim::RedesignedAuthorCell

Inherits:
ViewModel
  • Object
show all
Includes:
CellsHelper, Messaging::ConversationHelper, SanitizeHelper, Devise::Controllers::Helpers, Devise::Controllers::UrlHelpers, ERB::Util, LayoutHelper
Defined in:
decidim-core/app/cells/decidim/redesigned_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.

Constant Summary collapse

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

Instance Method Summary collapse

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, #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



24
25
26
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 24

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

#context_actions_optionsObject



48
49
50
51
52
53
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 48

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



28
29
30
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 28

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

#flag_userObject



40
41
42
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 40

def flag_user
  render unless current_user == model
end

#perform_caching?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 44

def perform_caching?
  true
end

#profileObject



36
37
38
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 36

def profile
  render
end

#showObject



32
33
34
# File 'decidim-core/app/cells/decidim/redesigned_author_cell.rb', line 32

def show
  render layout
end