Sha256: 30075300522f9fc47f002742922b90637f6437566d279fa16a718fa98a19a938

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

module ChaltronHelper

  def ldap_enabled?
    Devise.omniauth_providers.include? :ldap
  end

  #
  # Flash messages
  #
  def bootstrap_class_for(flash_type)
    {
      success: 'alert-success',
      error:   'alert-danger',
      alert:   'alert-warning',
      notice:  'alert-info'
    }[flash_type] || flash_type.to_s
  end

  def flash_message(message, type)
    content_tag(:div, message, class: "alert #{bootstrap_class_for(type)} rounded-0") do
      content_tag(:strong, I18n.t("chaltron.flash.#{type}") + ': ') +
      message
    end
  end

  def back_link(opts = {})
    klass = opts[:class] || 'btn btn-primary'
    text  = opts[:text]  || t('chaltron.common.back')
    ic    = opts[:icon]  || 'arrow-left '

    link_to :back, class: klass do
      icon(:fas, ic, text)
    end
  end

  #
  # Get current revision
  #
  def revision
    @revision || get_revision_number
  end

  private

  def get_revision_number
    version_file = "#{Rails.root}/REVISION"
    if File.exists?(version_file)
      v = IO.read(version_file).strip
      v.blank?? nil : v
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
chaltron-1.1.1 app/helpers/chaltron_helper.rb
chaltron-1.1.0 app/helpers/chaltron_helper.rb
chaltron-1.0.10 app/helpers/chaltron_helper.rb
chaltron-1.0.9 app/helpers/chaltron_helper.rb
chaltron-1.0.8 app/helpers/chaltron_helper.rb
chaltron-1.0.7 app/helpers/chaltron_helper.rb
chaltron-1.0.6 app/helpers/chaltron_helper.rb
chaltron-1.0.5 app/helpers/chaltron_helper.rb
chaltron-1.0.4 app/helpers/chaltron_helper.rb
chaltron-1.0.3 app/helpers/chaltron_helper.rb
chaltron-1.0.2 app/helpers/chaltron_helper.rb