Add 'Answer as ...' in forms
parent
2ebe2b955c
commit
cd65bea28c
|
@ -331,6 +331,10 @@
|
|||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
.cp-form-anon-answer-registered {
|
||||
font-style: italic;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2346,6 +2346,7 @@ define([
|
|||
} else if (content.answers.anonymous) {
|
||||
// Answers aren't anonymous and guests are allowed
|
||||
// Guests can set a username and logged in users can answer anonymously
|
||||
var $anon;
|
||||
if (!loggedIn) {
|
||||
anonName = h('div.cp-form-anon-answer-input', [
|
||||
Messages.form_answerAs,
|
||||
|
@ -2355,15 +2356,24 @@ define([
|
|||
})
|
||||
]);
|
||||
$anonName = $(anonName).hide();
|
||||
$anonBox.on('change', function () {
|
||||
if (Util.isChecked($anonBox)) { $anonName.hide(); }
|
||||
else { $anonName.show(); }
|
||||
});
|
||||
} else if (APP.cantAnon) {
|
||||
// You've already answered with your credentials
|
||||
$cbox.hide();
|
||||
$anonBox.attr('disabled', 'disabled').prop('checked', false);
|
||||
}
|
||||
if (!anonName) {
|
||||
anonName = h('div.cp-form-anon-answer-input', [
|
||||
Messages.form_answerAs,
|
||||
h('span.cp-form-anon-answer-registered', user.name || Messages.anonymous)
|
||||
]);
|
||||
}
|
||||
if (!APP.cantAnon) {
|
||||
var $anon = $(anonName).hide();
|
||||
$anonBox.on('change', function () {
|
||||
if (Util.isChecked($anonBox)) { $anon.hide(); }
|
||||
else { $anon.show(); }
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Answers don't have to be anonymous and only logged in users can answer
|
||||
// ==> they have to answer with their keys so we know their name too
|
||||
|
@ -2374,7 +2384,7 @@ define([
|
|||
$cbox.after(h('div.alert.alert-info', Messages.form_authAnswer));
|
||||
});
|
||||
}
|
||||
if (update && content.answers.cantEdit) {
|
||||
if (update && content.answers.cantEdit || APP.isClosed) {
|
||||
$cbox.hide();
|
||||
anonName = undefined;
|
||||
}
|
||||
|
@ -3036,6 +3046,13 @@ define([
|
|||
new Date(answers._time || APP.lastAnswerTime).toLocaleString()])));
|
||||
}
|
||||
|
||||
if (APP.isClosed) {
|
||||
APP.formBlocks.forEach(function (b) {
|
||||
if (!b.setEditable) { return; }
|
||||
b.setEditable(false);
|
||||
});
|
||||
}
|
||||
|
||||
// In view mode, add "Submit" and "reset" buttons
|
||||
$container.append(makeFormControls(framework, content, Boolean(answers), evOnChange));
|
||||
|
||||
|
|
Loading…
Reference in New Issue