Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
latoilescoute-dev
scoodle
Commits
2c3148fe
Unverified
Commit
2c3148fe
authored
Dec 17, 2021
by
Thomas Citharel
Browse files
Fix some HTML structure and JS formatting
Signed-off-by:
Thomas Citharel
<
tcit@tcit.fr
>
parent
5a5c233a
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/app/create_poll.js
View file @
2c3148fe
...
...
@@ -17,13 +17,13 @@
*/
$
(
document
).
ready
(
function
()
{
/**
* Error check when submitting form
*/
$
(
"
#formulaire
"
).
submit
(
function
(
event
)
{
var
isHidden
=
$
(
"
#hidden
"
).
prop
(
'
checked
'
);
var
isOptionAllUserCanModifyEverything
=
$
(
"
#editableByAll
"
).
is
(
"
:checked
"
);
var
isHidden
=
$
(
"
#hidden
"
).
prop
(
"
checked
"
);
var
isOptionAllUserCanModifyEverything
=
$
(
"
#editableByAll
"
).
is
(
"
:checked
"
);
if
(
isHidden
&&
isOptionAllUserCanModifyEverything
)
{
event
.
preventDefault
();
...
...
@@ -44,22 +44,23 @@ $(document).ready(function () {
}
});
/**
/**
* Enable/Disable ValueMax options
*/
$
(
"
#use_ValueMax
"
).
change
(
function
()
{
if
(
$
(
this
).
prop
(
"
checked
"
))
{
$
(
"
#ValueMax
"
).
removeClass
(
"
hidden
"
);
const
useValueMax
=
document
.
querySelector
(
"
#use_ValueMax
"
);
useValueMax
.
addEventListener
(
"
change
"
,
function
()
{
const
valueMaxOptions
=
document
.
querySelector
(
"
#value_max_options
"
);
if
(
useValueMax
.
checked
)
{
valueMaxOptions
.
classList
.
remove
(
"
hidden
"
);
}
else
{
$
(
"
#V
alueMax
"
).
addClass
(
"
hidden
"
);
v
alueMax
Options
.
classList
.
add
(
"
hidden
"
);
}
});
/**
* Hide/Show password options
*/
$
(
"
#use_password
"
).
change
(
function
(){
$
(
"
#use_password
"
).
change
(
function
()
{
if
(
$
(
this
).
prop
(
"
checked
"
))
{
$
(
"
#password_options
"
).
removeClass
(
"
hidden
"
);
}
else
{
...
...
@@ -88,9 +89,12 @@ $(document).ready(function () {
document
.
getElementById
(
"
cookie-warning
"
).
setAttribute
(
"
style
"
,
""
);
}
var
wrapper
=
new
MDEWrapper
(
$
(
'
#poll_comments
'
)[
0
],
$
(
'
#rich-editor-button
'
),
$
(
'
#simple-editor-button
'
));
if
(
$
(
'
#rich-editor-button
'
).
hasClass
(
'
active
'
))
{
var
wrapper
=
new
MDEWrapper
(
$
(
"
#poll_comments
"
)[
0
],
$
(
"
#rich-editor-button
"
),
$
(
"
#simple-editor-button
"
)
);
if
(
$
(
"
#rich-editor-button
"
).
hasClass
(
"
active
"
))
{
wrapper
.
enable
();
}
});
js/mde-wrapper.js
View file @
2c3148fe
function
myPreviewRender
(
text
)
{
text
=
text
.
replace
(
/
[\u
00A0-
\u
9999<>
\&]
/gim
,
function
(
i
)
{
return
'
&#
'
+
i
.
charCodeAt
(
0
)
+
'
;
'
;
function
myPreviewRender
(
text
)
{
text
=
text
.
replace
(
/
[\u
00A0-
\u
9999<>
\&]
/gim
,
function
(
i
)
{
return
"
&#
"
+
i
.
charCodeAt
(
0
)
+
"
;
"
;
});
text
=
SimpleMDE
.
prototype
.
markdown
(
text
);
text
=
DOMPurify
.
sanitize
(
text
);
return
text
;
}
;
}
function
MDEWrapper
(
textarea
,
enableButton
,
disableButton
)
{
this
.
element
=
textarea
;
...
...
tpl/create_poll.tpl
View file @
2c3148fe
...
...
@@ -129,36 +129,30 @@
{* Value MAX *}
<div
class=
"form-group
{
$errors
[
'ValueMax'
][
'class'
]
}
"
>
<label
for=
"use_valueMax"
class=
"col-sm-4 control-label"
>
{__('Step 1', 'Value Max')}
<br/>
<label
for=
"use_valueMax"
class=
"col-sm-4 control-label"
>
{__('Step 1', 'Value Max')}
<br/>
</label>
<div
class=
"col-sm-8"
>
<div
class=
"checkbox"
>
<label>
<input
id=
"use_ValueMax"
name=
"use_ValueMax"
type=
"checkbox"
{
if
$use_ValueMax
}
checked
{/
if
}
/>
{__('Step 1', "Limit the amount of voters per option")}
</label>
<div
class=
"col-sm-8"
>
<div
class=
"checkbox"
>
<label>
<input
id=
"use_ValueMax"
name=
"use_ValueMax"
type=
"checkbox"
{
if
$use_ValueMax
}
checked
{/
if
}
>
{__('Step 1', "Limit the amount of voters per option")}
</label>
</div>
</div>
</div>
<div
class=
"form-group
{
$errors
[
'ValueMax'
][
'class'
]
}
"
>
<div
id=
"ValueMax"
{
if
!
$use_ValueMax
}
class=
"hidden"
{/
if
}
>
</div>
</div>
<div
id=
"value_max_options"
{
if
!
$use_ValueMax
}
class=
"hidden"
{/
if
}
>
<div
class=
"col-sm-offset-4 col-sm-8"
>
<label>
<input
id=
"ValueMax"
type=
"number"
min=
"0"
name=
"ValueMax"
value=
"
{
$ValueMax
|
html
}
"
{
$errors
[
'ValueMax'
][
'aria'
]
}
>
<label
for=
"ValueMax"
>
<input
id=
"ValueMax"
type=
"number"
min=
"0"
name=
"ValueMax"
value=
"
{
$ValueMax
|
html
}
"
{
$errors
[
'ValueMax'
][
'aria'
]
}
/>
{__('Step 1', "ValueMax instructions")}
</label>
</div>
</div>
</div>
</div>
{
if
!
empty
(
$errors
[
'ValueMax'
][
'msg'
])
}
<div
class=
"alert alert-danger"
>
<p
id=
"poll_
customized_url
_error"
>
<p
id=
"poll_
value_max
_error"
>
{
$errors
[
'ValueMax'
][
'msg'
]
}
</p>
</div>
...
...
@@ -209,7 +203,7 @@
{* Password *}
<div
class=
"form-group"
>
<label
for=
"
poll_i
d"
class=
"col-sm-4 control-label"
>
<label
for=
"
use_passwor
d"
class=
"col-sm-4 control-label"
>
{__('Step 1', 'Poll password')}
</label>
...
...
@@ -263,7 +257,7 @@
</div>
<div
class=
"form-group"
>
<label
for=
"poll_id"
class=
"col-sm-4 control-label"
>
<label
class=
"col-sm-4 control-label"
>
{__('Step 1', 'Permissions')}
</label>
<div
class=
"col-sm-8"
>
...
...
Write
Preview
Supports
Markdown
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