Skip to content

Commit

Permalink
Enh: Add info regarding Admin Only pages without Stream support
Browse files Browse the repository at this point in the history
  • Loading branch information
luke- committed Feb 23, 2021
1 parent 6a2398a commit 0741141
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
1.3.1 (February 23, 2021)
-------------------------
- Fix: Stream Channel was set for AdminOnly pages
- Enh: Add info regarding "Admin Only" pages without Stream support


1.3.0 (February 22, 2021)
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Custom Pages",
"description": "Allows admins to create custom pages (html or markdown) or external links to various navigations (e.g. top navigation, account menu).",
"keywords": ["pages", "custom", "iframe", "markdown", "link", "navigation", "spaces"],
"version": "1.3.0",
"version": "1.3.1",
"homepage": "https://github.com/humhub/humhub-modules-custom-pages",
"humhub": {
"minVersion": "1.7"
Expand Down
48 changes: 29 additions & 19 deletions views/common/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@

<?= $form->field($page, 'visibility')->radioList($page->getVisibilitySelection()) ?>

<div class="alert alert-info infoAdminOnly"
<?php if ($page->visibility != Page::VISIBILITY_ADMIN_ONLY): ?>style="display:none"<?php endif; ?>>
<?= Yii::t('CustomPagesModule.views_common_edit', '<strong>Info: </strong> Pages marked as "Admin Only" are not shown in the stream!'); ?>
</div>

<?php if ($page->isAllowedField('in_new_window')) : ?>
<?php if ($page->hasAttribute('in_new_window')) : ?>
<?= $form->field($page, 'in_new_window')->checkbox() ?>
Expand All @@ -104,25 +109,30 @@
<?= Button::success(Yii::t('CustomPagesModule.views_common_edit', 'Inline Editor'))->link(Url::toInlineEdit($page, $target->container))->right()->icon('fa-pencil') ?>
<?php endif; ?>

<?= Html::script(<<<JS
$(document).one("humhub:ready", function () {
if (!$("#html_content").length) {
return;
}
setTimeout(function () {
CodeMirror.fromTextArea($("#html_content")[0], {
mode: "text/html",
lineNumbers: true,
extraKeys: {"Ctrl-Space": "autocomplete"}
})
}, 60);
}
);
JS
); ?>
<script <?= Html::nonce(); ?>>
$(document).one("humhub:ready", function () {
$('input[type="radio"][name="ContainerPage[visibility]"]').click(function () {
if ($(this).attr("value") == <?= Page::VISIBILITY_ADMIN_ONLY ?>) {
$(".infoAdminOnly").show();
} else {
$(".infoAdminOnly").hide();
}
});

if (!$("#html_content").length) {
return;
}

setTimeout(function () {
CodeMirror.fromTextArea($("#html_content")[0], {
mode: "text/html",
lineNumbers: true,
extraKeys: {"Ctrl-Space": "autocomplete"}
})
}, 60);
}
);
</script>
<?php ActiveForm::end(); ?>
</div>
</div>

0 comments on commit 0741141

Please sign in to comment.