Sha256: 4c99d4227e9f6bfc8b78725b0aab9afe96e3361aad0aad50ebd06fe9d329832a
Contents?: true
Size: 788 Bytes
Versions: 26
Compression:
Stored size: 788 Bytes
Contents
module Writefully module FlashHelper def render_flash render 'flash' if can_flash? end def can_flash? flash.keys.sort == [:from, :object_id, :object_type, :type] and \ flash.to_hash.values.compact.count == flash_values_count end def flash_values_count action_name == "create" ? 3 : flash.keys.count end def flash_object flash[:object_type].classify.constantize.where(id: flash[:object_id]).first end def flash_path File.join((flash[:namespace] || nil), controller_name, 'flash', flash[:from].to_s, flash[:type].to_s) end def flash_color { success: 'alert-success', error: 'alert-danger', notice: 'alert-info', warn: 'alert-warning' }[flash[:type]] end end end
Version data entries
26 entries across 26 versions & 1 rubygems