Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recent feature requests from prospective consumers #127

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ _ss_environment.php
.DS_Store
.env
.vagrant
Vagrantfile
/assets
/silverstripe-cache
/public/resources
Expand Down
28 changes: 14 additions & 14 deletions Vagrantfile → Vagrantfile.dist
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# 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/
config.vm.provider "virtualbox" do |v, override|
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
Expand All @@ -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")
Expand All @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions app/_config/decisiontree.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions app/_config/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gorriecoe\Link\Models\Link:
extensions:
- SilverStripe\Versioned\Versioned
- SilverStripe\Bambusa\Extensions\LinkExtension
3 changes: 3 additions & 0 deletions app/_config/sitebanner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SilverStripe\SiteConfig\SiteConfig:
extensions:
- NZTA\SiteBanner\Extensions\SiteConfigExtension
3 changes: 3 additions & 0 deletions app/_config/socials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SilverStripe\SiteConfig\SiteConfig:
extensions:
- SilverStripe\Bambusa\Extensions\SocialsSiteConfigExtension
3 changes: 3 additions & 0 deletions app/_config/taxonomy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SilverStripe\Taxonomy\TaxonomyTerm:
extensions:
- SilverStripe\Bambusa\Extensions\TaxonomyTermExtension
128 changes: 128 additions & 0 deletions app/src/Blocks/NavigationBannerBlock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?php

namespace SilverStripe\Bambusa\Blocks;

use DNADesign\Elemental\Models\BaseElement;
use gorriecoe\Link\Models\Link;
use SilverStripe\Assets\Image;
use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\Validator;
use SilverStripe\ORM\HasManyList;

/**
* A block with a title and a grid of navigation items to help orient users
*
* @property string $Title
* @property string $ForeTitle
* @property string $Subtitle
* @property int $ItemsPerRow
* @method Image BackgroundImage()
* @method HasManyList|Link[] Items()
*/
class NavigationBannerBlock extends BaseElement
{
/**
* @var string
*/
private static $table_name = 'NavigationBannerBlock';

/**
* @var string
*/
private static $icon = 'font-icon-block-layout-5';

/**
* @var bool
*/
private static $inline_editable = false;

/**
* @var string
*/
private static $singular_name = 'Navigation Banner Block';

/**
* @var string
*/
private static $plural_name = 'Navigation Banner Blocks';

/**
* @var string[]
*/
private static $db = [
'Title' => '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);
}
}
19 changes: 19 additions & 0 deletions app/src/Extensions/DecisionTreeAnswerExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace SilverStripe\Bambusa\Extensions;

use DNADesign\SilverStripeElementalDecisionTree\Model\DecisionTreeAnswer;
use SilverStripe\ORM\DataExtension;

/**
* Extends {@see DecisionTreeAnswer}
*/
class DecisionTreeAnswerExtension extends DataExtension
{
/**
* @var string[]
*/
private static $owns = [
'ResultingStep',
];
}
47 changes: 47 additions & 0 deletions app/src/Extensions/ElementDecisionTreeExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace SilverStripe\Bambusa\Extensions;

use DNADesign\SilverStripeElementalDecisionTree\Model\ElementDecisionTree;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\FieldType\DBEnum;

/**
* Extends {@see ElementDecisionTree}
*/
class ElementDecisionTreeExtension extends DataExtension
{
/**
* @var string[]
*/
private static $db = [
'Layout' => '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);
}
}
20 changes: 20 additions & 0 deletions app/src/Extensions/LinkExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace SilverStripe\Bambusa\Extensions;

use gorriecoe\Link\Models\Link;
use SilverStripe\Bambusa\Blocks\NavigationBannerBlock;
use SilverStripe\ORM\DataExtension;

/**
* Extends {@see Link}
*/
class LinkExtension extends DataExtension
{
/**
* @var string[]
*/
private static $has_one = [
'NavigationBannerBlock' => NavigationBannerBlock::class,
];
}
49 changes: 49 additions & 0 deletions app/src/Extensions/SocialsSiteConfigExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace SilverStripe\Bambusa\Extensions;

use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DataExtension;
use SilverStripe\SiteConfig\SiteConfig;

/**
* Extension for {@see SiteConfig}
*
* @property string FacebookPage
* @property string TwitterPage
* @property string InstagramPage
* @property string LinkedInPage
*/
class SocialsSiteConfigExtension extends DataExtension
{
/**
* @var string[]
*/
private static $db = [
'FacebookPage' => '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}'),
]
);
}
}
Loading