Skip to content

Commit

Permalink
Minir improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed Nov 30, 2021
1 parent 296da87 commit 037399d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

class Module extends \humhub\components\Module
{
public $resourcesPath = 'resources';

/**
* @var array Allowed text extensions with mime types
*/
Expand Down
1 change: 1 addition & 0 deletions controllers/EditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function actionIndex()

return $this->renderAjax('index', [
'fileUpdate' => $fileUpdate,
'file' => $file
]);
}

Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Changelog
=========

0.0.1 - Unreleased
1.0.0 - Unreleased
-------------------------
- Init: Initialize Module "Text editor"
- Fix #5: Position of "Edit" Handler
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Text editor

File handler for edit text files with extensions `txt`, `log`, `xml`.
A simple plain text editor module. Text files can be created, edited or viewed.

Especially useful in combination with the Files module. Here also a versioning of the text files is supported.
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "text-editor",
"name": "Text editor",
"description": "Text editor.",
"keywords": ["text editor"],
"version": "0.0.1",
"description": "A simple plain text file editor for the File module.",
"keywords": ["text editor", "text", "editor", "filehandler"],
"version": "1.0.0",
"humhub": {
"minVersion": "1.10"
}
Expand Down
6 changes: 2 additions & 4 deletions views/edit/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@
use humhub\widgets\ModalDialog;

/* @var $fileUpdate FileUpdate */
/* @var $file \humhub\modules\file\models\File */

Assets::register($this);
?>

<?php ModalDialog::begin([
'header' => Yii::t('TextEditorModule.base', '<strong>Edit</strong> file', ['fileName' => Html::encode($fileUpdate->file->file_name)]),
'header' => Yii::t('TextEditorModule.base', '<strong>Edit file:</strong> {fileName}', ['fileName' => Html::encode($file->file_name)]),
'options' => ['style' => 'width:95%'],
]) ?>
<div data-ui-widget="text_editor.Editor" data-ui-init>

<?php $form = ActiveForm::begin(['method' => 'post', 'acknowledge' => true]) ?>
<div class="modal-body">
<h3 style="padding-top:0px;margin-top:0px"><?= Html::encode($fileUpdate->file->file_name) ?></h3>
<br/>

<?= $form->field($fileUpdate, 'newFileContent')->textarea(['rows' => 20])->label(false) ?>

<div class="clearfix"></div>
Expand Down
6 changes: 1 addition & 5 deletions views/view/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@
?>

<?php ModalDialog::begin([
'header' => Yii::t('TextEditorModule.base', '<strong>View</strong> file', ['fileName' => Html::encode($file->file_name)]),
'header' => Yii::t('TextEditorModule.base', '<strong>View file:</strong> {fileName}', ['fileName' => Html::encode($file->file_name)]),
'options' => ['style' => 'width:95%'],
]) ?>
<div class="modal-body">
<h3 style="padding-top:0px;margin-top:0px"><?= Html::encode($file->file_name) ?></h3>
<br />

<pre><?= htmlentities(file_get_contents($file->getStore()->get())) ?></pre>

<div class="clearfix"></div>
</div>

Expand Down

0 comments on commit 037399d

Please sign in to comment.