Module: Golden::Theme::Bootstrap::LinkHelper

Defined in:
lib/golden/theme/bootstrap/link_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
# File 'lib/golden/theme/bootstrap/link_helper.rb', line 3

def bootstrap_iconed_link_to text, url, options = {}
  icon_class = options.delete :icon_class
  text = (:i, nil, class: icon_class) << ' ' << text
  link_to text, url, options
end


43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/golden/theme/bootstrap/link_helper.rb', line 43

def bootstrap_link_to_destroy url, options = {}
  icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-trash'
  options = {
    method: :delete,
    data: { confirm: t('helpers.are_you_sure') },
    role: 'button',
    class: 'btn btn-default',
    icon_class: icon_class,
    title: t('helpers.destroy')
  }.deep_merge options
  bootstrap_iconed_link_to nil, url, options
end


32
33
34
35
36
37
38
39
40
41
# File 'lib/golden/theme/bootstrap/link_helper.rb', line 32

def bootstrap_link_to_edit url, options = {}
  icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-edit'
  options = {
    role: 'button',
    class: 'btn btn-default',
    icon_class: icon_class,
    title: t('helpers.edit')
  }.deep_merge options
  bootstrap_iconed_link_to nil, url, options
end


21
22
23
24
25
26
27
28
29
30
# File 'lib/golden/theme/bootstrap/link_helper.rb', line 21

def bootstrap_link_to_new url, options = {}
  icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-plus'
  options = {
    role: 'button',
    class: 'btn btn-default',
    icon_class: icon_class,
    title: t('helpers.new')
  }.deep_merge options
  bootstrap_iconed_link_to nil, url, options
end


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/golden/theme/bootstrap/link_helper.rb', line 9

def bootstrap_link_to_show url, options = {}
  icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-eye-open'
  options = {
    role: 'button',
    class: 'btn btn-default',
    icon_class: icon_class,
    title: t('helpers.show')
  }.deep_merge options
  default_options = {  }
  bootstrap_iconed_link_to nil, url, options
end