Class: Magick::AdminUI::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/magick/admin_ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Configuration

Returns a new instance of Configuration.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/magick/admin_ui.rb', line 25

def initialize
  @theme = :light
  @brand_name = 'Magick'
  @require_role = nil
  @available_roles = [] # Can be populated via DSL: admin_ui { roles ['admin', 'user', 'manager'] }
  @available_tags = nil # Can be array or lambda: -> { Tag.all }
  # Lambda receiving the controller, returning who is making the
  # change; stamped onto audit entries (user_id) and versions
  # (created_by): -> (controller) { controller.current_user&.id }
  @current_actor = nil
end

Instance Attribute Details

#available_roles ⇒ Object

Returns the value of attribute available_roles.



22
23
24
# File 'lib/magick/admin_ui.rb', line 22

def available_roles
  @available_roles
end

#available_tags ⇒ Object

Returns the value of attribute available_tags.



22
23
24
# File 'lib/magick/admin_ui.rb', line 22

def available_tags
  @available_tags
end

#brand_name ⇒ Object

Returns the value of attribute brand_name.



22
23
24
# File 'lib/magick/admin_ui.rb', line 22

def brand_name
  @brand_name
end

#current_actor ⇒ Object

Returns the value of attribute current_actor.



22
23
24
# File 'lib/magick/admin_ui.rb', line 22

def current_actor
  @current_actor
end

#require_role ⇒ Object

Returns the value of attribute require_role.



23
24
25
# File 'lib/magick/admin_ui.rb', line 23

def require_role
  @require_role
end

#theme ⇒ Object

Returns the value of attribute theme.



22
23
24
# File 'lib/magick/admin_ui.rb', line 22

def theme
  @theme
end

Instance Method Details

#tags ⇒ Object

Get available tags, calling lambda if needed



60
61
62
63
64
# File 'lib/magick/admin_ui.rb', line 60

def tags
  return [] if @available_tags.nil?
  return @available_tags.call if @available_tags.respond_to?(:call)
  Array(@available_tags)
end