Commit a2a7c8093b7fb2966a40c6c6be45c4dd52683ab4
1 parent
df9550c7
Exists in
master
and in
4 other branches
Use flash message for notification across app
Showing
7 changed files
with
19 additions
and
36 deletions
Show diff stats
... | ... | @@ -0,0 +1,15 @@ |
1 | +class Flash | |
2 | + constructor: (message, type)-> | |
3 | + flash = $(".flash-container") | |
4 | + flash.html("") | |
5 | + | |
6 | + $('<div/>', | |
7 | + class: "flash-#{type}", | |
8 | + text: message | |
9 | + ).appendTo(".flash-container") | |
10 | + | |
11 | + flash.click -> $(@).fadeOut() | |
12 | + flash.show() | |
13 | + setTimeout (-> flash.fadeOut()), 5000 | |
14 | + | |
15 | +@Flash = Flash | ... | ... |
app/assets/javascripts/profile.js.coffee
1 | 1 | $ -> |
2 | 2 | $('.edit_user .application-theme input, .edit_user .code-preview-theme input').click -> |
3 | - # Hide any previous submission feedback | |
4 | - $('.edit_user .update-feedback').hide() | |
5 | - | |
6 | 3 | # Submit the form |
7 | 4 | $('.edit_user').submit() |
8 | 5 | |
9 | - # Go up the hierarchy and show the corresponding submission feedback element | |
10 | - $(@).closest('fieldset').find('.update-feedback').show('highlight', {color: '#DFF0D8'}, 500) | |
6 | + new Flash("Appearance settings saved", "notice") | |
11 | 7 | |
12 | 8 | $('.update-username form').on 'ajax:before', -> |
13 | 9 | $('.loading-gif').show() |
... | ... | @@ -17,6 +13,6 @@ $ -> |
17 | 13 | $('.update-username form').on 'ajax:complete', -> |
18 | 14 | $(this).find('.btn-save').enableButton() |
19 | 15 | $(this).find('.loading-gif').hide() |
20 | - | |
16 | + | |
21 | 17 | $('.update-notifications').on 'ajax:complete', -> |
22 | 18 | $(this).find('.btn-save').enableButton() | ... | ... |
app/assets/stylesheets/sections/profile.scss
app/assets/stylesheets/sections/themes.scss
app/views/profiles/design.html.haml
... | ... | @@ -8,9 +8,6 @@ |
8 | 8 | %fieldset.application-theme |
9 | 9 | %legend |
10 | 10 | Application theme |
11 | - .update-feedback.hide | |
12 | - %i.icon-ok | |
13 | - Saved | |
14 | 11 | .themes_opts |
15 | 12 | = label_tag do |
16 | 13 | .prev.default |
... | ... | @@ -42,9 +39,6 @@ |
42 | 39 | %fieldset.code-preview-theme |
43 | 40 | %legend |
44 | 41 | Code preview theme |
45 | - .update-feedback.hide | |
46 | - %i.icon-ok | |
47 | - Saved | |
48 | 42 | .code_highlight_opts |
49 | 43 | - color_schemes.each do |color_scheme_id, color_scheme| |
50 | 44 | = label_tag do | ... | ... |
app/views/profiles/notifications/show.html.haml
... | ... | @@ -56,12 +56,3 @@ |
56 | 56 | - @users_projects.each do |users_project| |
57 | 57 | - notification = Notification.new(users_project) |
58 | 58 | = render 'settings', type: 'project', membership: users_project, notification: notification |
59 | - | |
60 | - | |
61 | -.save-status-fixed | |
62 | - %span.update-success.cgreen.hide | |
63 | - %i.icon-ok | |
64 | - Saved | |
65 | - %span.update-failed.cred.hide | |
66 | - %i.icon-remove | |
67 | - Failed | ... | ... |
app/views/profiles/notifications/update.js.haml