forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restyle flash messages and unauthorized-style pages, fixes #9466
test plan: 1. go to a course page when not logged in 1. you should see the unauthorized message 2. it should be styled correctly 2. go to a course page when logged in that you are not enrolled in 1. you should see the unauthorized message 2. it should be styled correctly 3. perform an action that generates a flash notice (e.g. send a message in conversations) 1. the notice should appear and should overlap the header 2. it should disappear when clicked (or after a few seconds) 4. perform an action that generates a flash error message 1. the error should appear and should overlap the header 2. it should disappear when clicked (or after a few seconds) 5. go to a page that has an initial flash notice (e.g. view course you've been invited to) 1. the notice should appear and should shift all content down 2. it should only disappear if clicked 6. go to a page that has an initial flash error 1. the error should appear and should shift all content down 2. it should only disappear if clicked Change-Id: I3a1ca8f44e9f36bc7ce191392a7bf8922eb4fcc4 Reviewed-on: https://gerrit.instructure.com/12324 Reviewed-by: Ryan Shaw <[email protected]> Tested-by: Jenkins <[email protected]>
- Loading branch information
Showing
52 changed files
with
261 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# does Rails-style flash message/error boxes that drop down from the top of the screen | ||
define [ | ||
'i18n!shared.flash_notices' | ||
'underscore' | ||
'compiled/fn/preventDefault' | ||
'jqueryui/effects/drop' | ||
], (I18n, _, preventDefault) -> | ||
|
||
$buffer = $("#flash_message_buffer") | ||
$holder = $("#flash_message_holder") | ||
$holder.on 'click', '.close_link', preventDefault | ||
$holder.on 'click', 'li', -> | ||
$this = $(this) | ||
return if $this.hasClass('no_close') | ||
$this.stop(true, true).remove() | ||
if $this.hasClass('static_message') | ||
$buffer.height _.reduce($holder.find('.static_message'), | ||
(s, n) -> s + $(n).outerHeight() | ||
, 0) | ||
|
||
flashBox = (type, content, timeout) -> | ||
$node = $(""" | ||
<li class='ui-state-#{type}'> | ||
<i></i> | ||
#{content} | ||
<a href='#' class='close_link'>#{I18n.t("close", "Close")}</a> | ||
</li> | ||
""") | ||
|
||
$node.appendTo($holder). | ||
css('z-index', 1). | ||
show('drop', direction: "up", 'fast'). | ||
slideDown('fast', -> $(this).css('z-index', 2)). | ||
delay(timeout || 7000). | ||
animate({'z-index': 1}, 0). | ||
fadeOut('slow', -> $(this).slideUp('fast', -> $(this).remove())) | ||
#hide('drop', { direction: "up" }, 'fast', -> $(this).remove()) | ||
|
||
# Pops up a small notification box at the top of the screen. | ||
$.flashMessage = (content, timeout = 3000) -> | ||
flashBox("success", content, timeout) | ||
|
||
# Pops up a small error box at the top of the screen. | ||
$.flashError = (content, timeout) -> | ||
flashBox("error", content, timeout); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.