Skip to content

Commit

Permalink
Merge branch '2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Jul 27, 2018
2 parents db51106 + 7255b72 commit b3c1ec0
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -2,7 +2,7 @@ language: php

env:
global:
- COMPOSER_ROOT_VERSION=2.1.x-dev
- COMPOSER_ROOT_VERSION=2.2.x-dev

matrix:
include:
Expand All @@ -23,7 +23,7 @@ before_script:

# Install composer dependencies
- composer validate
- composer require --no-update cwp/cwp-recipe-cms:2.1.x-dev cwp/starter-theme:2.x-dev symbiote/silverstripe-advancedworkflow:5.0.x-dev silverstripe/userforms:^5
- composer require --no-update cwp/cwp-recipe-cms:2.2.x-dev cwp/starter-theme:2.x-dev symbiote/silverstripe-advancedworkflow:5.0.x-dev silverstripe/userforms:^5
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile

script:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -11,7 +11,7 @@
"cwp/cwp-core": "^2",
"silverstripe/cms": "^4",
"silverstripe/taxonomy": "^2",
"symbiote/silverstripe-gridfieldextensions": "^3.1"
"symbiote/silverstripe-gridfieldextensions": "^3.2"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
Expand Down
13 changes: 9 additions & 4 deletions docs/en/05_Releases_and_changelogs/cwp_recipe_basic_2.1.0.md
Expand Up @@ -35,6 +35,14 @@ The Installed Modules report can be added to your site through the combination o

Information on accessing the report is covered in this [user guide](https://github.com/bringyourownideas/silverstripe-maintenance/blob/1/docs/en/userguide/index.md).

### Page History Viewer

The CWP 2.0 release [introduced content blocks](https://www.cwp.govt.nz/updates/news/cwp-2-0-release/) through the silverstripe-elemental module. This release builds on that functionality by introducing a feature developed as a co-fund submission that focuses on improving the page history viewer.

With a need for CMS users to confidently and accurately understand what has changed on a page that utilises content blocks, improvements have been made to allow users to review the edit history of both the content blocks as individual components as well as a group of content blocks sitting on a particular page.

This improvement allows content blocks to be auditable and supports compliance with Official Information Act requests and Information and Records Management standards.

### Caching Improvements

HTTP caching is an important part of making websites fast and reliable. This CWP release aims to avoid mistakes in the process by providing more high level [HTTP Caching APIs](https://docs.silverstripe.org/en/4/changelogs/4.2.0/#http-cache-header-changes). The default system behaviour will also pick up more situations where caching needs to be disabled automatically, for example when previewing draft content. CWP projects can choose to make this behaviour more secure by opting out of [session-based draft stages](https://docs.silverstripe.org/en/4/changelogs/4.2.0/#disable-session-based-stage-setting) and solely relying on the `?stage=Stage` parameter.
Expand Down Expand Up @@ -76,14 +84,11 @@ Inclusion of the new Installed Module Report, mentioned above, requires both the

A stable version of `silverstripe/textextraction` (3.0.0) is now available for use in CWP 2.1.

## Notable changes
## Other Notable changes

* The default project name has been changed from `mysite` to `app`
* Disable session-based stage setting in `Versioned`
* Versioned cache segmentation by stage
* Improvements to HTTP caching APIs
* New "installed modules" report in the CMS
* History Viewer added for content blocks and pages using content blocks

## Accepted Failing Tests

Expand Down
38 changes: 38 additions & 0 deletions src/Model/RelatedPageLink.php
@@ -0,0 +1,38 @@
<?php

namespace CWP\CWP\Model;

use CWP\CWP\PageTypes\BasePage;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBInt;
use SilverStripe\Versioned\Versioned;

class RelatedPageLink extends DataObject
{
private static $table_name = 'BasePage_RelatedPages';

private static $extensions = [
Versioned::class
];

private static $db = [
'SortOrder' => DBInt::class
];

/**
* For backwards compatibility these must match a traditional 'many_many' definition.
* This was BasePage.RelatedPages => BasePage
* ManyMany relations are normally joined by ${DefiningClass}ID && ${RelatedClass}ID
* excepting in the case where ${DefiningClass} === ${RelatedClass}
* Then the 'related class' column changes from ${RelatedClass}ID to "ChildID".
*
* {@see SilverStripe\ORM\DataObjectSchema->parseManyManyComponent()}
*
* @var array
* @config
*/
private static $has_one = [
'BasePage' => BasePage::class,
'Child' => BasePage::class,
];
}
12 changes: 11 additions & 1 deletion src/PageTypes/BasePage.php
Expand Up @@ -18,6 +18,7 @@
use TractorCow\Fluent\State\FluentState;
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;
use SilverStripe\ORM\FieldType\DBInt;
use CWP\CWP\Model\RelatedPageLink;

/**
* `BasePage` is a foundation page class which can be used for constructing your own page types. By default it is
Expand Down Expand Up @@ -62,6 +63,15 @@ class BasePage extends SiteTree
private static $many_many = [
'Terms' => TaxonomyTerm::class,
'RelatedPages' => BasePage::class,
'RelatedPagesThrough' => [
'through' => RelatedPageLink::class,
'from' => 'BasePage',
'to' => 'Child',
]
];

private static $belongs_many_many = [
'SimilarPages' => BasePage::class
];

/**
Expand Down Expand Up @@ -120,7 +130,7 @@ public function getCMSFields()
GridField::create(
'RelatedPages',
_t(__CLASS__ . '.RelatedPages', 'Related pages'),
$this->RelatedPages(),
$this->RelatedPagesThrough(),
$components
)
);
Expand Down

0 comments on commit b3c1ec0

Please sign in to comment.