Sha256: bbb31a533722b6bbbc7b06a666b54ad1093f54f7457193cd8cce9b071bfe4af8
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
module Recruiter module LinksHelper def button_link(url, classes = nil, options = {}, &block) classes = [options[:class], 'button', classes].compact options.merge! class: classes link_to url, options, &block end def new_link(url = {action: :new}, options = {}) options.reverse_merge!({ title: t('recruiter.links.new') }) link_to(url, options) do [new_icon, t('recruiter.links.new')].join(" ").html_safe end end def edit_link(url, options = {}, &block) options.reverse_merge!({ title: t('recruiter.links.edit') }) button_link(url, 'warning tiny', options) do edit_icon end end def destroy_link(url, options = { }, &block) options.reverse_merge!({ method: :delete, data: { confirm: t('recruiter.messages.confirm_destroy')}, title: t('recruiter.links.destroy'), }) button_link(url, 'alert tiny', options) do destroy_icon end end def show_link(url, options = {}, &block) options.reverse_merge!({ title: t('recruiter.links.show') }) button_link(url, 'secondary tiny', options) do show_icon end end def back_link(url = { action: :index }, options = {}, &block) button_link(url, 'warning', options) do t('recruiter.links.back') end end def cancel_link(url = { action: :index }, options = {}, &block) button_link(url, 'alert', options) do t('recruiter.links.cancel') end end def submit_button action = params[:action] content_tag(:button, t("recruiter.submit.#{action}"), class: 'success') end end end
Version data entries
4 entries across 4 versions & 1 rubygems