MDL-48206 block_comments: textarea width 100%

This commit is contained in:
Sam Hemelryk
2014-11-14 11:40:30 +13:00
parent 0ac6d59990
commit 784188fcdf
5 changed files with 36 additions and 2 deletions
+28 -1
View File
@@ -71,6 +71,12 @@ class comment {
/** @var int The number of comments associated with this comments params */
protected $totalcommentcount = null;
/**
* Set to true to remove the col attribute from the textarea making it full width.
* @var bool
*/
protected $fullwidth = false;
/** @var bool Use non-javascript UI */
private static $nonjs = false;
/** @var int comment itemid used in non-javascript UI */
@@ -459,9 +465,20 @@ class comment {
if ($this->can_post()) {
// print posting textarea
$textareaattrs = array(
'name' => 'content',
'rows' => 2,
'id' => 'dlg-content-'.$this->cid
);
if (!$this->fullwidth) {
$textareaattrs['cols'] = '20';
} else {
$textareaattrs['class'] = 'fullwidth';
}
$html .= html_writer::start_tag('div', array('class' => 'comment-area'));
$html .= html_writer::start_tag('div', array('class' => 'db'));
$html .= html_writer::tag('textarea', '', array('name' => 'content', 'rows' => 2, 'cols' => 20, 'id' => 'dlg-content-'.$this->cid));
$html .= html_writer::tag('textarea', '', $textareaattrs);
$html .= html_writer::end_tag('div'); // .db
$html .= html_writer::start_tag('div', array('class' => 'fd', 'id' => 'comment-action-'.$this->cid));
@@ -945,6 +962,16 @@ class comment {
public function get_commentarea() {
return $this->commentarea;
}
/**
* Make the comments textarea fullwidth.
*
* @since 2.8.1 + 2.7.4
* @param bool $fullwidth
*/
public function set_fullwidth($fullwidth = true) {
$this->fullwidth = (bool)$fullwidth;
}
}
/**