Method: Scrivito::UserDefinition#description

Defined in:
app/cms/scrivito/user_definition.rb

#description(description_string = nil, &description_proc) ⇒ Object

Note:

The description is calculated “lazily”. The calculated description is cached.

Defines the user description to be displayed in the in-place UI, e.g. in the workspace menu.

Examples:

Displays the user alice as “alice” in the in-place UI:

alice = Scrivito::User.define('alice')

Displays the user bob as “Bob Doe” in the in-place UI:

bob = Scrivito::User.define('bob') do |user|
  user.description('Bob Doe')
end

bob = Scrivito::User.define('bob') do |user|
  user.description do
    'Bob Doe'
  end
end

Parameters:

  • description_string (String) (defaults to: nil)

    the description, defaults to the the user id.

  • description_proc (Proc)

    a proc to calculate the description, defaults to the user id.

See Also:



120
121
122
123
124
125
126
# File 'app/cms/scrivito/user_definition.rb', line 120

def description(description_string = nil, &description_proc)
  if description_string
    description { description_string }
  else
    @description_proc = description_proc
  end
end