* show number of answers on question notices
* change label on answer submit button to "Answer"
This commit is contained in:
Zach Copley 2011-04-04 22:04:36 -07:00
parent 984869e5fb
commit cd7ab56874
4 changed files with 24 additions and 6 deletions

View File

@ -189,9 +189,11 @@ class QnA_Question extends Managed_DataObject
function countAnswers()
{
$a = new QnA_Answer();
$a = new QnA_Answer();
$a->question_id = $this->id;
return $a-count();
return $a->count();
}
static function fromNotice($notice)
@ -221,6 +223,14 @@ class QnA_Question extends Managed_DataObject
$out->elementEnd('span');
}
$cnt = $question->countAnswers();
if (!empty($cnt)) {
$out->elementStart('span', 'answer-count');
$out->text(sprintf(_m('%s answers'), $cnt));
$out->elementEnd('span');
}
if (!empty($question->closed)) {
$out->elementStart('span', 'question-closed');
$out->text(_m('This question is closed.'));

View File

@ -118,7 +118,7 @@ class QnanewanswerForm extends Form
function formActions()
{
// TRANS: Button text for submitting a poll response.
$this->out->submit('submit', _m('BUTTON', 'Submit'));
$this->out->submit('submit', _m('BUTTON', 'Answer'));
}
}

View File

@ -65,8 +65,8 @@ class QnashowanswerForm extends Form
{
parent::__construct($out);
$this->answer = $answer;
$this->question = $answer->getQuestion();
$this->answer = $answer;
$this->question = $answer->getQuestion();
}
/**
@ -155,6 +155,13 @@ class QnashowanswerForm extends Form
}
}
/*
* @fixme: Revise is disabled until we figure out the
* Ostatus bits This comment is just a reminder
* that the UI for this works.
*/
/*
if ($user->id == $this->answer->profile_id) {
$this->out->submit(
'revise',
@ -166,6 +173,7 @@ class QnashowanswerForm extends Form
_('Revise your answer')
);
}
*/
}
}