Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Maxime Chaillet
doi-landing-page
Commits
dcceb909
Commit
dcceb909
authored
Oct 16, 2018
by
Maxime Chaillet
Browse files
Fix session badge not displayed. It fixes
icat/doi-landing-page#55
.
parent
fbcf9f9f
Pipeline
#5932
canceled with stages
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Readme.md
View file @
dcceb909
...
...
@@ -24,6 +24,7 @@ The grunFile.js has 2 tasks.
To test the changes locally on your computer:
*
Prepare the project ( check js files, create the dev.html file from the dev.tpl.html template )
```
cd www
grunt dev
```
*
Copy the www folder (not all files are needed but it is easy) to apache folder
...
...
@@ -34,12 +35,13 @@ sudo rm -fr /var/www/html && sudo cp -r www/. /var/www/html/
Replace prefix and suffix with real values. Note that the stating page is dev.html. In production , the starting page will be index.html.
*
Once you are satisfied with your work, prepare the project for production
```
cd www
grunt
```
*
Submit a merge request on icat repository at https://gitlab.esrf.fr/icat/doi-landing-page
### How to prepare the docker container locally for testing purpose
*
Make sure the p
o
rject is prepared for production (check js files, concatene them, minify them, handle other js dependancies)
*
Make sure the pr
o
ject is prepared for production (check js files, concatene them, minify them, handle other js dependancies)
```
grunt
```
...
...
www/min/doi.min.js
View file @
dcceb909
This diff is collapsed.
Click to expand it.
www/min/precompiled.templates.min.js
View file @
dcceb909
(
function
(
dust
){
dust
.
register
(
"
badges_tpl
"
,
body_0
);
function
body_0
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
row margin-left-0 margin-right-0
\"
>
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_1
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
resourceType
"
]),
"
value
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
ES_RESOURCE_TYPE
"
])},
"
h
"
).
w
(
"
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_2
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
resourceType
"
]),
"
value
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
DC_RESOURCE_TYPE
"
])},
"
h
"
).
w
(
"
<div class=
\"
col
\"
> </div>
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_3
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
resourceTypeGeneral
"
]),
"
value
"
:
"
Dataset
"
},
"
h
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_4
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
accessibility
"
]),
"
value
"
:
"
Open access
"
},
"
h
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_5
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
accessibility
"
]),
"
value
"
:
"
Restricted access
"
},
"
h
"
).
w
(
"
</div>
"
);}
body_0
.
__dustBody
=!
0
;
function
body_1
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-secondary font-1p4rem
\"
> Session </span></div>
"
);}
body_1
.
__dustBody
=!
0
;
function
body_2
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-secondary font-1p4rem
\"
> Data collection </span></div>
"
);}
body_2
.
__dustBody
=!
0
;
function
body_3
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-secondary font-1p4rem
\"
> Dataset </span></div>
"
);}
body_3
.
__dustBody
=!
0
;
function
body_4
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-success font-1p4rem
\"
> Open access </span></div>
"
);}
body_4
.
__dustBody
=!
0
;
function
body_5
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-warning font-1p4rem
\"
> Restricted access </span></div>
"
);}
body_5
.
__dustBody
=!
0
;
return
body_0
}(
dust
));
(
function
(
dust
){
dust
.
register
(
"
badges_tpl
"
,
body_0
);
function
body_0
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
row margin-left-0 margin-right-0
\"
>
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_1
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
resourceType
"
]),
"
value
"
:
ctx
.
getPath
(
false
,
[
"
constants
"
,
"
ES_RESOURCE_TYPE
"
])},
"
h
"
).
w
(
"
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_2
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
resourceType
"
]),
"
value
"
:
ctx
.
getPath
(
false
,
[
"
constants
"
,
"
DC_RESOURCE_TYPE
"
])},
"
h
"
).
w
(
"
<div class=
\"
col
\"
> </div>
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_3
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
resourceTypeGeneral
"
]),
"
value
"
:
"
Dataset
"
},
"
h
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_4
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
accessibility
"
]),
"
value
"
:
"
Open access
"
},
"
h
"
).
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_5
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
accessibility
"
]),
"
value
"
:
"
Restricted access
"
},
"
h
"
).
w
(
"
</div>
"
);}
body_0
.
__dustBody
=!
0
;
function
body_1
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-secondary font-1p4rem
\"
> Session </span></div>
"
);}
body_1
.
__dustBody
=!
0
;
function
body_2
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-secondary font-1p4rem
\"
> Data collection </span></div>
"
);}
body_2
.
__dustBody
=!
0
;
function
body_3
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-secondary font-1p4rem
\"
> Dataset </span></div>
"
);}
body_3
.
__dustBody
=!
0
;
function
body_4
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-success font-1p4rem
\"
> Open access </span></div>
"
);}
body_4
.
__dustBody
=!
0
;
function
body_5
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
col-auto padding-right-2 padding-left-2
\"
><span class=
\"
badge badge-warning font-1p4rem
\"
> Restricted access </span></div>
"
);}
body_5
.
__dustBody
=!
0
;
return
body_0
}(
dust
));
(
function
(
dust
){
dust
.
register
(
"
doinotfound_tpl
"
,
body_0
);
function
body_0
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
container-fluid
\"
style=
\"
color:black;
\"
><div class=
\"
row
\"
><div class=
\"
col-3
\"
> </div><div class=
\"
col-6 lightRedBackground text-center rounded
\"
> <p>
"
).
f
(
ctx
.
get
([
"
message
"
],
false
),
ctx
,
"
h
"
,[
"
s
"
]).
w
(
"
</p> </div></div><div class=
\"
col-3
\"
> </div></div>
"
);}
body_0
.
__dustBody
=!
0
;
return
body_0
}(
dust
));
(
function
(
dust
){
dust
.
register
(
"
doinotfound2_tpl
"
,
body_0
);
function
body_0
(
chk
,
ctx
){
return
chk
.
f
(
ctx
.
get
([
"
message
"
],
false
),
ctx
,
"
h
"
,[
"
s
"
]);}
body_0
.
__dustBody
=!
0
;
return
body_0
}(
dust
));
(
function
(
dust
){
dust
.
register
(
"
experimentalreport_tpl
"
,
body_0
);
function
body_0
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
card-header text-center
\"
><label>Experimental report </label></div><div class=
\"
card-body padding10
\"
>
"
).
x
(
ctx
.
get
([
"
data
"
],
false
),
ctx
,{
"
else
"
:
body_1
,
"
block
"
:
body_2
},{});}
body_0
.
__dustBody
=!
0
;
function
body_1
(
chk
,
ctx
){
return
chk
.
w
(
"
<p class=
\"
card-text
\"
> There is currently no experimental report. </p></div>
"
);}
body_1
.
__dustBody
=!
0
;
function
body_2
(
chk
,
ctx
){
return
chk
.
h
(
"
eq
"
,
ctx
,{
"
block
"
:
body_3
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
length
"
]),
"
value
"
:
1
},
"
h
"
).
h
(
"
gt
"
,
ctx
,{
"
block
"
:
body_4
},{
"
key
"
:
ctx
.
getPath
(
false
,
[
"
data
"
,
"
length
"
]),
"
value
"
:
1
},
"
h
"
).
w
(
"
"
);}
body_2
.
__dustBody
=!
0
;
function
body_3
(
chk
,
ctx
){
return
chk
.
w
(
"
<p class=
\"
card-text
\"
> <b> One </b> report has been found for this proposal. </p></div><div class=
\"
card-body
\"
> <button type=
\"
button
\"
class=
\"
btn btn-primary btn-lg btn-block
\"
onclick=
\"
javascript:(function(){ var expRep = new ExperimentalReportController(); expRep.openFileInNewTab('
"
).
f
(
ctx
.
getPath
(
false
,
[
"
data
"
,
"
0
"
]),
ctx
,
"
h
"
).
w
(
"
'); })()
\"
> <span class=
\"
fa fa-download whiteFont
\"
></span>
"
).
f
(
ctx
.
getPath
(
false
,
[
"
data
"
,
"
0
"
]),
ctx
,
"
h
"
).
w
(
"
</button></div>
"
);}
body_3
.
__dustBody
=!
0
;
function
body_4
(
chk
,
ctx
){
return
chk
.
w
(
"
<p class=
\"
card-text
\"
> In total, <b>
"
).
f
(
ctx
.
getPath
(
false
,
[
"
data
"
,
"
length
"
]),
ctx
,
"
h
"
).
w
(
"
</b> reports have been found for this proposal: </p></div> <div class=
\"
card-body
\"
><div class=
\"
scroll-box
\"
>
"
).
s
(
ctx
.
get
([
"
data
"
],
false
),
ctx
,{
"
block
"
:
body_5
},{}).
w
(
"
</div> </div>
"
);}
body_4
.
__dustBody
=!
0
;
function
body_5
(
chk
,
ctx
){
return
chk
.
w
(
"
"
).
h
(
"
sep
"
,
ctx
,{
"
block
"
:
body_6
},{},
"
h
"
).
h
(
"
last
"
,
ctx
,{
"
block
"
:
body_7
},{},
"
h
"
);}
body_5
.
__dustBody
=!
0
;
function
body_6
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
row
\"
> <div class=
\"
col-1
\"
> </div><div class=
\"
col-10 padding-bottom-10
\"
><button type=
\"
button
\"
class=
\"
btn btn-primary btn-lg btn-block
\"
onclick=
\"
javascript:(function(){ var expRep = new ExperimentalReportController(); expRep.openFileInNewTab('
"
).
f
(
ctx
.
getPath
(
true
,
[]),
ctx
,
"
h
"
).
w
(
"
'); })()
\"
> <span class=
\"
fa fa-download whiteFont
\"
></span> <span class=
\"
whitefont
\"
>
"
).
f
(
ctx
.
getPath
(
true
,
[]),
ctx
,
"
h
"
).
w
(
"
</span> </button></div><div class=
\"
col-1
\"
> </div> </div>
"
);}
body_6
.
__dustBody
=!
0
;
function
body_7
(
chk
,
ctx
){
return
chk
.
w
(
"
<div class=
\"
row
\"
> <div class=
\"
col-1
\"
> </div><div class=
\"
col-10
\"
><button type=
\"
button
\"
class=
\"
btn btn-primary btn-lg btn-block
\"
onclick=
\"
javascript:(function(){ var expRep = new ExperimentalReportController(); expRep.openFileInNewTab('
"
).
f
(
ctx
.
getPath
(
true
,
[]),
ctx
,
"
h
"
).
w
(
"
'); })()
\"
> <span class=
\"
fa fa-download whiteFont
\"
></span> <span class=
\"
whitefont
\"
>
"
).
f
(
ctx
.
getPath
(
true
,
[]),
ctx
,
"
h
"
).
w
(
"
</span> </button></div><div class=
\"
col-1
\"
> </div> </div>
"
);}
body_7
.
__dustBody
=!
0
;
return
body_0
}(
dust
));
...
...
www/src/doiview.js
View file @
dcceb909
...
...
@@ -140,7 +140,8 @@ DOIView.prototype.renderBadges = function (data) {
var
_this
=
this
;
dust
.
render
(
'
badges_tpl
'
,
{
data
:
data
data
:
data
,
constants
:
CONSTANTS
},
function
(
err
,
out
)
{
$
(
'
#
'
+
_this
.
badgePanelId
).
html
(
out
);
});
...
...
www/templates/badges_tpl.js
View file @
dcceb909
<
div
class
=
"
row margin-left-0 margin-right-0
"
>
{@
eq
key
=
data
.
resourceType
value
=
data
.
ES_RESOURCE_TYPE
}
{@
eq
key
=
data
.
resourceType
value
=
constants
.
ES_RESOURCE_TYPE
}
<
div
class
=
"
col-auto padding-right-2 padding-left-2
"
>
<
span
class
=
"
badge badge-secondary font-1p4rem
"
>
Session
<
/span
>
<
/div
>
{
/eq}
{@
eq
key
=
data
.
resourceType
value
=
data
.
DC_RESOURCE_TYPE
}
{@
eq
key
=
data
.
resourceType
value
=
constants
.
DC_RESOURCE_TYPE
}
<
div
class
=
"
col-auto padding-right-2 padding-left-2
"
>
<
span
class
=
"
badge badge-secondary font-1p4rem
"
>
Data
collection
<
/span
>
<
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment