Module: Bizarroids::Slider::ApplicationHelper

Defined in:
app/helpers/bizarroids/slider/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#bizarroids_destroy_button(path, confirm_message) ⇒ Object

TODO extract to gem



14
15
16
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 14

def bizarroids_destroy_button path, confirm_message
  bizarroids_button path, :trash, method: :delete, data: { confirm: confirm_message }
end

#bizarroids_edit_button(path) ⇒ Object

TODO extract to gem



9
10
11
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 9

def bizarroids_edit_button path
  bizarroids_button path, :pencil
end

#bizarroids_manage_buttons(edit_path, destroy_path, destroy_confirm_message) ⇒ Object

TODO extract to gem



19
20
21
22
23
24
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 19

def bizarroids_manage_buttons edit_path, destroy_path, destroy_confirm_message
  safe_join [
    bizarroids_edit_button(edit_path),
    bizarroids_destroy_button(destroy_path, destroy_confirm_message)
  ]
end

#bizarroids_move_buttons(up_path, down_path) ⇒ Object

TODO extract to gem



27
28
29
30
31
32
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 27

def bizarroids_move_buttons up_path, down_path
  safe_join [
    bizarroids_button(up_path, :'arrow-up', method: :patch),
    bizarroids_button(down_path, :'arrow-down', method: :patch)
  ]
end

#bizarroids_slider_each_slide(key) ⇒ Object



52
53
54
55
56
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 52

def bizarroids_slider_each_slide key
  Bizarroids::Slider[key].each do |slide|
    yield slide
  end
end


34
35
36
37
38
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 34

def bizarroids_slider_menu_link
  link_to bizarroids_t('slider.name'),
    bizarroids_slider_engine.slider_collections_path,
    class: [bizarroids_slider_menu_link_class, 'list-group-item']
end

Returns:

  • (Boolean)


44
45
46
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 44

def bizarroids_slider_menu_link_active?
  controller.class.parent == Bizarroids::Slider
end


40
41
42
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 40

def bizarroids_slider_menu_link_class
  bizarroids_slider_menu_link_active? ? :active : nil
end

#bizarroids_slider_slides(key) ⇒ Object



48
49
50
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 48

def bizarroids_slider_slides key
  Bizarroids::Slider[key]
end

#bizarroids_t(key) ⇒ Object

TODO extract to gem



4
5
6
# File 'app/helpers/bizarroids/slider/application_helper.rb', line 4

def bizarroids_t key
  t key, scope: :bizarroids
end