Този сайт работи по-добре с JavaScript.
Начало
Каталог
Помощ
Вход
abunchtell
/
mastodon
Наблюдаван
1
Харесван
0
Разклонения
0
Код
Задачи
0
Activity
Преглед на файлове
Clean up flash display in views (
#2336
)
* Add flashes partial to DRY up admin/auth layouts * Further consolidate flash messages
master
Matt Jankowski
преди 7 години
committed by
Eugen
родител
ee82d8a876
ревизия
532bec6e56
променени са
4 файла
, в които са
добавени 12
реда и са
изтрити 14
реда
Разделен изглед
Diff Options
Показване на статистика
Download Patch File
Download Diff File
+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
Целия файл
@@ -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
Целия файл
@@ -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
Целия файл
@@ -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
Целия файл
@@ -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
Пиши
Преглед
Зареждане…
Отказ
Запис