logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 532bec6e564884c2bd5b2bcc7cab929f4f2cabf5
parent: ee82d8a8761f0bedc97f5e79565b7c5142c1b8bd
Author: Matt Jankowski <mjankowski@thoughtbot.com>
Date:   Sat, 22 Apr 2017 22:22:34 -0400

Clean up flash display in views (#2336)

* Add flashes partial to DRY up admin/auth layouts

* Further consolidate flash messages

Diffstat:

Aapp/helpers/flashes_helper.rb7+++++++
Aapp/views/application/_flashes.html.haml3+++
Mapp/views/layouts/admin.html.haml8+-------
Mapp/views/layouts/auth.html.haml8+-------
4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/app/helpers/flashes_helper.rb b/app/helpers/flashes_helper.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module FlashesHelper + def user_facing_flashes + flash.to_hash.slice('alert', 'error', 'notice', 'success') + end +end diff --git a/app/views/application/_flashes.html.haml b/app/views/application/_flashes.html.haml @@ -0,0 +1,3 @@ +- user_facing_flashes.each do |key, value| + .flash-message{class: key} + %strong= value diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml @@ -13,13 +13,7 @@ .content %h2= yield :page_title - - if flash[:notice] - .flash-message.notice - %strong= flash[:notice] - - - if flash[:alert] - .flash-message.alert - %strong= flash[:alert] + = render 'flashes' = yield diff --git a/app/views/layouts/auth.html.haml b/app/views/layouts/auth.html.haml @@ -9,13 +9,7 @@ = image_tag 'logo.png' .form-container - - if flash[:notice] - .flash-message.notice - %strong= flash[:notice] - - - if flash[:alert] - .flash-message.alert - %strong= flash[:alert] + = render 'flashes' = yield