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

@ -57,9 +57,10 @@ $config = [
'ToolbarSet' => 'Basic',
'Width' => '100%',
'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');
/* INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) */

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

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

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

Loading…
Cancel
Save