cirandas.net

ref: master

plugins/profile_description_block/lib/profile_description_block.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class ProfileDescriptionBlock < Block
  settings_items :show_name, :type => :boolean,
                 :default => false

  attr_accessor :show_name

  def self.description
    _('Profile Description')
  end

  def help
    _('this block displays the description field of the profile')
  end

  def default_title
    _('PROFILE DESCRIPTION')
  end

  def api_content(params = {})
    description = self.owner.description.present? ? self.owner.description : _("Description field is empty or not enabled on enviroment")
    hash = { description: description }
    Grape::Presenters::Presenter.represent(hash).as_json
  end

  def cacheable?
    false
  end

end