Este site funciona melhor com JavaScript.
Página inicial
Explorar
Ajuda
Acessar
abunchtell
/
mastodon
Observar
1
Favorito
0
Fork
0
Código
Issues
0
Atividade
Ver código fonte
Clean up flash display in views (
#2336
)
* Add flashes partial to DRY up admin/auth layouts * Further consolidate flash messages
master
Matt Jankowski
7 anos atrás
committed by
Eugen
pai
ee82d8a876
commit
532bec6e56
4 arquivos alterados
com
12 adições
e
14 exclusões
Visão dividida
Opções de diferenças
Mostrar estatísticas
Baixar arquivo de patch
Baixar arquivo de diferenças
+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
Ver arquivo
@@ -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
Ver arquivo
@@ -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
Ver arquivo
@@ -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
Ver arquivo
@@ -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
Escrever
Pré-visualização
Carregando…
Cancelar
Salvar