Merge branch '48206-29' of git://github.com/samhemelryk/moodle

Conflicts:
	theme/bootstrapbase/style/moodle.css
This commit is contained in:
Eloy Lafuente (stronk7) 2014-11-19 21:18:37 +01:00
commit 4067991016
5 changed files with 36 additions and 2 deletions

View File

@ -78,6 +78,7 @@ class block_comments extends block_base {
$args->displaycancel = false;
$comment = new comment($args);
$comment->set_view_permission(true);
$comment->set_fullwidth();
$this->content = new stdClass();
$this->content->text = $comment->output(true);

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;
}
}
/**

View File

@ -680,6 +680,7 @@ table.mod_index {width:100%;}
.comment-ctrl h5 {margin:0;padding: 5px;}
.comment-area {max-width: 400px;padding: 5px;}
.comment-area textarea {width:100%;overflow:auto;}
.comment-area textarea.fullwidth {-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
.comment-area .fd {text-align:right;}
.comment-meta span {color:gray;}
.comment-link img { vertical-align: text-bottom; }

View File

@ -653,6 +653,11 @@ table.mod_index {
.comment-area textarea {
width: 100%;
overflow: auto;
&.fullwidth {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
}
.comment-area .fd {
text-align: right;

File diff suppressed because one or more lines are too long