Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24.11.00 grapes page title control #133

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
<head>
<meta charset="UTF-8">
{if $canEdit}
<div style="position:absolute;top:50px;right:10px"><button onclick="window.location.href='{$editPageUrl|escape: 'html'}'">{translate text="Edit Page" isPublicFacing=false}</button></div>
<div style="position:absolute;top:30px;right:10px"><button onclick="window.location.href='{$editPageUrl|escape: 'html'}'">{translate text="Edit Page" isPublicFacing=false}</button></div>
{/if}
<title>{$title|escape: 'html'}</title>
</head>
<body>
<h1>{$title|escape: 'html'}</h1>
{if $showTitleOnPage}
<h1>{$title|escape: 'html'}</h1>
{/if}
<div id="content">
{$templateContent}
</div>
Expand Down
3 changes: 3 additions & 0 deletions code/web/release_notes/24.11.00.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Aspen Discovery Updates
### Web Builder - Grapes JS Updates
- Add the ability for users to control whether the title they assign to their Grapes JS pages is displayed when viewing as a page. (*AB*)
4 changes: 3 additions & 1 deletion code/web/services/WebBuilder/GrapesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function launch() {
global $interface;

$title = $this->grapesPage->title;
$showTitleOnPage = $this->grapesPage->showTitleOnPage;
$interface->assign('id', $this->grapesPage->id);
$interface->assign('contents', $this->grapesPage->getFormattedContents());
$editButton = $this->generateEditPageUrl();
Expand All @@ -58,6 +59,7 @@ function launch() {
}
$interface->assign('templateContent', $templateContent);
$interface->assign('title', $title);
$interface->assign('showTitleOnPage', $showTitleOnPage);

$this->display('grapesPage.tpl', $title, '', false);
}
Expand All @@ -68,7 +70,7 @@ function canView(): bool {

function generateEditPageUrl() {
$objectId = $this->grapesPage->id;
$templatesSelect - $this->grapesPage->templatesSelect;
$templatesSelect = $this->grapesPage->templatesSelect;
return '/services/WebBuilder/GrapesJSEditor?objectAction=edit&id=' . $objectId . '&tempalteId=' . $templatesSelect;
}

Expand Down
16 changes: 16 additions & 0 deletions code/web/sys/DBMaintenance/version_updates/24.11.00.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

function getUpdates24_11_00(): array {
$curTime = time();
return [
//alexander - PTFS Europe
'optional_show_title_on_grapes_pages' => [
'title' => 'Optional Show Title On Grapes Pages',
'description' => 'Make displaying a given title on a grapes page optional',
'continueOnError' => false,
'sql' => [
'ALTER TABLE grapes_web_builder ADD COLUMN showTitleOnPage TINYINT NOT NULL DEFAULT 1'
],
],//optional_show_title_on_grapes_pages
];
}
9 changes: 9 additions & 0 deletions code/web/sys/WebBuilder/GrapesPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class GrapesPage extends DB_LibraryLinkedObject {
public $__table = 'grapes_web_builder';
public $id;
public $title;
public $showTitleOnPage;
public $urlAlias;
public $teaser;
public $templatesSelect;
Expand Down Expand Up @@ -46,6 +47,14 @@ static function getObjectStructure($context = ''): array {
'maxLength' => 100,
'required' => true,
],
//TODO:: Add showTitleOnPage to db table for grapes page and add conditional check on .tpl file
'showTitleOnPage' => [
'property' => 'showTitleOnPage',
'type' => 'checkbox',
'label' => 'Display Title on Page',
'description' => 'Whether or not to display the title on the Grapes Page',
'default' => 1,
],
'urlAlias' => [
'property' => 'urlAlias',
'type' => 'text',
Expand Down
Loading