Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
9dcad99c
Commit
9dcad99c
authored
Feb 13, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generic modal box and toggle function instead of auth-specialized
parent
97568cc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
12 deletions
+53
-12
comex_lib_elts.js
static/js/comex_lib_elts.js
+52
-11
base_layout.html
templates/base_layout.html
+1
-1
No files found.
static/js/comex_lib_elts.js
View file @
9dcad99c
...
@@ -31,7 +31,7 @@ var cmxClt = (function(cC) {
...
@@ -31,7 +31,7 @@ var cmxClt = (function(cC) {
// an optional modal box for login/register credentials
// an optional modal box for login/register credentials
// -----------
// -----------
cC
.
elts
.
box
=
{}
cC
.
elts
.
box
=
{}
cC
.
elts
.
box
.
toggle
Auth
Box
cC
.
elts
.
box
.
toggleBox
cC
.
elts
.
box
.
addAuthBox
cC
.
elts
.
box
.
addAuthBox
cC
.
elts
.
box
.
postAuthBox
cC
.
elts
.
box
.
postAuthBox
cC
.
elts
.
box
.
authBox
=
null
cC
.
elts
.
box
.
authBox
=
null
...
@@ -110,27 +110,28 @@ var cmxClt = (function(cC) {
...
@@ -110,27 +110,28 @@ var cmxClt = (function(cC) {
}
}
// our self-made modal open/close function
// our self-made modal open/close function
cC
.
elts
.
box
.
toggleAuthBox
=
function
()
{
cC
.
elts
.
box
.
toggleBox
=
function
(
boxId
)
{
if
(
cC
.
elts
.
box
.
authBox
)
{
var
laBox
=
document
.
getElementById
(
boxId
)
if
(
cC
.
elts
.
box
.
authBox
.
style
.
display
==
'none'
)
{
if
(
laBox
)
{
if
(
laBox
.
style
.
display
==
'none'
)
{
// show box
// show box
cC
.
elts
.
box
.
auth
Box
.
style
.
display
=
'block'
la
Box
.
style
.
display
=
'block'
cC
.
elts
.
box
.
auth
Box
.
style
.
opacity
=
1
la
Box
.
style
.
opacity
=
1
// opacify .page element
// opacify .page element
if
(
cC
.
elts
.
elPage
)
cC
.
elts
.
elPage
.
style
.
opacity
=
.
2
if
(
cC
.
elts
.
elPage
)
cC
.
elts
.
elPage
.
style
.
opacity
=
.
2
}
}
else
{
else
{
// remove box
// remove box
cC
.
elts
.
box
.
auth
Box
.
style
.
opacity
=
0
la
Box
.
style
.
opacity
=
0
setTimeout
(
function
(){
cC
.
elts
.
box
.
auth
Box
.
style
.
display
=
'none'
},
300
)
setTimeout
(
function
(){
la
Box
.
style
.
display
=
'none'
},
300
)
// show .page
// show .page
if
(
cC
.
elts
.
elPage
)
cC
.
elts
.
elPage
.
style
.
opacity
=
''
if
(
cC
.
elts
.
elPage
)
cC
.
elts
.
elPage
.
style
.
opacity
=
''
}
}
}
}
else
{
else
{
console
.
warn
(
"Can't find
cmxClt.uauth.box.authBox try addAuthBox()
"
)
console
.
warn
(
"Can't find
box with id '"
+
$boxId
+
"'
"
)
}
}
}
}
...
@@ -208,7 +209,7 @@ var cmxClt = (function(cC) {
...
@@ -208,7 +209,7 @@ var cmxClt = (function(cC) {
<div class="modal-content">
<div class="modal-content">
<form id="auth_box" enctype="multipart/form-data">
<form id="auth_box" enctype="multipart/form-data">
<div class="modal-header">
<div class="modal-header">
<button type="button" class="close" onclick="cmxClt.elts.box.toggle
AuthBox(
)" aria-label="Close">
<button type="button" class="close" onclick="cmxClt.elts.box.toggle
Box('auth_modal'
)" aria-label="Close">
<span aria-hidden="true">×</span>
<span aria-hidden="true">×</span>
</button>
</button>
<h5 class="modal-title" id="authTitle">
${
title
}
</h5>
<h5 class="modal-title" id="authTitle">
${
title
}
</h5>
...
@@ -246,7 +247,7 @@ var cmxClt = (function(cC) {
...
@@ -246,7 +247,7 @@ var cmxClt = (function(cC) {
${
captchaBlock
}
${
captchaBlock
}
</div>
</div>
<div class="modal-footer">
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick='cmxClt.elts.box.toggle
AuthBox(
)'>
<button type="button" class="btn btn-secondary" onclick='cmxClt.elts.box.toggle
Box('auth_modal'
)'>
Cancel
Cancel
</button>
</button>
<!-- submit -->
<!-- submit -->
...
@@ -273,6 +274,46 @@ var cmxClt = (function(cC) {
...
@@ -273,6 +274,46 @@ var cmxClt = (function(cC) {
// /login box ----------------------------------------------------------
// /login box ----------------------------------------------------------
// generic message box -------------------------------------------------
// to create an html message modal with doors auth (reg or login)
cC
.
elts
.
box
.
addGenericBox
=
function
(
boxId
,
boxTitle
,
boxContent
)
{
// in a new div
var
myDiv
=
document
.
createElement
(
'div'
)
myDiv
.
innerHTML
=
`
<div class="modal fade self-made" id="
${
boxId
}
" role="dialog" aria-labelledby="authTitle" aria-hidden="true" style="display:none">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form id="auth_box" enctype="multipart/form-data">
<div class="modal-header">
<button type="button" class="close" onclick="cmxClt.elts.box.toggleBox('
${
boxId
}
')" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h5 class="modal-title" id="authTitle">
${
boxTitle
}
</h5>
</div>
<div class="modal-body mini-hero">
${
boxContent
}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="cmxClt.elts.box.toggleBox('
${
boxId
}
')">
Ok
</button>
</div>
</form>
</div>
</div>
</div>`
// append on body (no positioning now: it's a fixed overlay anyway)
var
body
=
document
.
querySelector
(
'body'
)
body
.
insertBefore
(
myDiv
,
body
.
lastChild
)
}
// /generic message box ------------------------------------------------
return
cC
return
cC
})(
cmxClt
)
;
})(
cmxClt
)
;
...
...
templates/base_layout.html
View file @
9dcad99c
...
@@ -178,7 +178,7 @@
...
@@ -178,7 +178,7 @@
<li>
<li>
<div
class=
"dropdown-a-like"
id=
"poplogin"
<div
class=
"dropdown-a-like"
id=
"poplogin"
data-toggle=
"dropdown"
data-toggle=
"dropdown"
onclick=
"cmxClt.elts.box.toggle
AuthBox(
)"
>
onclick=
"cmxClt.elts.box.toggle
Box('auth_modal'
)"
>
Login
</div>
Login
</div>
</li>
</li>
{% endif %}
{% endif %}
...
...
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