Skip to content

Commit

Permalink
Merge branch '4.0' into 4
Browse files Browse the repository at this point in the history
# Conflicts:
#	client/dist/styles/bundle.css
#	package.json
#	yarn.lock
  • Loading branch information
GuySartorelli committed Jun 20, 2024
2 parents 80ef0c3 + 1da5747 commit b7164f2
Show file tree
Hide file tree
Showing 10 changed files with 493 additions and 855 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 }}
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.

2 changes: 1 addition & 1 deletion client/src/components/LinkField/LinkField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
right: 0;

&:focus,
&:not(:disabled):not(.disabled):active {
&:not(:disabled, .disabled):active {
box-shadow: none;
}
}
Expand Down
35 changes: 17 additions & 18 deletions client/src/components/LinkPicker/LinkPicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
height: auto;
width: 100%;
min-height: 54px;
background: white;
background: #fff;
padding: 0;
}

Expand All @@ -19,7 +19,7 @@
margin-bottom: 10px;
}

&.font-icon-link::before {
&.font-icon-link:before {
margin: $spacer-xs;
}
}
Expand All @@ -39,7 +39,7 @@
height: 100%;
text-align: left;

&::before {
&:before {
padding: $spacer-xs;
}
}
Expand All @@ -60,19 +60,16 @@
justify-content: space-between;
position: relative;
border-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-radius: 0;
border-bottom: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;

&:hover, &:focus {
text-decoration: none;
color: inherit;
}

// version-state icon
&::before {
&:before {
top: 29px;
left: 32px;
content: ' ';
Expand All @@ -87,17 +84,17 @@
z-index: 1;
}

&--draft::before {
&--draft:before {
background-color: $state-draft-bg;
}

&--modified::before {
&--modified:before {
background-color: $state-modified-bg;
}

&--unsaved::before,
&--unversioned::before,
&--published::before {
&--unsaved:before,
&--unversioned:before,
&--published:before {
display: none;
}

Expand Down Expand Up @@ -128,10 +125,10 @@
height: 100%;
min-width: 0;
text-align: left;
border: none;
border: 0;
margin-right: 0;

&[class*="font-icon-"]::before {
&[class*="font-icon-"]:before {
position: absolute;
font-size: 1.231rem;
padding: .76925rem;
Expand All @@ -155,17 +152,17 @@
}

.font-icon-drag-handle {
opacity: 0%;
opacity: 0;
}

&:focus .font-icon-drag-handle {
opacity: 100%;
opacity: 1;
}
}

.link-picker__link:hover {
.link-picker__drag-handle .font-icon-drag-handle {
opacity: 100%;
opacity: 1;
}
}

Expand Down Expand Up @@ -210,10 +207,12 @@
.link-picker__title-text {
min-width: 0;
margin-right: 5px;

@extend %cutoff-text;
}

.link-picker__type {
width: 100%;

@extend %cutoff-text;
}
1 change: 0 additions & 1 deletion client/src/styles/bundle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
@import "~bootstrap/scss/mixins";
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";

@import "../components/LinkField/LinkField";
@import "../components/LinkPicker/LinkPicker";
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint": "yarn lint-js && yarn lint-sass",
"lint-js": "eslint client/src",
"lint-js-fix": "eslint client/src --fix",
"lint-sass": "stylelint **/client/src/**/*.scss"
"lint-sass": "stylelint client/src"
},
"jest": {
"testEnvironment": "jsdom",
Expand All @@ -48,7 +48,7 @@
},
"devDependencies": {
"@babel/runtime": "^7.20.0",
"@silverstripe/eslint-config": "^1.2.1",
"@silverstripe/eslint-config": "^1.3.0",
"@silverstripe/webpack-config": "^2.1.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/LinkFieldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getClientConfig(): array
'dataUrl' => $this->Link('data'),
'sortUrl' => $this->Link('sort'),
'saveMethod' => 'post',
'formNameTemplate' => sprintf(self::FORM_NAME_TEMPLATE, '{id}'),
'formNameTemplate' => sprintf(LinkFieldController::FORM_NAME_TEMPLATE, '{id}'),
];
return $clientConfig;
}
Expand Down Expand Up @@ -319,7 +319,7 @@ private function createLinkForm(Link $link, string $operation, bool $excludeLink

// Create the form
$formFactory = Injector::inst()->get(DefaultFormFactory::class);
$name = sprintf(self::FORM_NAME_TEMPLATE, $id);
$name = sprintf(LinkFieldController::FORM_NAME_TEMPLATE, $id);
/** @var Form $form */
$form = $formFactory->getForm($this, $name, ['Record' => $link]);
$owner = $this->getOwnerFromRequest();
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getCMSFields(): FieldList
$linkTextField = $fields->dataFieldByName('LinkText');
$linkTextField->setTitle(_t(__CLASS__ . '.LINK_TEXT_TITLE', 'Link text'));
$linkTextField->setTitleTip(new Tip(_t(
self::class . '.LINK_TEXT_TEXT_DESCRIPTION',
Link::class . '.LINK_TEXT_TEXT_DESCRIPTION',
'If left blank, an appropriate default will be used on the front-end',
)));

Expand Down Expand Up @@ -233,7 +233,7 @@ public function forTemplate()
{
// First look for a subclass of the email template e.g. EmailLink.ss which may be defined
// in a project. Fallback to using the generic Link.ss template which this module provides
return $this->renderWith([static::class, self::class]);
return $this->renderWith([static::class, Link::class]);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions tests/php/Controllers/LinkFieldControllerTest/TestPhoneLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ public function getDescription(): string

public function canView($member = null)
{
return self::$fail !== 'can-view';
return TestPhoneLink::$fail !== 'can-view';
}

public function canCreate($member = null, $context = [])
{
return self::$fail !== 'can-create';
return TestPhoneLink::$fail !== 'can-create';
}

public function canEdit($member = null, $context = [])
{
return self::$fail !== 'can-edit';
return TestPhoneLink::$fail !== 'can-edit';
}

public function canDelete($member = null)
{
return self::$fail !== 'can-delete';
return TestPhoneLink::$fail !== 'can-delete';
}

public function validate(): ValidationResult
{
$validationResult = parent::validate();
if (self::$fail === 'validate') {
if (TestPhoneLink::$fail === 'validate') {
$validationResult->addFieldError('Fail', 'Fail was validate');
}
return $validationResult;
Expand Down
Loading

0 comments on commit b7164f2

Please sign in to comment.