Sha256: f3e41f996f72175631fea28765409eead3ee39499910ad93127936f23b66a8b6

Contents?: true

Size: 1.64 KB

Versions: 21

Compression:

Stored size: 1.64 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

21 entries across 21 versions & 1 rubygems

Version Path
recruiter-1.1.14 app/helpers/recruiter/links_helper.rb
recruiter-1.1.12 app/helpers/recruiter/links_helper.rb
recruiter-1.1.11 app/helpers/recruiter/links_helper.rb
recruiter-1.1.10 app/helpers/recruiter/links_helper.rb
recruiter-1.1.9 app/helpers/recruiter/links_helper.rb
recruiter-1.1.8 app/helpers/recruiter/links_helper.rb
recruiter-1.1.7 app/helpers/recruiter/links_helper.rb
recruiter-1.1.6 app/helpers/recruiter/links_helper.rb
recruiter-1.1.5 app/helpers/recruiter/links_helper.rb
recruiter-1.1.4 app/helpers/recruiter/links_helper.rb
recruiter-1.1.3 app/helpers/recruiter/links_helper.rb
recruiter-1.1.2 app/helpers/recruiter/links_helper.rb
recruiter-1.1.1 app/helpers/recruiter/links_helper.rb
recruiter-1.1.0 app/helpers/recruiter/links_helper.rb
recruiter-1.0.0 app/helpers/recruiter/links_helper.rb
recruiter-0.1.5 app/helpers/recruiter/links_helper.rb
recruiter-0.1.4 app/helpers/recruiter/links_helper.rb
recruiter-0.1.3 app/helpers/recruiter/links_helper.rb
recruiter-0.1.2 app/helpers/recruiter/links_helper.rb
recruiter-0.1.1 app/helpers/recruiter/links_helper.rb