mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 19:56:04 +01:00
Clean up flash display in views (#2336)
* Add flashes partial to DRY up admin/auth layouts * Further consolidate flash messages
This commit is contained in:
parent
ee82d8a876
commit
532bec6e56
4 changed files with 12 additions and 14 deletions
7
app/helpers/flashes_helper.rb
Normal file
7
app/helpers/flashes_helper.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module FlashesHelper
|
||||||
|
def user_facing_flashes
|
||||||
|
flash.to_hash.slice('alert', 'error', 'notice', 'success')
|
||||||
|
end
|
||||||
|
end
|
3
app/views/application/_flashes.html.haml
Normal file
3
app/views/application/_flashes.html.haml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
- user_facing_flashes.each do |key, value|
|
||||||
|
.flash-message{class: key}
|
||||||
|
%strong= value
|
|
@ -13,13 +13,7 @@
|
||||||
.content
|
.content
|
||||||
%h2= yield :page_title
|
%h2= yield :page_title
|
||||||
|
|
||||||
- if flash[:notice]
|
= render 'flashes'
|
||||||
.flash-message.notice
|
|
||||||
%strong= flash[:notice]
|
|
||||||
|
|
||||||
- if flash[:alert]
|
|
||||||
.flash-message.alert
|
|
||||||
%strong= flash[:alert]
|
|
||||||
|
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,7 @@
|
||||||
= image_tag 'logo.png'
|
= image_tag 'logo.png'
|
||||||
|
|
||||||
.form-container
|
.form-container
|
||||||
- if flash[:notice]
|
= render 'flashes'
|
||||||
.flash-message.notice
|
|
||||||
%strong= flash[:notice]
|
|
||||||
|
|
||||||
- if flash[:alert]
|
|
||||||
.flash-message.alert
|
|
||||||
%strong= flash[:alert]
|
|
||||||
|
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue