Module: CoreTableActionHelper
- Defined in:
- app/helpers/core_table_action_helper.rb
Instance Method Summary collapse
- #table_action_archive_tag(record, path, options = {}) ⇒ Object
- #table_action_delete_tag(record, path, options = {}) ⇒ Object
- #table_action_demote_tag(record, path, options = {}) ⇒ Object
- #table_action_deploy_tag(record, path, options = {}) ⇒ Object
- #table_action_download_tag(record, options = {}) ⇒ Object
- #table_action_edit_tag(record, path, options = {}) ⇒ Object
- #table_action_replay_tag(record, path, options = {}) ⇒ Object
- #table_action_restore_tag(record, path, options = {}) ⇒ Object
- #table_action_revoke_tag(record, path, options = {}) ⇒ Object
- #table_action_run_tag(record, path, options = {}) ⇒ Object
- #table_action_show_tag(record, path, options = {}) ⇒ Object
Instance Method Details
#table_action_archive_tag(record, path, options = {}) ⇒ Object
84 85 86 87 88 89 90 91 92 93 |
# File 'app/helpers/core_table_action_helper.rb', line 84 def table_action_archive_tag(record, path, = {}) return unless can?(:destroy, record) && record.archive_able? [:tool_tip] ||= 'Archive' [:classes] ||= %i[text-danger] [:icon_name] ||= :archive [:method] ||= :delete [:confirm] ||= "Are you sure you want to archive this #{record.class.name.humanize}?" table_action_tag(path, ) end |
#table_action_delete_tag(record, path, options = {}) ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# File 'app/helpers/core_table_action_helper.rb', line 73 def table_action_delete_tag(record, path, = {}) return unless can?(:destroy, record) [:tool_tip] ||= 'Delete' [:classes] ||= %i[text-danger] [:icon_name] ||= :delete [:method] ||= :delete [:confirm] ||= "Are you sure you want to delete this #{record.class.name.humanize}?" table_action_tag(path, ) end |
#table_action_demote_tag(record, path, options = {}) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'app/helpers/core_table_action_helper.rb', line 62 def table_action_demote_tag(record, path, = {}) return unless can?(:update, record) [:tool_tip] ||= 'Demote' [:classes] ||= %i[text-warning] [:icon_name] ||= 'thumb-down' [:method] ||= :delete [:confirm] ||= "Are you sure you want to demote this #{record.class.name.humanize}?" table_action_tag(path, ) end |
#table_action_deploy_tag(record, path, options = {}) ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/helpers/core_table_action_helper.rb', line 35 def table_action_deploy_tag(record, path, = {}) return unless can?(:edit, record) && record.deploy_able? [:tool_tip] ||= 'Deploy' [:icon_name] ||= :deploy table_action_tag(path, ) end |
#table_action_download_tag(record, options = {}) ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'app/helpers/core_table_action_helper.rb', line 95 def table_action_download_tag(record, = {}) return unless can?(:read, record) link_classes = tooltip_data(, 'Download') content_tag(:a, href: download_polymorphic_path(record), class: link_classes.join(' ')) do svg_icon('download', type: [:type] || :outline) end end |
#table_action_edit_tag(record, path, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/core_table_action_helper.rb', line 19 def table_action_edit_tag(record, path, = {}) return unless can?(:edit, record) && record.edit_able? [:tool_tip] ||= 'Edit' [:icon_name] ||= :edit table_action_tag(path, ) end |
#table_action_replay_tag(record, path, options = {}) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'app/helpers/core_table_action_helper.rb', line 53 def table_action_replay_tag(record, path, = {}) return unless can?(:update, record) [:tool_tip] ||= 'Replay' [:icon_name] ||= :repeat [:confirm] ||= "Are you sure you want to restart this #{record.class.name.humanize}?" table_action_tag(path, ) end |
#table_action_restore_tag(record, path, options = {}) ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/helpers/core_table_action_helper.rb', line 27 def table_action_restore_tag(record, path, = {}) return unless can?(:edit, record) && record.restore_able? [:tool_tip] ||= 'Restore' [:icon_name] ||= :restore table_action_tag(path, ) end |
#table_action_revoke_tag(record, path, options = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/core_table_action_helper.rb', line 43 def table_action_revoke_tag(record, path, = {}) return unless can?(:edit, record) && record.revoke_able? [:tool_tip] ||= 'Revoke' [:classes] ||= %w[text-danger] [:icon_name] ||= :revoke [:confirm] ||= "Are you sure you want to revoke this #{record.class.name.humanize}?" table_action_tag(path, ) end |
#table_action_run_tag(record, path, options = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/helpers/core_table_action_helper.rb', line 11 def table_action_run_tag(record, path, = {}) return unless can?(:manage, record) && record.edit_able? [:tool_tip] ||= 'Run' [:icon_name] ||= :run table_action_tag(path, ) end |
#table_action_show_tag(record, path, options = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/core_table_action_helper.rb', line 3 def table_action_show_tag(record, path, = {}) return unless can?(:read, record) [:title] ||= 'Show' [:icon_name] ||= :info table_action_tag(path, ) end |