Module: PureAdmin::ButtonHelper
- Defined in:
- app/helpers/pure_admin/button_helper.rb
Overview
Helper methods to render buttons.
Instance Method Summary collapse
-
#back_button(path = nil, options = {}) ⇒ String
HTML for the back button.
-
#cancel_button(path = nil, options = {}) ⇒ String
HTML for the cancel button.
-
#delete_button(path, options = {}) ⇒ String
HTML for the delete button.
-
#edit_button(path, options = {}) ⇒ String
HTML for the edit button.
-
#save_button(options = {}) ⇒ String
HTML for a save button.
Instance Method Details
#back_button(path = nil, options = {}) ⇒ String
Returns HTML for the back button.
26 27 28 29 |
# File 'app/helpers/pure_admin/button_helper.rb', line 26 def (path = nil, = {}) [:class] = merge_html_classes('pure-button', [:class]) link_to('Back', (path || :back), ) end |
#cancel_button(path = nil, options = {}) ⇒ String
Returns HTML for the cancel button.
35 36 37 38 |
# File 'app/helpers/pure_admin/button_helper.rb', line 35 def (path = nil, = {}) [:class] = merge_html_classes('pure-button', [:class]) link_to('<i class="fa fa-ban"></i> Cancel'.html_safe, (path || :back), ) end |
#delete_button(path, options = {}) ⇒ String
Returns HTML for the delete button.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/pure_admin/button_helper.rb', line 46 def (path, = {}) [:class] = merge_html_classes('pure-button button-red', [:class]) [:rel] ||= :modal [:modal] ||= :confirm [:data] ||= {} [:data][:modal_request_method] ||= :delete label = .delete(:label) || 'Delete' icon = .delete(:icon) || 'fa-trash-o' link_to("<i class='fa #{icon}'></i> #{label}".html_safe, path, ) end |
#edit_button(path, options = {}) ⇒ String
Returns HTML for the edit button.
17 18 19 20 |
# File 'app/helpers/pure_admin/button_helper.rb', line 17 def (path, = {}) [:class] = merge_html_classes('pure-button pure-button-primary', [:class]) link_to('<i class="fa fa-pencil"></i> Edit'.html_safe, path, ) end |
#save_button(options = {}) ⇒ String
Returns HTML for a save button.
7 8 9 10 11 |
# File 'app/helpers/pure_admin/button_helper.rb', line 7 def ( = {}) [:class] = merge_html_classes('pure-button pure-button-primary', [:class]) [:type] ||= :submit ('<i class="fa fa-fw fa-check"></i> Save'.html_safe, ) end |