Commit a2a7c809 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Use flash message for notification across app

parent df9550c7
class Flash
constructor: (message, type)->
flash = $(".flash-container")
flash.html("")
$('<div/>',
class: "flash-#{type}",
text: message
).appendTo(".flash-container")
flash.click -> $(@).fadeOut()
flash.show()
setTimeout (-> flash.fadeOut()), 5000
@Flash = Flash
$ ->
$('.edit_user .application-theme input, .edit_user .code-preview-theme input').click ->
# Hide any previous submission feedback
$('.edit_user .update-feedback').hide()
# Submit the form
$('.edit_user').submit()
# Go up the hierarchy and show the corresponding submission feedback element
$(@).closest('fieldset').find('.update-feedback').show('highlight', {color: '#DFF0D8'}, 500)
new Flash("Appearance settings saved", "notice")
$('.update-username form').on 'ajax:before', ->
$('.loading-gif').show()
......
.save-status-fixed {
position: fixed;
left: 20px;
bottom: 50px;
}
.update-notifications {
margin-bottom: 0;
label {
......
.application-theme, .code-preview-theme {
.update-feedback {
color: #468847;
float: right;
}
}
.themes_opts {
padding-left: 20px;
......
......@@ -8,9 +8,6 @@
%fieldset.application-theme
%legend
Application theme
.update-feedback.hide
%i.icon-ok
Saved
.themes_opts
= label_tag do
.prev.default
......@@ -42,9 +39,6 @@
%fieldset.code-preview-theme
%legend
Code preview theme
.update-feedback.hide
%i.icon-ok
Saved
.code_highlight_opts
- color_schemes.each do |color_scheme_id, color_scheme|
= label_tag do
......
......@@ -56,12 +56,3 @@
- @users_projects.each do |users_project|
- notification = Notification.new(users_project)
= render 'settings', type: 'project', membership: users_project, notification: notification
.save-status-fixed
%span.update-success.cgreen.hide
%i.icon-ok
Saved
%span.update-failed.cred.hide
%i.icon-remove
Failed
- if @saved
:plain
$('.save-status-fixed .update-success').showAndHide();
new Flash("Notification settings saved", "notice")
- else
:plain
$('.save-status-fixed .update-failed').showAndHide();
new Flash("Failed to save new settings", "alert")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment