We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit c79d90be authored by Zach Copley's avatar Zach Copley

Only remove reply placeholders if the dummy answer field is visible

parent 5721bb14
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
var QnA = { var QnA = {
// @fixme: Should use ID // @fixme: Should use ID
close: function(closeButt) { close: function(form, best) {
var notice = $(closeButt).closest('li.hentry.notice.question'); var notice = $(form).closest('li.hentry.notice.question');
console.log("close"); console.log("close");
...@@ -16,8 +16,18 @@ var QnA = { ...@@ -16,8 +16,18 @@ var QnA = {
notice.find('ul > li.notice-answer-placeholder').remove(); notice.find('ul > li.notice-answer-placeholder').remove();
notice.find('ul > li.notice-answer').remove(); notice.find('ul > li.notice-answer').remove();
if (best) {
var p = notice.parent().find('div.question-description > form > fieldset > p');
if (p.length != 0) {
p.append($('<span class="question-closed">This question is closed.</span>'));
}
}
}, },
init: function() { init: function() {
QnA.NoticeInlineAnswerSetup(); QnA.NoticeInlineAnswerSetup();
...@@ -25,8 +35,8 @@ var QnA = { ...@@ -25,8 +35,8 @@ var QnA = {
$('form.form_question_show').live('submit', function() { $('form.form_question_show').live('submit', function() {
QnA.close(this); QnA.close(this);
}); });
$('form.form_answer_show').live('click', function() { $('form.form_answer_show').live('submit', function() {
QnA.close(this); QnA.close(this, true);
}); });
}, },
...@@ -99,7 +109,12 @@ var QnA = { ...@@ -99,7 +109,12 @@ var QnA = {
$('body').click(function(e) { $('body').click(function(e) {
console.log("body click handler - got click"); console.log("body click handler - got click");
hideReplyPlaceholders(notice); var dummyAnswer = $('ul.qna-dummy', notice);
var style = dummyAnswer.attr('style');
if (style !== 'display: none;') {
hideReplyPlaceholders(notice);
}
var openAnswers = $('li.notice-answer'); var openAnswers = $('li.notice-answer');
if (openAnswers.length > 0) { if (openAnswers.length > 0) {
...@@ -352,7 +367,7 @@ var QnA = { ...@@ -352,7 +367,7 @@ var QnA = {
var answerItem = form.closest('li.notice-answer'); var answerItem = form.closest('li.notice-answer');
var questionItem = form.closest('li.question'); var questionItem = form.closest('li.question');
var dummyAnswer = form.find('ul.qna-dummy').remove(); var dummyAnswer = form.find('ul.qna-dummy', questionItem).remove();
if (answerItem.length > 0) { if (answerItem.length > 0) {
console.log("FormAnswerXHR - I found the answer li to append to"); console.log("FormAnswerXHR - I found the answer li to append to");
......
...@@ -149,7 +149,7 @@ class QnashowanswerForm extends Form ...@@ -149,7 +149,7 @@ class QnashowanswerForm extends Form
// TRANS: Button text for marking an answer as "best" // TRANS: Button text for marking an answer as "best"
_m('BUTTON', 'Best'), _m('BUTTON', 'Best'),
'submit', 'submit',
'submit', 'best',
// TRANS: Title for button text marking an answer as "best" // TRANS: Title for button text marking an answer as "best"
_('Mark as best answer') _('Mark as best answer')
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment