Module: Agilibox::ButtonHelper
- Included in:
- AllHelpers
- Defined in:
- app/helpers/agilibox/button_helper.rb
Instance Method Summary collapse
- #bs_button(url, options = {}) ⇒ Object
- #complete_button(url, options = {}) ⇒ Object
- #copy_button(url, options = {}) ⇒ Object
- #create_button(url, options = {}) ⇒ Object
- #delete_button(url, options = {}) ⇒ Object
- #download_button(url, options = {}) ⇒ Object
- #export_button(url, options = {}) ⇒ Object
- #import_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
#bs_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/agilibox/button_helper.rb', line 2 def (url, = {}) action = .delete(:action) icon = .delete(:icon) text = .delete(:text) || ta(action) title = .delete(:title) || text text = %(#{icon icon} <span class="text">#{text}</span>).html_safe = { :class => "btn btn-xs btn-default 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 |
#complete_button(url, options = {}) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 |
# File 'app/helpers/agilibox/button_helper.rb', line 125 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
116 117 118 119 120 121 122 123 |
# File 'app/helpers/agilibox/button_helper.rb', line 116 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/agilibox/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
104 105 106 107 108 109 110 111 112 113 114 |
# File 'app/helpers/agilibox/button_helper.rb', line 104 def (url, = {}) = { :icon => :trash, :action => :delete, :class => "btn btn-xs btn-danger link_delete", :confirm => true, :method => :delete, }.merge() (url, ) end |
#download_button(url, options = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'app/helpers/agilibox/button_helper.rb', line 58 def (url, = {}) = { :icon => :cloud_download_alt, :action => :download, :download => File.basename(url), :target => "_blank", }.merge() (url, ) end |
#export_button(url, options = {}) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/helpers/agilibox/button_helper.rb', line 69 def (url, = {}) ext = url.split(".").last if ext.length <= 4 action = :"export_#{ext}" else action = :export end = { :icon => :download, :action => action, }.merge() (url, ) end |
#import_button(url, options = {}) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'app/helpers/agilibox/button_helper.rb', line 86 def (url, = {}) = { :icon => :upload, :action => :import, }.merge() (url, ) end |
#lock_button(url, options = {}) ⇒ Object
148 149 150 151 152 153 154 155 156 157 |
# File 'app/helpers/agilibox/button_helper.rb', line 148 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/agilibox/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/agilibox/button_helper.rb', line 49 def (url, = {}) = { :icon => :info_circle, :action => :read, }.merge() (url, ) end |
#snooze_button(url, options = {}) ⇒ Object
137 138 139 140 141 142 143 144 145 146 |
# File 'app/helpers/agilibox/button_helper.rb', line 137 def (url, = {}) = { :icon => :clock, :action => :snooze, :confirm => true, :method => :patch, }.merge() (url, ) end |
#unlock_button(url, options = {}) ⇒ Object
159 160 161 162 163 164 165 166 167 168 |
# File 'app/helpers/agilibox/button_helper.rb', line 159 def (url, = {}) = { :icon => :unlock, :action => :unlock, :confirm => true, :method => :patch, }.merge() (url, ) end |
#update_button(url, options = {}) ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'app/helpers/agilibox/button_helper.rb', line 95 def (url, = {}) = { :icon => :pencil_alt, :action => :update, }.merge() (url, ) end |