Skip to content

Commit

Permalink
Merge branch '5' into 6
Browse files Browse the repository at this point in the history
# Conflicts:
#	code/SiteConfig.php
  • Loading branch information
GuySartorelli committed Jun 20, 2024
2 parents e668e11 + 3f9ac2b commit 870c874
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 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 }}
38 changes: 19 additions & 19 deletions code/SiteConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class SiteConfig extends DataObject implements PermissionProvider, TemplateGloba

public function populateDefaults()
{
$this->Title = _t(self::class . '.SITENAMEDEFAULT', "Your Site Name");
$this->Tagline = _t(self::class . '.TAGLINEDEFAULT', "your tagline here");
$this->Title = _t(SiteConfig::class . '.SITENAMEDEFAULT', "Your Site Name");
$this->Tagline = _t(SiteConfig::class . '.TAGLINEDEFAULT', "your tagline here");

// Allow these defaults to be overridden
parent::populateDefaults();
Expand Down Expand Up @@ -114,17 +114,17 @@ public function getCMSFields()
"Root",
$tabMain = Tab::create(
'Main',
$titleField = TextField::create("Title", _t(self::class . '.SITETITLE', "Site title")),
$titleField = TextField::create("Title", _t(SiteConfig::class . '.SITETITLE', "Site title")),
$taglineField = TextField::create(
"Tagline",
_t(self::class . '.SITETAGLINE', "Site Tagline/Slogan")
_t(SiteConfig::class . '.SITETAGLINE', "Site Tagline/Slogan")
)
),
$tabAccess = Tab::create(
'Access',
$viewersOptionsField = OptionsetField::create(
"CanViewType",
_t(self::class . '.VIEWHEADER', "Who can view pages on this site?")
_t(SiteConfig::class . '.VIEWHEADER', "Who can view pages on this site?")
),
$viewerGroupsField = ListboxField::create(
"ViewerGroups",
Expand All @@ -137,14 +137,14 @@ public function getCMSFields()
),
$viewerMembersField = SearchableMultiDropdownField::create(
"ViewerMembers",
_t(self::class . '.VIEWERMEMBERS', "Viewer Users"),
_t(SiteConfig::class . '.VIEWERMEMBERS', "Viewer Users"),
Member::get()
)
->setIsLazyLoaded(true)
->setUseSearchContext(true),
$editorsOptionsField = OptionsetField::create(
"CanEditType",
_t(self::class . '.EDITHEADER', "Who can edit pages on this site?")
_t(SiteConfig::class . '.EDITHEADER', "Who can edit pages on this site?")
),
$editorGroupsField = ListboxField::create(
"EditorGroups",
Expand All @@ -157,18 +157,18 @@ public function getCMSFields()
),
$editorMembersField = SearchableMultiDropdownField::create(
"EditorMembers",
_t(self::class . '.EDITORMEMBERS', "Editor Users"),
_t(SiteConfig::class . '.EDITORMEMBERS', "Editor Users"),
Member::get(),
)
->setIsLazyLoaded(true)
->setUseSearchContext(true),
$topLevelCreatorsOptionsField = OptionsetField::create(
"CanCreateTopLevelType",
_t(self::class . '.TOPLEVELCREATE', "Who can create pages in the root of the site?")
_t(SiteConfig::class . '.TOPLEVELCREATE', "Who can create pages in the root of the site?")
),
$topLevelCreatorsGroupsField = ListboxField::create(
"CreateTopLevelGroups",
_t(self::class . '.TOPLEVELCREATORGROUPS2', "Top level creator groups")
_t(SiteConfig::class . '.TOPLEVELCREATORGROUPS2', "Top level creator groups")
)
->setSource($groupsMap)
->setAttribute(
Expand All @@ -177,7 +177,7 @@ public function getCMSFields()
),
$topLevelCreatorsMembersField = SearchableMultiDropdownField::create(
"CreateTopLevelMembers",
_t(self::class . '.TOPLEVELCREATORUSERS', "Top level creator users"),
_t(SiteConfig::class . '.TOPLEVELCREATORUSERS', "Top level creator users"),
Member::get()
)
->setIsLazyLoaded(true)
Expand All @@ -198,7 +198,7 @@ public function getCMSFields()
"Only these groups (choose from list)"
);
$viewersOptionsSource[InheritedPermissions::ONLY_THESE_MEMBERS] = _t(
self::class . '.ACCESSONLYTHESEMEMBERS',
SiteConfig::class . '.ACCESSONLYTHESEMEMBERS',
"Only these users (choose from list)"
);
$viewersOptionsField->setSource($viewersOptionsSource);
Expand Down Expand Up @@ -229,7 +229,7 @@ public function getCMSFields()
"Only these groups (choose from list)"
);
$editorsOptionsSource[InheritedPermissions::ONLY_THESE_MEMBERS] = _t(
self::class . '.EDITONLYTHESEMEMBERS',
SiteConfig::class . '.EDITONLYTHESEMEMBERS',
"Only these users (choose from list)"
);
$editorsOptionsField->setSource($editorsOptionsSource);
Expand Down Expand Up @@ -277,8 +277,8 @@ public function getCMSFields()
}
}

$tabMain->setTitle(_t(self::class . '.TABMAIN', "Main"));
$tabAccess->setTitle(_t(self::class . '.TABACCESS', "Access"));
$tabMain->setTitle(_t(SiteConfig::class . '.TABMAIN', "Main"));
$tabAccess->setTitle(_t(SiteConfig::class . '.TABACCESS', "Access"));
$this->extend('updateCMSFields', $fields);

return $fields;
Expand Down Expand Up @@ -327,7 +327,7 @@ public static function current_site_config()
{
$siteConfig = DataObject::get_one(SiteConfig::class);
if (!$siteConfig) {
$siteConfig = self::make_site_config();
$siteConfig = SiteConfig::make_site_config();
}

static::singleton()->extend('updateCurrentSiteConfig', $siteConfig);
Expand All @@ -345,7 +345,7 @@ public function requireDefaultRecords()
$config = DataObject::get_one(SiteConfig::class);

if (!$config) {
self::make_site_config();
SiteConfig::make_site_config();

DB::alteration_message("Added default site config", "created");
}
Expand Down Expand Up @@ -500,13 +500,13 @@ public function providePermissions()
{
return [
'EDIT_SITECONFIG' => [
'name' => _t(self::class . '.EDIT_PERMISSION', 'Manage site configuration'),
'name' => _t(SiteConfig::class . '.EDIT_PERMISSION', 'Manage site configuration'),
'category' => _t(
'SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY',
'Roles and access permissions'
),
'help' => _t(
self::class . '.EDIT_PERMISSION_HELP',
SiteConfig::class . '.EDIT_PERMISSION_HELP',
'Ability to edit global access settings/top-level page permissions.'
),
'sort' => 400
Expand Down

0 comments on commit 870c874

Please sign in to comment.