Module: Elabs::ContentHelper

Defined in:
app/helpers/elabs/content_helper.rb

Instance Method Summary collapse

Instance Method Details



27
28
29
30
31
32
33
34
35
36
37
# File 'app/helpers/elabs/content_helper.rb', line 27

def namespace_destroy_link(namespace, singular_model, entity, confirm = true)
  link_params = {
    title:  _('Destroy'),
    method: :delete,
    class:  'btn btn--small btn--destroy'
  }
  link_params[:data] = { confirm: _('Are you sure?') } if confirm
  link_to send("#{namespace}_#{singular_model}_path".to_sym, entity), link_params do
    icon('trash', ['fw'])
  end
end


19
20
21
22
23
24
25
# File 'app/helpers/elabs/content_helper.rb', line 19

def namespace_edit_link(namespace, singular_model, entity)
  link_to send("edit_#{namespace}_#{singular_model}_path", entity),
          title: _('Edit'),
          class: 'btn btn--small btn--edit' do
    icon('pencil-alt', ['fw'])
  end
end


11
12
13
14
15
16
17
# File 'app/helpers/elabs/content_helper.rb', line 11

def namespace_show_link(namespace, singular_model, entity)
  link_to send("#{namespace}_#{singular_model}_path", entity),
          title: _('View online'),
          class: 'btn btn--small btn--show' do
    icon('eye', ['fw'])
  end
end


3
4
5
6
7
8
9
# File 'app/helpers/elabs/content_helper.rb', line 3

def show_online_link(entity)
  link_to entity,
          title: _('View online'),
          class: 'btn btn--small btn--show' do
    icon('eye', ['fw'])
  end
end