Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
framadate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nounous
framadate
Commits
08416755
Unverified
Commit
08416755
authored
6 years ago
by
m
Committed by
Thomas Citharel
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ask name and comment before sending comment
Signed-off-by:
Thomas Citharel
<
tcit@tcit.fr
>
parent
aa690bb6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
js/app/studs.js
+44
-1
44 additions, 1 deletion
js/app/studs.js
locale/en.json
+1
-0
1 addition, 0 deletions
locale/en.json
tpl/part/comments.tpl
+12
-6
12 additions, 6 deletions
tpl/part/comments.tpl
with
57 additions
and
7 deletions
js/app/studs.js
+
44
−
1
View file @
08416755
...
...
@@ -16,6 +16,9 @@
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/
var
form
;
$
(
document
).
ready
(
function
()
{
...
...
@@ -108,7 +111,19 @@ $(document).ready(function () {
}
});
var
form
=
$
(
'
#comment_form
'
);
form
=
$
(
'
#comment_form
'
);
checkCommentSending
();
$
(
"
#comment_name
"
).
on
(
"
keyup change
"
,
checkCommentSending
);
$
(
"
#comment
"
).
on
(
"
keyup change
"
,
checkCommentSending
);
$
(
"
#comment_name
"
).
on
(
"
change
"
,
formatValues
);
$
(
"
#comment
"
).
on
(
"
change
"
,
formatValues
);
form
.
submit
(
function
(
event
)
{
event
.
preventDefault
();
...
...
@@ -168,3 +183,31 @@ $(document).ready(function () {
}
});
});
function
formatValues
()
{
var
value
=
$
(
this
).
val
().
trim
();
if
(
0
===
value
.
length
)
{
$
(
this
).
val
(
""
);
}
}
function
checkCommentSending
()
{
var
button
=
$
(
"
#add_comment
"
);
// on page load, "textSend" is not set
if
(
"
undefined
"
===
typeof
button
.
data
(
"
textSend
"
))
{
button
.
data
(
"
textSend
"
,
button
.
val
());
}
if
(
!
form
.
get
(
0
).
checkValidity
())
{
button
.
prop
(
"
disabled
"
,
true
);
button
.
val
(
button
.
data
(
"
textWait
"
));
}
else
{
button
.
prop
(
"
disabled
"
,
false
);
button
.
val
(
button
.
data
(
"
textSend
"
));
}
}
This diff is collapsed.
Click to expand it.
locale/en.json
+
1
−
0
View file @
08416755
...
...
@@ -84,6 +84,7 @@
"Remove the comment"
:
"Remove comment"
,
"Send the comment"
:
"Submit comment"
,
"Your comment"
:
"Comment"
,
"Type your name and a comment to send it"
:
"Type your name and a comment to send it"
,
"anonyme"
:
"anonymous"
},
"Date"
:
{
...
...
This diff is collapsed.
Click to expand it.
tpl/part/comments.tpl
+
12
−
6
View file @
08416755
...
...
@@ -13,17 +13,23 @@
{/
if
}
<div
class=
"hidden-print jumbotron"
>
<div
class=
"col-md-6 col-md-offset-3"
>
<fieldset
id=
"add-comment"
><legend>
{__('Comments', 'Add a comment to the poll')}
</legend>
<fieldset
id=
"add-comment"
><legend>
{__('Comments', 'Add a comment to the poll')
|html
}
</legend>
<div
class=
"form-group"
>
<label
for=
"comment_name"
class=
"control-label"
>
{__('Generic', 'Your name')}
</label>
<input
type=
"text"
name=
"name"
id=
"comment_name"
class=
"form-control"
maxlength=
"60"
/
>
<label
for=
"comment_name"
class=
"control-label"
>
{__('Generic', 'Your name')
|html
}
</label>
<input
type=
"text"
name=
"name"
id=
"comment_name"
class=
"form-control"
maxlength=
"60"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"comment"
class=
"control-label"
>
{__('Comments', 'Your comment')}
</label>
<textarea
name=
"comment"
id=
"comment"
class=
"form-control"
rows=
"2"
cols=
"40"
></textarea>
<label
for=
"comment"
class=
"control-label"
>
{__('Comments', 'Your comment')
|html
}
</label>
<textarea
name=
"comment"
id=
"comment"
class=
"form-control"
rows=
"2"
cols=
"40"
required
></textarea>
</div>
<div
class=
"pull-right"
>
<input
type=
"submit"
id=
"add_comment"
name=
"add_comment"
value=
"{__('Comments', 'Send the comment')}"
class=
"btn btn-success"
>
<button
type=
"submit"
id=
"add_comment"
value=
"{__('Comments', 'Send the comment')|html}"
class=
"btn btn-success"
data-text-wait=
"{__('Comments', 'Type your name and a comment to send it')|html}"
>
</div>
</fieldset>
</div>
...
...
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
register
or
sign in
to comment