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.10.00 grapes page title control #130

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
2 changes: 2 additions & 0 deletions code/web/release_notes/24.10.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
// james - Nashville

// alexander - PTFS-E
## Web Builder - Grapes JS
- Added the ability to control whether the title given to a grapes page on creation is displayed in the UI when the page is viewed. (*AB*)

// chloe - PTFS-E
## Aspen Usage Data
Expand Down
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
8 changes: 8 additions & 0 deletions code/web/sys/DBMaintenance/version_updates/24.10.00.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ function getUpdates24_10_00(): array {
//kodi - ByWater

//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'
],
],

//chloe - PTFS-Europe

Expand Down
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