Skip to content

Commit

Permalink
Merge branch '2.2' into 2
Browse files Browse the repository at this point in the history
# Conflicts:
#	client/dist/js/bundle.js
  • Loading branch information
GuySartorelli committed Jun 20, 2024
2 parents c1ccb58 + e4c39bb commit 5082a78
Show file tree
Hide file tree
Showing 14 changed files with 455 additions and 54 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/add-prs-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Add new PRs to github project

on:
pull_request_target:
types:
- opened
- ready_for_review

permissions: {}

jobs:
addprtoproject:
name: Add PR to GitHub Project
# Only run on the silverstripe account
if: github.repository_owner == 'silverstripe'
runs-on: ubuntu-latest
steps:
- name: Add PR to github project
uses: silverstripe/gha-add-pr-to-project@v1
with:
app_id: ${{ vars.PROJECT_PERMISSIONS_APP_ID }}
private_key: ${{ secrets.PROJECT_PERMISSIONS_APP_PRIVATE_KEY }}
1 change: 1 addition & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@silverstripe/eslint-config/.stylelintrc');
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions client/src/components/HistoryViewer/HistoryViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ class HistoryViewer extends Component {
}

render() {
const { loading, compare, currentVersion } = this.props;
const { loading, compare, currentVersion, recordId } = this.props;

if (!recordId) {
return null;
}

if (loading) {
return <Loading />;
Expand All @@ -391,7 +395,7 @@ HistoryViewer.propTypes = {
limit: PropTypes.number,
ListComponent: PropTypes.elementType.isRequired,
offset: PropTypes.number,
recordId: PropTypes.number.isRequired,
recordId: PropTypes.number,
currentVersion: PropTypes.oneOfType([PropTypes.bool, versionType]),
compare: compareType,
isInGridField: PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/HistoryViewer/HistoryViewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $diff-added-color: #b9f1c8;
color: $white;
padding: .4rem .55rem;

&::before {
&:before {
font-size: 1.4rem;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.history-viewer__compare-notice {
border-top: none;
border-top: 0;
border-radius: 0 0 $border-radius $border-radius;
padding: 0;
position: absolute;
Expand All @@ -17,7 +17,7 @@
border-width: 0 0 0 $border-width;
border-color: lighten($color-notice, 10%);
margin-right: 0;
border-radius: 0 0 $border-radius 0;
border-radius: 0 0 $border-radius;

&:hover {
background-color: lighten($color-notice, 10%);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

.history-viewer__actions-dropdown {
.btn[class*=font-icon-]:before {
.btn[class*="font-icon-"]:before {
margin-right: 0;
}

Expand Down
34 changes: 14 additions & 20 deletions client/src/components/HistoryViewer/HistoryViewerVersionList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
.history-viewer__table {
padding: 0;

&--current {
// In detail views, pulls the content (and content tabs) closer to the selected version table
margin-bottom: calc($panel-padding-y / 2);

.history-viewer__version-link:hover {
cursor: default;
}
}

li {
display: flex;
list-style-type: none;
Expand All @@ -16,7 +25,7 @@
}

.history-viewer__row--comparison-selected:last-child {
border-bottom: none;
border-bottom: 0;
}

.history-viewer__heading,
Expand Down Expand Up @@ -47,14 +56,6 @@
text-decoration: none;
}
}

&__table {
&--current {
.history-viewer__version-link:hover {
cursor: default;
}
}
}
}

// Give all columns equal width to start with, and table padding
Expand Down Expand Up @@ -98,16 +99,9 @@
}
}

// In detail views, pulls the content (and content tabs) closer to the selected version table
.history-viewer__table--current {
margin-bottom: calc($panel-padding-y / 2);
}

.history-viewer {
// Ensure that form field styles don't give extra styles to the pagination controls
&__pagination {
select {
width: auto;
}
// Ensure that form field styles don't give extra styles to the pagination controls
.history-viewer__pagination {
select {
width: auto;
}
}
5 changes: 2 additions & 3 deletions client/src/styles/legacy/_ArchiveAdmin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
margin: (-$panel-padding-y) (-$panel-padding-x) 0;
border-bottom: 1px solid $border-color;
padding: ($panel-padding-y * 2) ($panel-padding-x * 2);

background-color: $white;

// If there is a message, fix spacing
Expand All @@ -15,8 +14,8 @@
margin-top: 0;
}

&::after {
border-bottom: none;
&:after {
border-bottom: 0;
}

.form__field-label {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"test": "jest",
"coverage": "jest --coverage",
"lock": "npm-shrinkwrap --dev",
"lint": "eslint client/src && sass-lint client/src",
"lint": "yarn lint-js && yarn lint-sass",
"lint-js": "eslint client/src",
"lint-js-fix": "eslint client/src --fix",
"lint-sass": "sass-lint client/src"
"lint-sass": "stylelint client/src"
},
"jest": {
"testEnvironment": "jsdom",
Expand All @@ -48,7 +48,7 @@
}
},
"devDependencies": {
"@silverstripe/eslint-config": "^1.1.0",
"@silverstripe/eslint-config": "^1.3.0",
"@silverstripe/webpack-config": "^2.0.0",
"@storybook/addon-actions": "^6.5.13",
"@storybook/addons": "^6.5.13",
Expand Down
16 changes: 8 additions & 8 deletions src/Controllers/HistoryViewerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class HistoryViewerController extends LeftAndMain
private static $required_permission_codes = 'CMS_ACCESS_CMSMain';

private static $allowed_actions = [
self::FORM_NAME_VERSION,
self::FORM_NAME_COMPARE,
HistoryViewerController::FORM_NAME_VERSION,
HistoryViewerController::FORM_NAME_COMPARE,
'schema',
];

Expand All @@ -51,7 +51,7 @@ class HistoryViewerController extends LeftAndMain
*
* @var string[]
*/
protected $formNames = [self::FORM_NAME_VERSION, self::FORM_NAME_COMPARE];
protected $formNames = [HistoryViewerController::FORM_NAME_VERSION, HistoryViewerController::FORM_NAME_COMPARE];

public function getClientConfig()
{
Expand Down Expand Up @@ -93,15 +93,15 @@ protected function generateSchemaForForm($formName, HTTPRequest $request): HTTPR
{
switch ($formName) {
// Get schema for history form
case self::FORM_NAME_VERSION:
case HistoryViewerController::FORM_NAME_VERSION:
$form = $this->getVersionForm([
'RecordClass' => $request->getVar('RecordClass'),
'RecordID' => $request->getVar('RecordID'),
'RecordVersion' => $request->getVar('RecordVersion'),
'RecordDate' => $request->getVar('RecordDate'),
]);
break;
case self::FORM_NAME_COMPARE:
case HistoryViewerController::FORM_NAME_COMPARE:
$form = $this->getCompareForm([
'RecordClass' => $request->getVar('RecordClass'),
'RecordID' => $request->getVar('RecordID'),
Expand Down Expand Up @@ -163,7 +163,7 @@ protected function getVersionFormByDate(array $context)
$effectiveContext = array_merge($context, ['Record' => $record]);

// Ensure the form is scaffolded with archive date enabled.
$form = $this->scaffoldForm(self::FORM_NAME_VERSION, $effectiveContext, [
$form = $this->scaffoldForm(HistoryViewerController::FORM_NAME_VERSION, $effectiveContext, [
$recordClass,
$recordId,
]);
Expand Down Expand Up @@ -191,7 +191,7 @@ protected function getVersionFormByVersion(array $context)

$effectiveContext = array_merge($context, ['Record' => $record]);

return $this->scaffoldForm(self::FORM_NAME_VERSION, $effectiveContext, [
return $this->scaffoldForm(HistoryViewerController::FORM_NAME_VERSION, $effectiveContext, [
$recordClass,
$recordId,
]);
Expand Down Expand Up @@ -251,7 +251,7 @@ public function getCompareForm(array $context)

$effectiveContext = array_merge($context, ['Record' => $recordTo]);

$form = $this->scaffoldForm(self::FORM_NAME_COMPARE, $effectiveContext, [
$form = $this->scaffoldForm(HistoryViewerController::FORM_NAME_COMPARE, $effectiveContext, [
$recordClass,
$recordId,
$recordVersionFrom,
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/DataObjectVersionFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DataObjectVersionFormFactory implements FormFactory
* @var string[]
*/
private static $readonly_types = [
self::TYPE_HISTORY,
DataObjectVersionFormFactory::TYPE_HISTORY,
];

public function getForm(RequestHandler $controller = null, $name = FormFactory::DEFAULT_NAME, $context = [])
Expand Down
Loading

0 comments on commit 5082a78

Please sign in to comment.