Sha256: 4c4611a2ff4efcd34f8b021424e8d280d4d7c0e322169a81afc1cc82d5039305

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

# -*- encoding : utf-8 -*-

module DeviseBootstrapViewsHelper
  def bootstrap_devise_error_messages!
    return '' if resource.errors.empty?

    messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
    sentence = I18n.t('errors.messages.not_saved',
      count: resource.errors.count,
      resource: resource.class.model_name.human.downcase)

    html = <<-HTML
    <div class="alert alert-danger alert-block">
      <button type="button" class="close" data-dismiss="alert">⨉</button>
      <h5>#{sentence}</h4>
      #{messages}
    </div>
    HTML

    html.html_safe
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-bootstrap-views-0.0.6 lib/devise_bootstrap_views_helper.rb