Class: Integral::BaseDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/integral/base_decorator.rb

Overview

Base decorator for Integral view-level logic

Instance Method Summary collapse

Instance Method Details

#activity_url(activity_id) ⇒ String

Returns URL to backend activity.

Returns:

  • (String)

    URL to backend activity



7
8
9
# File 'app/decorators/integral/base_decorator.rb', line 7

def activity_url(activity_id)
  engine_url_helpers.send("activity_backend_#{object.class.model_name.singular_route_key}_url", object.id, activity_id)
end

#backend_urlString

Returns URL to backend page.

Returns:

  • (String)

    URL to backend page



17
18
19
# File 'app/decorators/integral/base_decorator.rb', line 17

def backend_url
  engine_url_helpers.send("backend_#{object.class.model_name.singular_route_key}_url", object.id)
end

#edit_backend_urlString

Returns URL to backend edit page.

Returns:

  • (String)

    URL to backend edit page



12
13
14
# File 'app/decorators/integral/base_decorator.rb', line 12

def edit_backend_url
  engine_url_helpers.send("edit_backend_#{object.class.model_name.singular_route_key}_url", object.id)
end

#render_active_block_listObject



36
37
38
# File 'app/decorators/integral/base_decorator.rb', line 36

def render_active_block_list
  helpers.render_block_list(active_block_list)
end

#to_backend_cardObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/decorators/integral/base_decorator.rb', line 21

def to_backend_card
  attributes = [
    { key: I18n.t('integral.records.attributes.id'), value: id },
    { key: I18n.t('integral.records.attributes.updated_at'), value: I18n.l(updated_at) },
    { key: I18n.t('integral.records.attributes.created_at'), value: I18n.l(created_at) }
  ]

  {
    image: nil,
    description: nil,
    url: backend_url,
    attributes: attributes
  }
end