summaryrefslogtreecommitdiffstats
path: root/modules-available/news
diff options
context:
space:
mode:
authorChristian Klinger2016-06-24 15:23:57 +0200
committerChristian Klinger2016-06-24 15:23:57 +0200
commit22789bbd4f9c843409475d67099a4e4ac31fe248 (patch)
treefd6e1811744192589696552ff918f3e2d79235ba /modules-available/news
parentMerge branch 'modularization' of dnbd3:openslx-ng/slx-admin into modularization (diff)
downloadslx-admin-22789bbd4f9c843409475d67099a4e4ac31fe248.tar.gz
slx-admin-22789bbd4f9c843409475d67099a4e4ac31fe248.tar.xz
slx-admin-22789bbd4f9c843409475d67099a4e4ac31fe248.zip
added summernote as an optional wysiwyg-editor.
Diffstat (limited to 'modules-available/news')
-rw-r--r--modules-available/news/page.inc.php7
-rw-r--r--modules-available/news/templates/page-news.html23
2 files changed, 27 insertions, 3 deletions
diff --git a/modules-available/news/page.inc.php b/modules-available/news/page.inc.php
index ce24c424..ee13ea8c 100644
--- a/modules-available/news/page.inc.php
+++ b/modules-available/news/page.inc.php
@@ -16,6 +16,7 @@ class Page_News extends Page
private $newsDate = false;
private $helpContent = '';
private $editHelp = false;
+ private $hasSummernote = false;
/**
* Implementation of the abstract doPreprocess function.
@@ -25,6 +26,9 @@ class Page_News extends Page
*/
protected function doPreprocess()
{
+ /* load summernote module if available */
+ $this->hasSummernote = Module::isAvailable('summernote');
+
// load user, we will need it later
User::load();
@@ -129,7 +133,8 @@ class Page_News extends Page
'latestHelp' => $this->helpContent,
'editHelp' => $this->editHelp,
'list' => $lines,
- 'listHelp' => $linesHelp, ));
+ 'listHelp' => $linesHelp,
+ 'hasSummernote' => $this->hasSummernote ));
}
/**
* Loads the news with the given ID into the form.
diff --git a/modules-available/news/templates/page-news.html b/modules-available/news/templates/page-news.html
index 79720df4..0eaeb52b 100644
--- a/modules-available/news/templates/page-news.html
+++ b/modules-available/news/templates/page-news.html
@@ -62,7 +62,7 @@
<form action="?do=News&amp;action=save" method="post">
<div class="form-group">
<label for="news-content-id">{{lang_content}}</label>
- <textarea name="help-content" id ="help-content-id" class="form-control" rows="5" cols="30" placeholder="">{{latestHelp}}</textarea>
+ <textarea name="help-content" id ="help-content-id" class="form-control" style="min-height:400px" placeholder="">{{latestHelp}}</textarea>
</div>
<button class="btn btn-primary btn-sm" name="news-type" value="help" type="submit">{{lang_save}}</button>
<input type="hidden" name="token" value="{{token}}">
@@ -102,4 +102,23 @@
</div>
</div>
</div>
-
+{{#hasSummernote}}
+<script>
+document.addEventListener("DOMContentLoaded", function () {
+ $('#news-content-id, #help-content-id').summernote( {
+ toolbar: [
+ // [groupName, [list of button]]
+ ['style', ['bold', 'italic', 'underline', 'clear']],
+ ['font', ['strikethrough', 'superscript', 'subscript']],
+ // ['fontsize', ['fontsize']],
+ ['color', ['color']],
+ ['para', ['ul', 'ol', 'paragraph']],
+ ['misc', ['codeview', 'undo', 'redo', 'fullscreen']]
+ //['height', ['height']]
+ ],
+ height: '300px'
+ }
+ );
+});
+</script>
+{{/hasSummernote}}