Module: Dorsale::ButtonHelper
- Included in:
- AllHelpers
- Defined in:
- app/helpers/dorsale/button_helper.rb
Instance Method Summary collapse
- #complete_button(url, options = {}) ⇒ Object
- #copy_button(url, options = {}) ⇒ Object
- #create_button(url, options = {}) ⇒ Object
- #delete_button(url, options = {}) ⇒ Object
- #dorsale_button(url, options = {}) ⇒ Object
- #download_button(url, options = {}) ⇒ Object
- #lock_button(url, options = {}) ⇒ Object
- #print_button(options = {}) ⇒ Object
- #read_button(url, options = {}) ⇒ Object
- #snooze_button(url, options = {}) ⇒ Object
- #unlock_button(url, options = {}) ⇒ Object
- #update_button(url, options = {}) ⇒ Object
Instance Method Details
#complete_button(url, options = {}) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 |
# File 'app/helpers/dorsale/button_helper.rb', line 98 def (url, = {}) = { :icon => :check, :action => :complete, :class => "btn btn-xs btn-success link_complete", :confirm => true, :method => :patch, }.merge() (url, ) end |
#copy_button(url, options = {}) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'app/helpers/dorsale/button_helper.rb', line 89 def (url, = {}) = { :icon => :copy, :action => :copy, }.merge() (url, ) end |
#create_button(url, options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'app/helpers/dorsale/button_helper.rb', line 39 def (url, = {}) = { :icon => :plus, :action => :create, :class =>"btn btn-xs btn-success link_create" }.merge() (url, ) end |
#delete_button(url, options = {}) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/helpers/dorsale/button_helper.rb', line 77 def (url, = {}) = { :icon => :trash, :action => :delete, :class => "btn btn-xs btn-danger link_delete", :confirm => true, :method => :delete, }.merge() (url, ) end |
#dorsale_button(url, options = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/dorsale/button_helper.rb', line 2 def (url, = {}) action = .delete(:action) icon = .delete(:icon) text = .delete(:text) || t("actions.#{action}") title = .delete(:title) || text text = "#{icon icon} <span>#{text}</span>".html_safe = { :class => "btn btn-xs link_#{action}", :title => title, }.deep_merge() if confirm = .delete(:confirm) confirm = t("actions.confirm") if confirm == true .deep_merge!( :data => { :confirm => confirm, } ) end link_to(text, url, ) end |
#download_button(url, options = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'app/helpers/dorsale/button_helper.rb', line 58 def (url, = {}) = { :icon => "cloud-download", :action => :download, :download => url, }.merge() (url, ) end |
#lock_button(url, options = {}) ⇒ Object
121 122 123 124 125 126 127 128 129 130 |
# File 'app/helpers/dorsale/button_helper.rb', line 121 def (url, = {}) = { :icon => :lock, :action => :lock, :confirm => true, :method => :patch, }.merge() (url, ) end |
#print_button(options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/dorsale/button_helper.rb', line 28 def ( = {}) = { :icon => :print, :action => :print, :class => "btn btn-xs btn-default", :onclick => "print(); return false;", }.merge() ("#", ) end |
#read_button(url, options = {}) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'app/helpers/dorsale/button_helper.rb', line 49 def (url, = {}) = { :icon => "info-circle", :action => :read, }.merge() (url, ) end |
#snooze_button(url, options = {}) ⇒ Object
110 111 112 113 114 115 116 117 118 119 |
# File 'app/helpers/dorsale/button_helper.rb', line 110 def (url, = {}) = { :icon => :"clock-o", :action => :snooze, :confirm => true, :method => :patch, }.merge() (url, ) end |
#unlock_button(url, options = {}) ⇒ Object
132 133 134 135 136 137 138 139 140 141 |
# File 'app/helpers/dorsale/button_helper.rb', line 132 def (url, = {}) = { :icon => :unlock, :action => :unlock, :confirm => true, :method => :patch, }.merge() (url, ) end |
#update_button(url, options = {}) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'app/helpers/dorsale/button_helper.rb', line 68 def (url, = {}) = { :icon => :pencil, :action => :update, }.merge() (url, ) end |