Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
CodeStats
code-stats
Compare Revisions
ac150fba720ef5b62c857efe2d3f79b1635a4765...74fb1fa448ba3bdb80d5072e1c5ced2802abdf45
Commits (1)
Simplify last programmed date with text() nodes
· 74fb1fa4
Mikko Ahlroth
authored
Feb 16, 2018
74fb1fa4
Hide whitespace changes
Inline
Side-by-side
assets/js/frontend/profile/total_info.component.js
View file @
74fb1fa4
import
{
el
,
mount
,
unmount
,
setChildren
}
from
'
redom
'
;
import
{
el
,
mount
,
unmount
,
setChildren
,
text
}
from
'
redom
'
;
import
LevelCounterComponent
from
'
../graphs/level_counter.component
'
;
import
ProgressBarComponent
from
'
../graphs/progress_bar.component
'
;
...
...
@@ -24,7 +24,7 @@ class TotalInfoComponent {
this
.
usernameEl
=
el
(
'
h1#profile-username
'
,
{
'
data-name
'
:
this
.
username
},
this
.
username
);
this
.
lastProgrammedEl
=
this
.
_getLastProgrammedEl
(
);
this
.
lastProgrammedEl
=
el
(
'
li
'
,
this
.
_getLastProgrammedEl
ems
()
);
this
.
profileDetailList
=
el
(
'
ul#profile-detail-list
'
,
[
el
(
'
li
'
,
[
...
...
@@ -65,9 +65,7 @@ class TotalInfoComponent {
this
.
newXp
+=
new_xp
;
this
.
lastDayCoded
=
DateTime
.
fromISO
(
sent_at_local
);
unmount
(
this
.
profileDetailList
,
this
.
lastProgrammedEl
);
this
.
lastProgrammedEl
=
this
.
_getLastProgrammedEl
();
mount
(
this
.
profileDetailList
,
this
.
lastProgrammedEl
);
setChildren
(
this
.
lastProgrammedEl
,
this
.
_getLastProgrammedElems
());
this
.
_updateChildren
();
}
...
...
@@ -85,12 +83,12 @@ class TotalInfoComponent {
return
el
(
'
time
'
,
this
.
_formatDate
(
date
),
{
datetime
:
date
.
toISODate
()});
}
_getLastProgrammedEl
()
{
_getLastProgrammedEl
ems
()
{
return
el
(
'
li
'
,
[
'
Last programmed
'
,
text
(
'
Last programmed
'
)
,
(
this
.
lastDayCoded
!=
null
)
&&
this
.
_getDateEl
(
this
.
lastDayCoded
),
(
this
.
lastDayCoded
==
null
)
&&
el
(
'
em
'
,
'
never
'
),
'
.
'
text
(
'
.
'
)
]);
}
}
...
...