fix ckeditor in introduction to the course

pull/2818/head
Alex Aragón 7 years ago
parent 7b29a798a5
commit 5235be921f
  1. 8
      assets/js/main.js
  2. 3
      main/inc/introductionSection.inc.php
  3. 16
      main/inc/lib/formvalidator/FormValidator.class.php
  4. 19
      main/inc/lib/pear/HTML/QuickForm/textarea.php
  5. 31
      main/template/default/course_info/tools.html.twig

@ -1,6 +1,6 @@
// HEADER // HEADER
$(window).resize(function(){ /*$(window).resize(function(){
var widthScreen = $(window).width(); var widthScreen = $(window).width();
if(widthScreen >= 1400){ if(widthScreen >= 1400){
$('body').addClass('sidebar-lg-show'); $('body').addClass('sidebar-lg-show');
@ -15,7 +15,7 @@ $(window).resize(function(){
if(cardMain.height()>850){ if(cardMain.height()>850){
cardMain.css("height", "auto"); cardMain.css("height", "auto");
} }
}); });*/
$(function () { $(function () {
@ -25,6 +25,8 @@ $(function () {
if(widthScreen >= 1400){ if(widthScreen >= 1400){
$('body').addClass('sidebar-lg-show'); $('body').addClass('sidebar-lg-show');
} }
/*
// Calculation of Width for Card Container // Calculation of Width for Card Container
var main = $('#app-main'); var main = $('#app-main');
@ -36,7 +38,7 @@ $(function () {
if(cardMain.height()>850 || widthScreen <= 600){ if(cardMain.height()>850 || widthScreen <= 600){
cardMain.css("height", "auto"); cardMain.css("height", "auto");
} }
*/
var $inputTitle = $("#add_course_title"); var $inputTitle = $("#add_course_title");
$inputTitle.keyup(function () { $inputTitle.keyup(function () {

@ -57,9 +57,10 @@ $config = [
'ToolbarSet' => 'Basic', 'ToolbarSet' => 'Basic',
'Width' => '100%', 'Width' => '100%',
'Height' => '300', 'Height' => '300',
'style' => true
]; ];
$form->addHtmlEditor('intro_content', null, false, false, $config); $form->addHtmlEditor('intro_content', null, false, false, $config, ['card-full'=>true]);
$form->addButtonSave(get_lang('SaveIntroText'), 'intro_cmdUpdate'); $form->addButtonSave(get_lang('SaveIntroText'), 'intro_cmdUpdate');
/* INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) */ /* INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) */

@ -999,19 +999,22 @@ EOT;
* Adds a HTML-editor to the form. * Adds a HTML-editor to the form.
* *
* @param string $name * @param string $name
* @param string $label The label for the form-element * @param string $label The label for the form-element
* @param bool $required (optional) Is the form-element required (default=true) * @param bool $required (optional) Is the form-element required (default=true)
* @param bool $fullPage (optional) When it is true, the editor loads completed html code for a full page * @param bool $fullPage (optional) When it is true, the editor loads completed html code for a full page
* @param array $config (optional) Configuration settings for the online editor * @param array $config (optional) Configuration settings for the online editor
* @param array $attributes
* @throws Exception
* @throws HTML_QuickForm_Error
*/ */
public function addHtmlEditor( public function addHtmlEditor(
$name, $name,
$label, $label,
$required = true, $required = true,
$fullPage = false, $fullPage = false,
$config = [] $config = [],
$attributes = []
) { ) {
$attributes = [];
$attributes['rows'] = isset($config['rows']) ? $config['rows'] : 15; $attributes['rows'] = isset($config['rows']) ? $config['rows'] : 15;
$attributes['cols'] = isset($config['cols']) ? $config['cols'] : 80; $attributes['cols'] = isset($config['cols']) ? $config['cols'] : 80;
$attributes['cols-size'] = isset($config['cols-size']) ? $config['cols-size'] : []; $attributes['cols-size'] = isset($config['cols-size']) ? $config['cols-size'] : [];
@ -1025,6 +1028,7 @@ EOT;
/** @var HtmlEditor $element */ /** @var HtmlEditor $element */
$element = $this->getElement($name); $element = $this->getElement($name);
$config['style'] = false; $config['style'] = false;
if ($fullPage) { if ($fullPage) {
$config['fullPage'] = true; $config['fullPage'] = true;

@ -203,6 +203,10 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
public function getTemplate($layout) public function getTemplate($layout)
{ {
$size = $this->getColumnsSize(); $size = $this->getColumnsSize();
$custom = $this->getAttributes();
$this->removeAttribute('cols-size'); $this->removeAttribute('cols-size');
if (empty($size)) { if (empty($size)) {
@ -221,7 +225,8 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
</div>'; </div>';
break; break;
case FormValidator::LAYOUT_HORIZONTAL: case FormValidator::LAYOUT_HORIZONTAL:
return '
$template = '
<div class="form-group row {error_class}"> <div class="form-group row {error_class}">
<label {label-for} class="col-sm-'.$size[0].' col-form-label" > <label {label-for} class="col-sm-'.$size[0].' col-form-label" >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required --> <!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
@ -246,6 +251,18 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
</div> </div>
</div>'; </div>';
if(isset($custom['card-full']) && $custom['card-full'] == true){
$template = '
<label {label-for}>{label}</label>
<div class="card-textarea">
{element}
</div>
';
}
return $template;
break; break;
case FormValidator::LAYOUT_BOX_NO_LABEL: case FormValidator::LAYOUT_BOX_NO_LABEL:
return ' return '

@ -1,24 +1,23 @@
{% autoescape false %} {% autoescape false %}
<div class="course-tools"> <div class="course-tools">
<h2>{{ "Customize icons" | get_lang }}</h2>
<h2>{{ "Customize icons" | get_lang }}</h2> <div class="grid-tools">
<div class="grid-tools"> {% for tool in tools %}
{% for tool in tools %} <div class="items-tools">
<div class="items-tools"> <div class="tools mt-3 mb-3">
<div class="tools mt-3 mb-3"> <div class="big_icon">
<div class="big_icon"> <img src="{{ tool.image }}" alt="{{ tool.name }}" title="{{ tool.name }}"/>
<img src="{{ tool.image }}" alt="{{ tool.name }}" title="{{ tool.name }}"/> </div>
</div> <div class="content pt-2 pb-2">
<div class="content pt-2 pb-2"> {{ tool.name }}
{{ tool.name }} <div class="tool-btn">
<div class="tool-btn"> {{ tool.action }}
{{ tool.action }}
</div>
</div> </div>
</div> </div>
</div> </div>
{% endfor %}
</div> </div>
{% endfor %}
</div>
</div> </div>
{% endautoescape %} {% endautoescape %}

Loading…
Cancel
Save