-
Notifications
You must be signed in to change notification settings - Fork 11
message system #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
message system #372
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
5412ccd
initial commit
simonLeary42 cc8190a
remove unused modal yes no buttons
simonLeary42 a543f93
remove modal messages
simonLeary42 ad53049
remove modal buttons
simonLeary42 eb449ee
backed enum
simonLeary42 adff0c8
assertMessageExists
simonLeary42 a2e3fb3
initialize messages
simonLeary42 c5e135f
redirect uses current page as default value
simonLeary42 cd9807f
use messages instead of modal errors
simonLeary42 be0674d
clear messages in test, print messages in header.php
simonLeary42 3f8bc5d
fix rege
simonLeary42 40fb59e
fix bug
simonLeary42 c6bebb3
move messages into main div
simonLeary42 a6669b6
copy django message semantics
simonLeary42 05ba5c6
message header is h3
simonLeary42 9d526e5
remove exportMessagesHTML
simonLeary42 03397fb
create messages.css
simonLeary42 7f09f76
remove success messages
simonLeary42 dbfb623
message CSS WIP
simonLeary42 a9f574e
reasonable colors
simonLeary42 454171c
margin, padding, color
simonLeary42 f4ef6dc
remove background
simonLeary42 0d0028a
steal colors from coldfront/bootstrap
simonLeary42 c5e886d
button dismiss message
simonLeary42 8df6e4b
steal dismiss button from coldfront
simonLeary42 ca5e3a3
90% width
simonLeary42 3692cb0
no need for extra padding
simonLeary42 c0146ad
fix message layout on mobile
simonLeary42 8820e0c
remove old comment
simonLeary42 93608dd
Update webroot/css/messages.css
simonLeary42 77509e2
htmlspecialchars
simonLeary42 0ea16fa
gracefully handle invalid session data
simonLeary42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -25,6 +25,9 @@ | |
| require_once __DIR__ . "/../resources/lib/exceptions/EncodingConversionException.php"; | ||
|
|
||
| use UnityWebPortal\lib\UnityGroup; | ||
| use UnityWebPortal\lib\UnityHTTPD; | ||
| use UnityWebPortal\lib\UnityHTTPDMessageLevel; | ||
| use PHPUnit\Framework\TestCase; | ||
|
|
||
| $_SERVER["HTTP_HOST"] = "phpunit"; // used for config override | ||
| require_once __DIR__ . "/../resources/config.php"; | ||
|
|
@@ -323,3 +326,29 @@ function getAdminUser() | |
| { | ||
| return ["[email protected]", "foo", "bar", "[email protected]"]; | ||
| } | ||
|
|
||
| function assertMessageExists( | ||
| TestCase $test_case, | ||
| UnityHTTPDMessageLevel $level, | ||
| string $title_regex, | ||
| string $body_regex, | ||
| ) { | ||
| $messages = UnityHTTPD::getMessages(); | ||
| $error_msg = sprintf( | ||
| "message(level='%s' title_regex='%s' body_regex='%s'), not found. found messages: %s", | ||
| $level->value, | ||
| $title_regex, | ||
| $body_regex, | ||
| jsonEncode($messages), | ||
| ); | ||
| $messages_with_title = array_filter($messages, fn($x) => preg_match($title_regex, $x[0])); | ||
| $messages_with_title_and_body = array_filter( | ||
| $messages_with_title, | ||
| fn($x) => preg_match($body_regex, $x[1]), | ||
| ); | ||
| $messages_with_title_and_body_and_level = array_filter( | ||
| $messages_with_title_and_body, | ||
| fn($x) => $x[2] == $level, | ||
| ); | ||
| $test_case->assertNotEmpty($messages_with_title_and_body_and_level, $error_msg); | ||
| } | ||
This file contains hidden or 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,52 @@ | ||
| .message { | ||
| border-radius: 10px; | ||
| padding: 10px 40px 10px 40px; | ||
| /* needed for button position: absolute */ | ||
| position: relative; | ||
| text-align: center; | ||
| /* width: fit-content; */ | ||
| /* subtract padding from indented width */ | ||
| width: 90% - 80px; | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| margin-bottom: 20px; | ||
| } | ||
|
|
||
| .message h3 { | ||
| margin: 0; | ||
| } | ||
|
|
||
| .message.debug { | ||
| color: #856404; | ||
| background-color: #fff3cd; | ||
| } | ||
|
|
||
| .message.success { | ||
| color: #155724; | ||
| background-color: #d4edda; | ||
| } | ||
|
|
||
| .message.info { | ||
| color: #0c5460; | ||
| background-color: #d1ecf1; | ||
| } | ||
|
|
||
| .message.warning { | ||
| color: #856404; | ||
| background-color: #fff3cd; | ||
| } | ||
simonLeary42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| .message.error { | ||
| color: #721c24; | ||
| background-color: #f8d7da; | ||
| } | ||
|
|
||
| .message button { | ||
| position: absolute; | ||
| top: 0; | ||
| right: 0; | ||
| background-color: inherit; | ||
| color: inherit; | ||
| font-size: 2rem; | ||
simonLeary42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| border: none; | ||
| } | ||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.