Ce site fonctionne mieux avec JavaScript.
Accueil
Explorateur
Aide
Connexion
abunchtell
/
mastodon
Suivre
1
Ajouter aux favoris
0
Bifurcation
0
Code
Tickets
0
Activité
Parcourir la source
Clean up flash display in views (
#2336
)
* Add flashes partial to DRY up admin/auth layouts * Further consolidate flash messages
master
Matt Jankowski
il y a 7 ans
committed by
Eugen
Parent
ee82d8a876
révision
532bec6e56
4 fichiers modifiés
avec
12 ajouts
et
14 suppressions
Vue séparée
Option de Diff
Voir les Statistiques
Télécharger le Fichier Patch
Télécharger le Fichier des Différences
+7
-0
app/helpers/flashes_helper.rb
+3
-0
app/views/application/_flashes.html.haml
+1
-7
app/views/layouts/admin.html.haml
+1
-7
app/views/layouts/auth.html.haml
+ 7
- 0
app/helpers/flashes_helper.rb
Voir le fichier
@@ -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
- 0
app/views/application/_flashes.html.haml
Voir le fichier
@@ -0,0 +1,3 @@
- user_facing_flashes.each do |key, value|
.flash-message{class: key}
%strong= value
+ 1
- 7
app/views/layouts/admin.html.haml
Voir le fichier
@@ -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
+ 1
- 7
app/views/layouts/auth.html.haml
Voir le fichier
@@ -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
Écrire
Aperçu
Chargement…
Annuler
Enregistrer