Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Qpixel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Answers
Qpixel
Commits
b2884f09
Commit
b2884f09
authored
Aug 25, 2020
by
galegosimpatico
Browse files
Options
Downloads
Patches
Plain Diff
Peer review.
`const` for constants, `let` for variables, line comment formatting, max line length at 120.
parent
4d43d48d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/assets/javascripts/qpixel_api.js
+15
-17
15 additions, 17 deletions
app/assets/javascripts/qpixel_api.js
with
15 additions
and
17 deletions
app/assets/javascripts/qpixel_api.js
+
15
−
17
View file @
b2884f09
...
...
@@ -13,7 +13,7 @@ window.QPixel = {
},
/** Counts notifications popped up at any time. */
var
popped_modals_ct
=
0
;
let
popped_modals_ct
=
0
;
/**
* Create a notification popup - not an inbox notification.
...
...
@@ -21,30 +21,28 @@ window.QPixel = {
* @param message the message to show
*/
createNotification
:
function
(
type
,
message
)
{
/** Some messages include a date stamp. */
var
append_date
=
false
;
var
message_with_date
=
message
;
var
span
,
button
;
// Some messages include a date stamp, `append_date` governs that.
let
append_date
=
false
;
let
message_with_date
=
message
;
if
(
type
===
'
danger
'
)
{
if
(
popped_modals_ct
>
0
)
{
/* Modals stack each on top, so repeating an errored action over
* and over again is gonna create multiple error modals in the
* same exact place. While this happens this way, an user
* closing the error modal will not have an immediate visual
* action feedback if two or more error modals are printed.
* A date is stamped in order to cope with that. */
/* At the time of writing, modals stack each one exactly on top of previous one, so repeating an errored action
* over and over again is going to create multiple error modals in the same exact place. While this happens this
* way, an user closing the error modal will not have an immediate visual action feedback if two or more error
* modals have been printed. A date is stamped in order to cope with that. Could be anything. Probablye a cycle
* of different emoji characters would be cuter while having the purpose met. But if so make sure character in
* step `i` is actually different than character in step `i + 1`. And then you could print an emoji just every
* time a modal is popped up, not just from the second one; removing `mesage_with_date`, using only `message`,
* and removing `append_date` and the different situations guarded by it. */
append_date
=
true
;
}
}
if
(
append_date
)
{
message_with_date
+=
'
(
'
+
new
Date
(
Date
.
now
()).
toISOString
()
+
'
)
'
;
}
span
=
'
<span aria-hidden="true">×</span>
'
;
button
=
'
<button
'
;
button
+=
'
type="button" class="button is-close-button"
'
;
button
+=
'
data-dismiss="alert" aria-label="Close"
'
;
button
+=
'
>
'
;
button
+=
span
+
'
</button>
'
;
const
span
=
'
<span aria-hidden="true">×</span>
'
;
const
button
=
(
'
<button type="button" class="button is-close-button" data-dismiss="alert" aria-label="Close">
'
+
span
+
'
</button>
'
);
$
(
"
<div></div>
"
)
.
addClass
(
"
notice has-shadow-3 is-
"
+
type
)
.
html
(
button
+
'
<p>
'
+
message_with_date
+
'
</p>
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment