Skip to content

Commit

Permalink
v5.1.1 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Mar 21, 2022
2 parents f037ef8 + f32865e commit 453c42a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 74 deletions.
2 changes: 1 addition & 1 deletion box.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"ContentBox Tester Site",
"version":"5.1.0",
"version":"5.1.1",
"author":"Ortus Solutions <[email protected]>",
"shortDescription":"A tester site for developing the ContentBox Modular CMS",
"type":"cms",
Expand Down
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

----

## [5.1.1] => 2022-MAR-17

### Fixed

- Master artifact was stuck at `-snapshot` fix with master artifact

### Improvements

- [CONTENTBOX-1412](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1412) VerifyPageLayout\(\) on the page rendering touches the filesystem on each request, removing this as it is not needed
- [CONTENTBOX-1368](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1368) rc.pageUri is only the first segment of the actual slug, now it contains the full hierarchical slug


----

## [5.1.0] => 2022-MAR-17
Expand Down
2 changes: 1 addition & 1 deletion modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ component {
},
// Catch All Page Routing
{
pattern : "/:pageSlug",
pattern : "/:pageUri",
handler : "page",
action : "index"
},
Expand Down
111 changes: 39 additions & 72 deletions modules/contentbox/modules/contentbox-ui/handlers/page.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -114,33 +114,21 @@ component extends="content" {
* @prc
*/
function index( event, rc, prc ){
// incoming params
event.paramValue( "pageSlug", "" );
var incomingURL = "";
// Routing placeholder
event.paramValue( "pageUri", "" );

// Do we have an override page setup by the settings?
if ( !structKeyExists( prc, "pageOverride" ) ) {
// Try slug parsing for hiearchical URLs
incomingURL = reReplaceNoCase( event.getCurrentRoutedURL(), "\/$", "" );
} else {
incomingURL = prc.pageOverride;
}
// Detect full page uri or override it via a prehandler check
rc.pageUri = isNull( prc.pageOverride ) ? reReplaceNoCase( event.getCurrentRoutedURL(), "\/$", "" ) : prc.pageOverride;

// Entry point cleanup
// Cleanup the module entry point if any
if ( len( prc.cbEntryPoint ) ) {
incomingURL = replaceNoCase( incomingURL, prc.cbEntryPoint & "/", "" );
}

// get the author and do publish unpublished tests
var showUnpublished = false;
if ( prc.oCurrentAuthor.isLoaded() AND prc.oCurrentAuthor.isLoggedIn() ) {
var showUnpublished = true;
rc.pageUri = replaceNoCase( rc.pageUri, prc.cbEntryPoint & "/", "" );
}

// Try to get the page using the incoming URI
prc.page = variables.pageService.findBySlug(
slug : incomingURL,
showUnpublished: showUnpublished,
slug : rc.pageUri,
showUnpublished: ( prc.oCurrentAuthor.isLoaded() AND prc.oCurrentAuthor.isLoggedIn() ) ? true : false,
siteID : prc.oCurrentSite.getsiteID()
);

Expand All @@ -151,7 +139,7 @@ component extends="content" {
// Retrieve Comments
// TODO: paging
if ( prc.page.getAllowComments() ) {
var commentResults = commentService.findAllApproved(
var commentResults = variables.commentService.findAllApproved(
contentID = prc.page.getContentID(),
sortOrder = "asc"
);
Expand All @@ -162,43 +150,44 @@ component extends="content" {
prc.commentsCount = 0;
}
// Detect Mobile Device
var isMobileDevice = mobileDetector.isMobile();
prc.isMobileDevice = variables.mobileDetector.isMobile();
// announce event
announce( "cbui_onPage", { page : prc.page, isMobile : isMobileDevice } );
announce( "cbui_onPage", { page : prc.page, isMobile : prc.isMobileDevice } );
// Use the mobile or standard layout
var thisLayout = (
isMobileDevice ? prc.page.getMobileLayoutWithInheritance() : prc.page.getLayoutWithInheritance()
prc.isMobileDevice ? prc.page.getMobileLayoutWithInheritance() : prc.page.getLayoutWithInheritance()
);
// Verify chosen page layout exists in theme, just in case they moved theme so we can produce a good error message
verifyPageLayout( thisLayout );
// Verify No Layout
// No layout, just render it out
if ( thisLayout eq "-no-layout-" ) {
return prc.page.renderContent();
} else {
// set skin view
event
.setLayout( name = "#prc.cbTheme#/layouts/#thisLayout#", module = prc.cbThemeRecord.module )
.setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module );
}
} else {
// missing page
prc.missingPage = incomingURL;
prc.missingRoutedURL = event.getCurrentRoutedURL();
// announce event
announce(
"cbui_onPageNotFound",
{
page : prc.page,
missingPage : prc.missingPage,
routedURL : prc.missingRoutedURL
}
);
// set skin not found
// set layout + view combo
event
.setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module )
.setView( view = "#prc.cbTheme#/views/notfound", module = prc.cbThemeRecord.module )
.setHTTPHeader( "404", "Page not found" );
.setLayout( name = "#prc.cbTheme#/layouts/#thisLayout#", module = prc.cbThemeRecord.module )
.setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module );
return;
}
// end if page was loaded

// missing page
prc.missingPage = rc.pageUri;
prc.missingRoutedURL = event.getCurrentRoutedURL();

// announce event
announce(
"cbui_onPageNotFound",
{
page : prc.page,
missingPage : prc.missingPage,
routedURL : prc.missingRoutedURL
}
);

// Not Found layout + view
event
.setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module )
.setView( view = "#prc.cbTheme#/views/notfound", module = prc.cbThemeRecord.module )
.setHTTPHeader( "404", "Page not found" );
}

/**
Expand Down Expand Up @@ -234,8 +223,7 @@ component extends="content" {
prc.searchResultsContent = searchAdapter.renderSearchWithResults( prc.searchResults );
} else {
prc.searchResults = getInstance( "SearchResults@contentbox" );
prc.searchResultsContent = "<div class='alert alert-info'>Please enter a search term to search on.</div>
";
prc.searchResultsContent = "<div class='alert alert-info'>Please enter a search term to search on.</div>";
}

// set skin search
Expand Down Expand Up @@ -322,25 +310,4 @@ component extends="content" {
return ( arguments.contentType == "page" ? variables.pageService : variables.contentService );
}

/**
* Verify if a chosen page layout exists or not.
*
* @layout The layout to verify
*/
private function verifyPageLayout( required layout ){
var excluded = "-no-layout-";
// Verify exclusions
if ( listFindNoCase( excluded, arguments.layout ) ) {
return;
}
// Verify layout
if ( !fileExists( expandPath( CBHelper.themeRoot() & "/layouts/#arguments.layout#.cfm" ) ) ) {
throw(
message = "The layout of the page: '#arguments.layout#' does not exist in the current theme.",
detail = "Please verify your page layout settings",
type = "ContentBox.InvalidPageLayout"
);
}
}

}

0 comments on commit 453c42a

Please sign in to comment.