diff --git a/.gitignore b/.gitignore
index 15a9e61..7146760 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ _ss_environment.php
.DS_Store
.env
.vagrant
+Vagrantfile
/assets
/silverstripe-cache
/public/resources
diff --git a/Vagrantfile b/Vagrantfile.dist
similarity index 95%
rename from Vagrantfile
rename to Vagrantfile.dist
index d8e33a2..15d3268 100644
--- a/Vagrantfile
+++ b/Vagrantfile.dist
@@ -1,28 +1,28 @@
# Based on defaults for SilverStripe Ltd projects.
# See https://silverstripe.atlassian.net/wiki/spaces/DEV/pages/401506576.
-
+
Vagrant.configure(2) do |config|
# Webroot defaults.
# Don't change this to public/, it will be auto-detected in the box
WEBROOT_HOST = "."
WEBROOT_GUEST = "/var/www/mysite/www"
-
+
# Change this IP to avoid clashes with other running virtual machines
# on your own host machine virtual network
- config.vm.network "private_network", ip: "192.168.33.4"
-
+ config.vm.network "private_network", ip: "192.168.33.3"
+
# Change to a unique host name.
# Sets automatically when using the vagrant-hostsupdater plugin.
# Use a *.vagrant top level domain to get built-in SSL certificates
- config.vm.hostname = "mysite.vagrant"
-
+ config.vm.hostname = "bambusa.vagrant"
+
# Handy for subsites
#config.hostsupdater.aliases = ["mysubsite1.vagrant", "mysubsite2.vagrant"]
-
+
# Choose an SSP or CWP base box
config.vm.box = "silverstripeltd/dev-ssp"
# config.vm.box = "silverstripeltd/dev-cwp"
-
+
# Update memory settings for Virtualbox
# See https://www.vagrantup.com/docs/virtualbox/configuration.html#vboxmanage-customizations
# Needs additional config for other providers, see https://www.vagrantup.com/docs/providers/
@@ -30,7 +30,7 @@ Vagrant.configure(2) do |config|
v.memory = 2048
v.cpus = 2
end
-
+
# Configure webroot and mount options
# See https://github.com/gael-ian/vagrant-bindfs
if Vagrant.has_plugin?("vagrant-bindfs") then
@@ -45,13 +45,13 @@ Vagrant.configure(2) do |config|
# For Windows and Linux
config.vm.synced_folder WEBROOT_HOST, WEBROOT_GUEST
end
-
+
# Reduce disk space by cloning from master VM
# See https://www.vagrantup.com/docs/virtualbox/configuration.html#linked-clones
config.vm.provider 'virtualbox' do |v|
v.linked_clone = true
end
-
+
# Optional apt and composer cache (shared beween boxes)
# See https://github.com/fgrehm/vagrant-cachier
if Vagrant.has_plugin?("vagrant-cachier")
@@ -60,13 +60,13 @@ Vagrant.configure(2) do |config|
config.cache.enable :composer
config.cache.enable :npm
end
-
+
# Prevent "stdin: not a tty" errors
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
-
+
# Forward SSH agent, important for private git checkouts
config.ssh.forward_agent = true
-
+
# Set default directory to webroot
config.vm.provision "shell",
inline: "echo 'cd #{WEBROOT_GUEST}' >> /home/vagrant/.bashrc",
diff --git a/app/_config/decisiontree.yml b/app/_config/decisiontree.yml
new file mode 100644
index 0000000..ee60f22
--- /dev/null
+++ b/app/_config/decisiontree.yml
@@ -0,0 +1,12 @@
+DNADesign\SilverStripeElementalDecisionTree\Model\ElementDecisionTree:
+ extensions:
+ - SilverStripe\Bambusa\Extensions\ElementDecisionTreeExtension
+
+DNADesign\SilverStripeElementalDecisionTree\Model\DecisionTreeStep:
+ extensions:
+ - SilverStripe\Versioned\Versioned
+
+DNADesign\SilverStripeElementalDecisionTree\Model\DecisionTreeAnswer:
+ extensions:
+ - SilverStripe\Versioned\Versioned
+ - SilverStripe\Bambusa\Extensions\DecisionTreeAnswerExtension
diff --git a/app/_config/links.yml b/app/_config/links.yml
new file mode 100644
index 0000000..fd80a16
--- /dev/null
+++ b/app/_config/links.yml
@@ -0,0 +1,4 @@
+gorriecoe\Link\Models\Link:
+ extensions:
+ - SilverStripe\Versioned\Versioned
+ - SilverStripe\Bambusa\Extensions\LinkExtension
diff --git a/app/_config/sitebanner.yml b/app/_config/sitebanner.yml
new file mode 100644
index 0000000..a31947d
--- /dev/null
+++ b/app/_config/sitebanner.yml
@@ -0,0 +1,3 @@
+SilverStripe\SiteConfig\SiteConfig:
+ extensions:
+ - NZTA\SiteBanner\Extensions\SiteConfigExtension
diff --git a/app/_config/socials.yml b/app/_config/socials.yml
new file mode 100644
index 0000000..b0d1e7c
--- /dev/null
+++ b/app/_config/socials.yml
@@ -0,0 +1,3 @@
+SilverStripe\SiteConfig\SiteConfig:
+ extensions:
+ - SilverStripe\Bambusa\Extensions\SocialsSiteConfigExtension
diff --git a/app/_config/taxonomy.yml b/app/_config/taxonomy.yml
new file mode 100644
index 0000000..cfcbaff
--- /dev/null
+++ b/app/_config/taxonomy.yml
@@ -0,0 +1,3 @@
+SilverStripe\Taxonomy\TaxonomyTerm:
+ extensions:
+ - SilverStripe\Bambusa\Extensions\TaxonomyTermExtension
diff --git a/app/src/Blocks/NavigationBannerBlock.php b/app/src/Blocks/NavigationBannerBlock.php
new file mode 100644
index 0000000..bbd511a
--- /dev/null
+++ b/app/src/Blocks/NavigationBannerBlock.php
@@ -0,0 +1,128 @@
+ 'Varchar',
+ 'ForeTitle' => 'HTMLText',
+ 'Subtitle' => 'HTMLText',
+ 'ItemsPerRow' => "Enum('3, 4')",
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $has_one = [
+ 'BackgroundImage' => Image::class,
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $has_many = [
+ 'Items' => Link::class,
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $owns = [
+ 'BackgroundImage',
+ 'Items',
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $cascade_duplicates = [
+ 'BackgroundImage',
+ 'Items',
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $cascade_deletes = [
+ 'BackgroundImage',
+ 'Items',
+ ];
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return _t(__CLASS__ . '.NAVIGATION_BANNER', 'NavigationBanner');
+ }
+
+ /**
+ * @return Validator
+ */
+ public function getCMSValidator()
+ {
+ return RequiredFields::create([
+ 'Title'
+ ]);
+ }
+
+ /**
+ * e.g col-md-4
+ *
+ * @return string
+ */
+ public function getBootstrapItemColumnClassNames()
+ {
+ $classNames = [
+ sprintf('col-lg-%s', 12/$this->ItemsPerRow),
+ ];
+
+ return implode(' ', $classNames);
+ }
+}
diff --git a/app/src/Extensions/DecisionTreeAnswerExtension.php b/app/src/Extensions/DecisionTreeAnswerExtension.php
new file mode 100644
index 0000000..f12af0e
--- /dev/null
+++ b/app/src/Extensions/DecisionTreeAnswerExtension.php
@@ -0,0 +1,19 @@
+ 'Enum("Single, Multiple")',
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $owns = [
+ 'FirstStep',
+ ];
+
+ /**
+ * @param FieldList $fields
+ */
+ public function updateCMSFields(FieldList $fields)
+ {
+ // Layout field
+
+ /** @var DBEnum $layoutDbField */
+ $layoutDbField = $this->getOwner()->dbObject('Layout');
+
+ $layoutField = DropdownField::create('Layout', null, $layoutDbField->enumValues())
+ ->setDescription(
+ 'Choose whether the decision sequence appears in the same view or across multiple views'
+ );
+
+ $fields->addFieldToTab('Root.Main', $layoutField);
+ }
+}
diff --git a/app/src/Extensions/LinkExtension.php b/app/src/Extensions/LinkExtension.php
new file mode 100644
index 0000000..41ca9ae
--- /dev/null
+++ b/app/src/Extensions/LinkExtension.php
@@ -0,0 +1,20 @@
+ NavigationBannerBlock::class,
+ ];
+}
diff --git a/app/src/Extensions/SocialsSiteConfigExtension.php b/app/src/Extensions/SocialsSiteConfigExtension.php
new file mode 100644
index 0000000..ba08e94
--- /dev/null
+++ b/app/src/Extensions/SocialsSiteConfigExtension.php
@@ -0,0 +1,49 @@
+ 'Text',
+ 'TwitterPage' => 'Text',
+ 'InstagramPage' => 'Text',
+ 'LinkedInPage' => 'Text',
+ ];
+
+ /**
+ * @param FieldList $fields
+ */
+ public function updateCMSFields(FieldList $fields)
+ {
+ $fields->addFieldsToTab(
+ 'Root.Socials',
+ [
+ TextField::create('FacebookPage', 'Facebook page')
+ ->setDescription('e.g https://www.facebook.com/{YourPage}'),
+ TextField::create('TwitterPage', 'Twitter page')
+ ->setDescription('e.g https://www.twitter.com/{YourPage}'),
+ TextField::create('InstagramPage', 'Instagram page')
+ ->setDescription('e.g https://www.instagram.com/{YourPage}'),
+ TextField::create('LinkedInPage', 'LinkedIn page')
+ ->setDescription('e.g https://www.linkedin.com/{YourPage}'),
+ ]
+ );
+ }
+}
diff --git a/app/src/Extensions/TaxonomyTermExtension.php b/app/src/Extensions/TaxonomyTermExtension.php
new file mode 100644
index 0000000..bc63b90
--- /dev/null
+++ b/app/src/Extensions/TaxonomyTermExtension.php
@@ -0,0 +1,22 @@
+ Page::class,
+ ];
+
+ public function updateCMSFields(FieldList $fields)
+ {
+ $fields->removeByName([
+ 'Pages',
+ 'Choices',
+ ]);
+ }
+}
diff --git a/app/src/Page.php b/app/src/Page.php
index 2265630..44364b8 100644
--- a/app/src/Page.php
+++ b/app/src/Page.php
@@ -3,17 +3,63 @@
namespace {
use SilverStripe\CMS\Model\SiteTree;
+ use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\ToggleCompositeField;
+ use SilverStripe\Forms\TreeMultiselectField;
+ use SilverStripe\Taxonomy\TaxonomyTerm;
class Page extends SiteTree
{
+ /**
+ * @var string[]
+ */
+ private static $db = [
+ 'ShowPageUtilities' => 'Boolean',
+ 'HidePrintButton' => 'Boolean',
+ ];
+
+ /**
+ * @var string[]
+ */
+ private static $many_many = [
+ 'Terms' => TaxonomyTerm::class,
+ ];
+
public function getCMSFields()
{
$fields = parent::getCMSFields();
- // Not something we want users playing with.
- $fields->removeByName('ExtraMeta');
+ $fields->removeByName([
+ 'Terms',
+ 'ExtraMeta' // Not something we want users playing with
+ ]);
+
+ $fields->addFieldsToTab(
+ 'Root.Utilities',
+ [
+ CheckboxField::create('ShowPageUtilities')
+ ->setDescription('Show page utilities at the bottom of the content'),
+ CheckboxField::create('HidePrintButton')
+ ->setDescription('Hide the print page utility'),
+ ]
+ );
+
+ return $fields;
+ }
+
+ public function getSettingsFields()
+ {
+ $fields = parent::getSettingsFields();
+
+ $fields->addFieldToTab(
+ 'Root.Taxonomy',
+ TreeMultiselectField::create(
+ 'Terms',
+ _t(__CLASS__ . '.Terms', 'Terms'),
+ TaxonomyTerm::class
+ )
+ );
return $fields;
}
diff --git a/app/src/PageController.php b/app/src/PageController.php
index 1202516..4512b74 100644
--- a/app/src/PageController.php
+++ b/app/src/PageController.php
@@ -16,6 +16,7 @@ protected function init()
{
parent::init();
Requirements::block('silverstripe/elemental-bannerblock:client/dist/styles/frontend-default.css');
+ Requirements::javascript('//code.jquery.com/jquery-3.6.0.min.js');
}
/**
diff --git a/app/templates/Security.ss b/app/templates/Security.ss
index 4615aa4..aa1f124 100644
--- a/app/templates/Security.ss
+++ b/app/templates/Security.ss
@@ -14,6 +14,8 @@ Override silverstripe/login-forms default template to add $ModalWindow
<% require css("silverstripe/admin: client/dist/styles/bundle.css") %>
<% require css("silverstripe/login-forms: client/dist/styles/bundle.css") %>
+ <% require css("silverstripe/login-forms: client/dist/styles/darkmode.css") %>
+ <% require javascript("silverstripe/login-forms: client/dist/js/bundle.js") %>