diff --git a/app/_config/columns.yml b/app/_config/columns.yml index b4458c5..8970661 100644 --- a/app/_config/columns.yml +++ b/app/_config/columns.yml @@ -4,5 +4,5 @@ Name: 'webapp-columns' Site\Extensions\ElementRows: container_max_width: 1140 - column_class: 'col-block col-md-' + column_class: 'col-block col-md' diff --git a/app/_config/config.yml b/app/_config/config.yml index 58ca3f0..785c22a 100644 --- a/app/_config/config.yml +++ b/app/_config/config.yml @@ -22,3 +22,8 @@ SilverStripe\Admin\LeftAndMain: SilverStripe\Forms\HTMLEditor\TinyMCEConfig: editor_css: - 'app/client/dist/css/app_editor.css' + +# Secure cookies +SilverStripe\Control\Session: + cookie_secure: true + strict_user_agent_check: false diff --git a/app/_config/elements.yml b/app/_config/elements.yml index c9f3166..84031c1 100644 --- a/app/_config/elements.yml +++ b/app/_config/elements.yml @@ -24,8 +24,9 @@ SilverStripe\CMS\Model\SiteTree: - Dynamic\Elements\Blog\Elements\ElementBlogPosts - Dynamic\Elements\Oembed\Elements\ElementOembed - Dynamic\Elements\Elements\ElementTestimonials - - Site\Elements\TeamMembersElement + #- Site\Elements\TeamMembersElement - Site\Elements\SliderElement + - Site\Elements\BlockElement - DNADesign\ElementalVirtual\Model\ElementVirtual DNADesign\ElementalList\Model\ElementList: @@ -39,8 +40,9 @@ DNADesign\ElementalList\Model\ElementList: - Dynamic\Elements\Blog\Elements\ElementBlogPosts - Dynamic\Elements\Oembed\Elements\ElementOembed - Dynamic\Elements\Elements\ElementTestimonials - - Site\Elements\TeamMembersElement + #- Site\Elements\TeamMembersElement - Site\Elements\SliderElement + - Site\Elements\BlockElement styles: whiteframe: 'White Frame' greybg: 'Grey Background' diff --git a/app/_config/extensions.yml b/app/_config/extensions.yml index 85dffc1..3c92b90 100644 --- a/app/_config/extensions.yml +++ b/app/_config/extensions.yml @@ -10,6 +10,7 @@ SilverStripe\Admin\LeftAndMain: SilverStripe\SiteConfig\SiteConfig: extensions: - Site\Extensions\SiteConfigExtension + - Site\Extensions\SocialExtension SilverStripe\CMS\Model\SiteTree: extensions: diff --git a/app/_config/themes.yml b/app/_config/themes.yml index 247fc5c..f57eccc 100644 --- a/app/_config/themes.yml +++ b/app/_config/themes.yml @@ -7,3 +7,7 @@ SilverStripe\View\SSViewer: themes: - '$public' - '$default' + +# 2x container width to automatically resize images for 2K display +Site\Extensions\ElementRows: + container_max_width: 2280 diff --git a/app/client/src/scss/_typography.scss b/app/client/src/scss/_typography.scss index 0f0fd4e..8aa22b9 100644 --- a/app/client/src/scss/_typography.scss +++ b/app/client/src/scss/_typography.scss @@ -1,7 +1,4 @@ -h1, h2, h3, h4, h5, h6, -.h1, .h2, .h3, .h4, .h5, .h6 { - color: $dark; -} +// Add your site-wide, but not content editor typography styling .bg-dark { h1, h2, h3, h4, h5, h6, @@ -15,5 +12,5 @@ h1, h2, h3, h4, h5, h6, .typography { @include clearfix; - @import "./types/editor"; + @import "~ss-bootstrap-ui-webpack-boilerplate/src/scss/types/editor"; } diff --git a/app/client/src/scss/_variables.scss b/app/client/src/scss/_variables.scss index 946308c..48e2387 100644 --- a/app/client/src/scss/_variables.scss +++ b/app/client/src/scss/_variables.scss @@ -14,3 +14,10 @@ $grid-gutter-height: 2rem; @import "~bootstrap/scss/functions"; @import "~bootstrap/scss/variables"; @import "~bootstrap/scss/mixins"; + +// Add your site-wide + content editor typography styling + +h1, h2, h3, h4, h5, h6, +.h1, .h2, .h3, .h4, .h5, .h6 { + color: $dark; +} diff --git a/app/client/src/scss/types/editor.scss b/app/client/src/scss/types/editor.scss index 81e3fc9..34e9794 100644 --- a/app/client/src/scss/types/editor.scss +++ b/app/client/src/scss/types/editor.scss @@ -1,3 +1,5 @@ -@import "../_variables"; - @import "~ss-bootstrap-ui-webpack-boilerplate/src/scss/types/editor"; +@import "../_variables"; +@import "../_typography"; + +// Add content editor (only) typography styling diff --git a/app/src/Elements/BlockElement.php b/app/src/Elements/BlockElement.php new file mode 100644 index 0000000..fd84d84 --- /dev/null +++ b/app/src/Elements/BlockElement.php @@ -0,0 +1,50 @@ + 'Varchar(255)', + ]; + + private static $has_one = [ + 'BlockLink' => Link::class, + ]; + + public function getCMSFields() + { + $fields = parent::getCMSFields(); + + $fields->addFieldsToTab('Root.Main', [ + FontAwesomeField::create('BlockIcon'), + LinkField::create('BlockLinkID', 'Link'), + ]); + + return $fields; + } +} diff --git a/app/src/Extensions/BlogExtension.php b/app/src/Extensions/BlogExtension.php index c2419f7..afae42a 100644 --- a/app/src/Extensions/BlogExtension.php +++ b/app/src/Extensions/BlogExtension.php @@ -13,7 +13,7 @@ class BlogExtension extends DataExtension { $f = $fields->dataFieldByName('ChildPages'); if ($f) { - $f->setConfig(GridFieldConfigBlogPost::create(100)); + $f->setConfig(GridFieldConfigBlogPost::create(75)); } } } diff --git a/app/src/Extensions/ElementContentWidget.php b/app/src/Extensions/ElementContentWidget.php index fece338..4fffc32 100644 --- a/app/src/Extensions/ElementContentWidget.php +++ b/app/src/Extensions/ElementContentWidget.php @@ -8,29 +8,8 @@ namespace Site\Extensions; -use Sheadawson\Linkable\Forms\LinkField; -use Sheadawson\Linkable\Models\Link; -use SilverStripe\FontAwesome\FontAwesomeField; -use SilverStripe\Forms\FieldList; use SilverStripe\ORM\DataExtension; class ElementContentWidget extends DataExtension { - /*private static $db = [ - 'BlockIcon' => 'Varchar(255)', - ]; - - private static $has_one = [ - 'BlockLink' => Link::class, - ]; - - public function updateCMSFields(FieldList $fields) - { - parent::updateCMSFields($fields); - - $fields->addFieldsToTab('Root.Main', [ - FontAwesomeField::create('BlockIcon'), - LinkField::create('BlockLinkID', 'Link'), - ]); - }*/ } diff --git a/app/src/Extensions/ElementImageWidget.php b/app/src/Extensions/ElementImageWidget.php index 102989d..995a50d 100644 --- a/app/src/Extensions/ElementImageWidget.php +++ b/app/src/Extensions/ElementImageWidget.php @@ -82,7 +82,7 @@ class ElementImageWidget extends DataExtension $width = $this->getWidth(); $height = $this->getHeight(); - if (!$width) { + if (!$width || $width === 'auto') { return $height > 0 ? $image->ScaleHeight($height) : $image; diff --git a/app/src/Extensions/ElementRows.php b/app/src/Extensions/ElementRows.php index 3c28249..32eb4a1 100644 --- a/app/src/Extensions/ElementRows.php +++ b/app/src/Extensions/ElementRows.php @@ -18,7 +18,7 @@ use SilverStripe\Forms\FieldList; class ElementRows extends DataExtension { private static $container_max_width = 1140; - private static $column_class = 'col-block col-md-'; + private static $column_class = 'col-block col-md'; private static $container_styles = [ 'container' => 'Fixed container', @@ -27,7 +27,7 @@ class ElementRows extends DataExtension private static $db = [ 'ContainerType' => 'Varchar(254)', - 'Size' => 'Enum("1,2,3,4,5,6,7,8,9,10,11,12","6")', + 'Size' => 'Enum("1,2,3,4,5,6,7,8,9,10,11,12,auto","auto")', ]; public function updateCMSFields(FieldList $fields) @@ -63,23 +63,24 @@ class ElementRows extends DataExtension 'Size', _t( __CLASS__.'.SIZE', - 'Column Size' + 'Column Width (max 12 cols)' ), array_combine( array_values($sizes->enumValues()), [ - '8.3%', - '16.6%', - '25%', - '33%', - '41.6%', - '50%', - '58.3%', - '66.4%', - '74.7%', - '83%', - '91.3%', - '100%', + '8.3% (1 of 12)', + '16.6% (2 of 12)', + '25% (3 of 12)', + '33% (4 of 12)', + '41.6% (5 of 12)', + '50% (6 of 12)', + '58.3% (7 of 12)', + '66.4% (8 of 12)', + '74.7% (9 of 12)', + '83% (10 of 12)', + '91.3% (11 of 12)', + '100% (12 of 12)', + 'auto', ] ) ); @@ -152,7 +153,7 @@ class ElementRows extends DataExtension $object = $object ? $object : $this->owner; if ($object->isColumn() && $object->getField('Size')) { - return (int) $object->getField('Size'); + return $object->getField('Size'); } $parent = $object->Parent()->getOwnerPage(); @@ -172,7 +173,13 @@ class ElementRows extends DataExtension if (!$object->isRoot()) { $size = $object->getField('Size'); - $max = $size ? $max / (self::colsNumber() / $size) : $max; + $cols = self::colsNumber(); + + if ($size === 'auto') { + return $size; + } + + $max = $size ? $max / ($cols / $size) : $max; $parent = $object->Parent()->getOwnerPage(); return $this->getColumnWidthRecursive($parent, $max); @@ -185,9 +192,15 @@ class ElementRows extends DataExtension { $db = Config::inst()->get(self::class, 'db'); $sizes = $db['Size']; - $sizes = preg_replace('!Enum\("([0-9,]+)","([0-9]+)"\)!i', '$1', $sizes); + $sizes = preg_replace('!Enum\("([0-9A-z,]+)","([0-9A-z]+)"\)!i', '$1', $sizes); $sizes = explode(',', $sizes); + // remove auto + $k = array_search('auto', $sizes); + if ($k !== false) { + unset($sizes[$k]); + } + return max($sizes); } @@ -198,10 +211,13 @@ class ElementRows extends DataExtension public function ExtraClass() { - return $this->owner->getField('ExtraClass') + $object = $this->owner; + + return $object->getField('ExtraClass') .( - $this->isColumn() - ? ' '.Config::inst()->get(self::class, 'column_class').$this->owner->getField('Size') + $this->isColumn() + ? ' '.Config::inst()->get(self::class, 'column_class') + .($object->getField('Size') === 'auto' ? '' : '-'.$object->getField('Size')) : '' ); } @@ -221,4 +237,4 @@ class ElementRows extends DataExtension return $type; } -} \ No newline at end of file +} diff --git a/app/src/Extensions/SiteConfigExtension.php b/app/src/Extensions/SiteConfigExtension.php index 23c811e..d4659da 100644 --- a/app/src/Extensions/SiteConfigExtension.php +++ b/app/src/Extensions/SiteConfigExtension.php @@ -7,6 +7,7 @@ use Innoweb\Sitemap\Pages\SitemapPage; use SilverStripe\AssetAdmin\Forms\UploadField; use SilverStripe\Assets\Image; use SilverStripe\Blog\Model\BlogPost; +use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\TextareaField; use SilverStripe\Forms\TextField; use SilverStripe\ORM\DataExtension; @@ -26,6 +27,10 @@ class SiteConfigExtension extends DataExtension 'MapZoom' => 'Int', //'MapAPIKey' => 'Varchar(255)', 'Description' => 'Varchar(255)', + 'Address' => 'Varchar(255)', + 'Suburb' => 'Varchar(255)', + 'State' => 'Varchar(255)', + 'ZipCode' => 'Varchar(6)', ]; private static $has_one = [ @@ -60,11 +65,27 @@ class SiteConfigExtension extends DataExtension ]); $mapTab = $fields->findOrMakeTab('Root.Maps'); + $mapTab->setTitle('Address / Map'); + $fields->addFieldsToTab('Root.Maps', [ - //TextField::create('MapAPIKey'), - TextField::create('MapZoom'), - MapboxField::create('Map', 'Choose a location', 'Latitude', 'Longitude'), + TextField::create('Address'), + TextField::create('Suburb', 'City'), + TextField::create('State'), + TextField::create('ZipCode'), ]); + + if (MapboxField::getAccessToken()) { + $fields->addFieldsToTab('Root.Maps', [ + //TextField::create('MapAPIKey'), + TextField::create('MapZoom'), + MapboxField::create('Map', 'Choose a location', 'Latitude', 'Longitude'), + ]); + } else { + $fields->addFieldsToTab('Root.Maps', [ + LiteralField::create('MapNotice', '

No Map API keys specified.

') + ]); + } + /*GoogleMapField::create( $this->owner, 'Location', diff --git a/app/src/Extensions/SocialExtension.php b/app/src/Extensions/SocialExtension.php index 4d5125c..1dd7672 100644 --- a/app/src/Extensions/SocialExtension.php +++ b/app/src/Extensions/SocialExtension.php @@ -18,7 +18,7 @@ use SilverStripe\Security\Member; class SocialExtension extends DataExtension { private static $db = [ - 'Address' => 'Varchar(255)', + 'PhoneNumber' => 'Varchar(255)', ]; private static $has_one = [ @@ -28,7 +28,7 @@ class SocialExtension extends DataExtension 'Instagram' => Link::class, 'Twitter' => Link::class, 'PublicEmail' => Link::class, - 'PhoneNumber' => Link::class, + //'PhoneNumber' => Link::class, ]; public function updateCMSFields(FieldList $fields) @@ -50,11 +50,11 @@ class SocialExtension extends DataExtension $fields->findOrMakeTab('Root.Social'); $fields->addFieldsToTab('Root.Social', [ + TextField::create('PhoneNumber'), LinkField::create('PublicEmailID', 'Public Email') ->setAllowedTypes(['Email']), - LinkField::create('PhoneNumberID', 'Phone Number') - ->setAllowedTypes(['Phone']), - TextField::create('Address'), + /*LinkField::create('PhoneNumberID', 'Phone Number') + ->setAllowedTypes(['Phone']),*/ ]); $fields->addFieldsToTab('Root.Social', $linkFields); diff --git a/app/src/Pages/PageController.php b/app/src/Pages/PageController.php index 791f1eb..232c743 100644 --- a/app/src/Pages/PageController.php +++ b/app/src/Pages/PageController.php @@ -42,7 +42,7 @@ class PageController extends ContentController public function ElementalArea() { - if($this->CurrentElement()) { + if ($this->CurrentElement() || $this->getAction() !== 'index') { return false; } @@ -53,7 +53,7 @@ class PageController extends ContentController { $contoller_curr = Controller::curr(); - if(is_a($contoller_curr, ElementFormController::class)) { + if (is_a($contoller_curr, ElementFormController::class)) { return $contoller_curr; } @@ -88,7 +88,7 @@ class PageController extends ContentController public function SearchResults() { $term = $this->search_term; - if(!$term) { + if (!$term) { return false; } @@ -110,7 +110,7 @@ class PageController extends ContentController foreach ($elements as $element) { $page = Page::get()->filter('ElementalAreaID', $element->getField('ParentID'))->first(); - if(!$page) { + if (!$page) { continue; } diff --git a/app/src/Tasks/BrokenFilesTask.php b/app/src/Tasks/BrokenFilesTask.php new file mode 100644 index 0000000..c51ed28 --- /dev/null +++ b/app/src/Tasks/BrokenFilesTask.php @@ -0,0 +1,39 @@ +exists()) { + echo 'File name was not found at SS DB: ' + .$file->getField('Name').'
' + .PHP_EOL; + + $i++; + + continue; + } + } + + echo ($i > 0) ? + '

Missing '.$i.' files

' + : '

All files are ok!

'; + + die('Done!'); + } +} diff --git a/app/templates/DNADesign/Elemental/Models/ElementContent.ss b/app/templates/DNADesign/Elemental/Models/ElementContent.ss index 2ecdd9a..b6658f9 100644 --- a/app/templates/DNADesign/Elemental/Models/ElementContent.ss +++ b/app/templates/DNADesign/Elemental/Models/ElementContent.ss @@ -1,4 +1,4 @@ -
+ <% if $BlockLink %> - + $BlockLink.Title <% end_if %> diff --git a/app/templates/Includes/Footer.ss b/app/templates/Includes/Footer.ss index 5306567..43941e8 100644 --- a/app/templates/Includes/Footer.ss +++ b/app/templates/Includes/Footer.ss @@ -1,29 +1,50 @@ <% with $SiteConfig %>
-

Contact Us

-
-
Address:
-
$Address
-
+
+
+ + National Children's Alliance + -
-
Phone:
-
$PhoneNumber
-
+
+
$Title
+
+ $Address
+ $Suburb, $State $ZipCode +
+
-
-
Email:
-
$PublicEmail
-
+
+ T: $PhoneNumber +
- <% include Objects\SocialLinks %> + <% if $PublicEmail %> +
+ E: $PublicEmail +
+ <% end_if %> + + <% include Objects\SocialLinks %> +
+ +
<% end_with %> diff --git a/app/templates/Includes/Header.ss b/app/templates/Includes/Header.ss index 194367b..d2c838d 100644 --- a/app/templates/Includes/Header.ss +++ b/app/templates/Includes/Header.ss @@ -1,26 +1,35 @@ -
-
- -
-
- <% with $SiteConfig %> - <% if $PhoneNumber %> - - $PhoneNumber - +
+
+
+ +
+
+ + <% with $SiteConfig %> + <% if $PhoneNumber %> + + $PhoneNumber + + <% end_if %> + <% if $PublicEmail %> + + <% end_if %> + <% end_with %> + <%-- if $SearchForm %> +
$SearchForm
+ <% end_if --%> + <% if $SiteConfig.Navigation %> + <% include Navigation Navigation=$SiteConfig.Navigation, NavID="Navigation" %> <% end_if %> - <% if $PublicEmail %> - - <% end_if %> - <% end_with %> - <%-- if $SearchForm %> -
$SearchForm
- <% end_if --%> +
- -<% if $SiteConfig.Navigation %> - <% include Navigation Navigation=$SiteConfig.Navigation, NavID="Navigation" %> -<% end_if %> diff --git a/app/templates/Includes/Navigation.ss b/app/templates/Includes/Navigation.ss index 4b329fa..c773f1f 100644 --- a/app/templates/Includes/Navigation.ss +++ b/app/templates/Includes/Navigation.ss @@ -1,4 +1,4 @@ -