Sha256: 62831e690b6e19a45ca573019f0cbe92ef436984ae814eb38a34789022ca094d

Contents?: true

Size: 1.49 KB

Versions: 24

Compression:

Stored size: 1.49 KB

Contents

module ContourHelper

  def cancel
    link_to 'Cancel', URI.parse(request.referer.to_s).path.blank? ? root_path : (URI.parse(request.referer.to_s).path), class: 'btn btn-default'
  end

  def sort_field_helper(order, sort_field, display_name)
    sort_field_order = (order == sort_field) ? "#{sort_field} DESC" : sort_field
    symbol = (order == sort_field) ? '»' : (order == sort_field + ' DESC' ? '«' : '«»')
    selected_class = (order == sort_field) ? 'selected' : (order == sort_field + ' DESC' ? 'selected' : '')
    content_tag(:span, class: selected_class) do
      display_name.to_s.html_safe + ' ' + link_to(raw(symbol), url_for( params.merge( order: sort_field_order )  ), style: 'text-decoration:none')
    end.html_safe
  end

  # From Twitter-Bootstrap-Rails
  def flash_block
    output = ''
    flash.each do |type, message|
      unless session["user_return_to"] == root_path and I18n.t("devise.failure.unauthenticated") == message
        output += flash_container(type, message) if ['alert', 'notice', 'error', 'warning', 'success', 'info'].include?(type.to_s)
      end
    end

    raw(output)
  end

  # From Twitter-Bootstrap-Rails
  def flash_container(type, message)
    type = 'success' if type.to_s == 'notice'
    type = 'danger' if ['alert', 'error'].include?(type.to_s)

    content_tag(:div, class: "navbar-alert alert alert-#{type}") do
      content_tag(:a, raw("×"), href: '#', class: 'close', data: { dismiss: 'alert' }) + message
    end.html_safe
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
contour-3.0.1 app/helpers/contour_helper.rb
contour-3.0.1.rc app/helpers/contour_helper.rb
contour-3.0.0 app/helpers/contour_helper.rb
contour-3.0.0.rc app/helpers/contour_helper.rb
contour-3.0.0.beta1 app/helpers/contour_helper.rb
contour-2.7.0 app/helpers/contour_helper.rb
contour-2.7.0.beta1 app/helpers/contour_helper.rb
contour-2.6.0 app/helpers/contour_helper.rb
contour-2.6.0.rc app/helpers/contour_helper.rb
contour-2.6.0.beta8 app/helpers/contour_helper.rb
contour-2.6.0.beta7 app/helpers/contour_helper.rb
contour-2.6.0.beta6 app/helpers/contour_helper.rb
contour-2.6.0.beta5 app/helpers/contour_helper.rb
contour-2.6.0.beta4 app/helpers/contour_helper.rb
contour-2.6.0.beta3 app/helpers/contour_helper.rb
contour-2.6.0.beta2 app/helpers/contour_helper.rb
contour-2.6.0.beta1 app/helpers/contour_helper.rb
contour-2.5.0 app/helpers/contour_helper.rb
contour-2.5.0.beta1 app/helpers/contour_helper.rb
contour-2.4.0 app/helpers/contour_helper.rb