module Interage::LinkToHelper
Constants
- ASIDE_DEFAULT_CLASS
- DESTROY_CONFIRM_MESSAGE
- NEW_BUTTON_CLASS
- PREFIX_BUTTON_CLASS
Public Instance Methods
aside_link_to(*args, &block)
click to toggle source
# File lib/interage/link_to_helper.rb, line 10 def aside_link_to(*args, &block) options = args.last.is_a?(Hash) ? args.pop : {} options[:class] = "#{ASIDE_DEFAULT_CLASS} #{options[:class]}" options[:title] = strip_tags(args.first) if block.blank? args.push(options) link_to(*args, &block) end
destroy_confirm_message()
click to toggle source
# File lib/interage/link_to_helper.rb, line 63 def destroy_confirm_message t('application.destroy_confirm_message', default: DESTROY_CONFIRM_MESSAGE) end
link_to_back(url)
click to toggle source
# File lib/interage/link_to_helper.rb, line 35 def link_to_back(url) link_to_default(:back, url, class: button_class('secondary')) end
link_to_default(type, url, html_options = {})
click to toggle source
# File lib/interage/link_to_helper.rb, line 51 def link_to_default(type, url, html_options = {}) text = t("menu.links.#{type}") html_options = html_options.merge(title: strip_tags(text), data: { tooltip: 'top' }) link_to(app_icon_text(t("menu.icons.#{type}"), text), url, html_options) end
link_to_destroy(url, html_options = {})
click to toggle source
# File lib/interage/link_to_helper.rb, line 43 def link_to_destroy(url, html_options = {}) html_options.merge!(method: :delete, 'data-confirm' => destroy_confirm_message, class: button_class('danger', html_options[:class])) link_to_default(:destroy, url, html_options) end
link_to_edit(url)
click to toggle source
# File lib/interage/link_to_helper.rb, line 31 def link_to_edit(url) link_to_default(:edit, url, class: button_class('info')) end
link_to_modal(text, url = '
click to toggle source
# File lib/interage/link_to_helper.rb, line 19 def link_to_modal(text, url = '#', html_options = {}) link_to text, url, html_options.merge('data-toggle': 'modal') end
link_to_new(resource, url)
click to toggle source
# File lib/interage/link_to_helper.rb, line 23 def link_to_new(resource, url) text = t('menu.links.new', model: tm(resource).downcase) link_to url, title: strip_tags(text), class: NEW_BUTTON_CLASS do app_icon_text(t('menu.icons.new'), text) end end
link_to_show(url)
click to toggle source
# File lib/interage/link_to_helper.rb, line 39 def link_to_show(url) link_to_default(:show, url, class: button_class('dark')) end