Minor improvements

This commit is contained in:
Tony Air 2019-11-08 01:26:33 +07:00
parent 89dd041d34
commit c2409e9da0
30 changed files with 521 additions and 150 deletions

View File

@ -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'

View File

@ -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

View File

@ -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'

View File

@ -10,6 +10,7 @@ SilverStripe\Admin\LeftAndMain:
SilverStripe\SiteConfig\SiteConfig:
extensions:
- Site\Extensions\SiteConfigExtension
- Site\Extensions\SocialExtension
SilverStripe\CMS\Model\SiteTree:
extensions:

View File

@ -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

View File

@ -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";
}

View File

@ -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;
}

View File

@ -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

View File

@ -0,0 +1,50 @@
<?php
/**
* Created by PhpStorm.
* User: tony
* Date: 6/30/18
* Time: 11:54 PM
*/
namespace Site\Elements;
use Sheadawson\Linkable\Forms\LinkField;
use Sheadawson\Linkable\Models\Link;
use SilverStripe\FontAwesome\FontAwesomeField;
use DNADesign\Elemental\Models\ElementContent;
class BlockElement extends ElementContent
{
private static $singular_name = 'Block Element';
private static $plural_name = 'Block Element';
private static $description = 'Displays Block';
private static $table_name = 'BlockElement';
public function getType()
{
return self::$singular_name;
}
private static $db = [
'BlockIcon' => '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;
}
}

View File

@ -13,7 +13,7 @@ class BlogExtension extends DataExtension
{
$f = $fields->dataFieldByName('ChildPages');
if ($f) {
$f->setConfig(GridFieldConfigBlogPost::create(100));
$f->setConfig(GridFieldConfigBlogPost::create(75));
}
}
}

View File

@ -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'),
]);
}*/
}

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -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', '<p class="alert alert-info">No Map API keys specified.</p>')
]);
}
/*GoogleMapField::create(
$this->owner,
'Location',

View File

@ -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);

View File

@ -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;
}

View File

@ -0,0 +1,39 @@
<?php
namespace Site\Tasks;
use SilverStripe\Assets\File;
use SilverStripe\Dev\BuildTask;
class BrokenFilesTask extends BuildTask
{
protected $title = 'Broken Files Task';
protected $description = 'Broken files report';
protected $enabled = true;
public function run($request)
{
$files = File::get();
$i = 0;
foreach ($files as $file) {
if (!$file->exists()) {
echo '<b style="color:red">File name was not found at SS DB: '
.$file->getField('Name').'</b><br/>'
.PHP_EOL;
$i++;
continue;
}
}
echo ($i > 0) ?
'<h2 style="color:red">Missing '.$i.' files</h2>'
: '<h2 style="color:green">All files are ok!</h2>';
die('Done!');
}
}

View File

@ -1,4 +1,4 @@
<div class="content-element__content <% if $Style %>$CssStyle<% end_if %>">
<div class="content-element__content<% if $BlockLink %> has-blockLink<% end_if %><% if $BlockIcon %> has-blockIcon<% end_if %><% if $Style %> $CssStyle<% end_if %>">
<% if $BlockIcon %>
<i class="content-element__icon $BlockIcon"></i>
<% end_if %>
@ -11,7 +11,7 @@
</div>
<% if $BlockLink %>
<a href="$BlockLink.URL" class="btn btn-default">
<a href="$BlockLink.LinkURL" class="btn btn-default stretched-link">
$BlockLink.Title
</a>
<% end_if %>

View File

@ -1,29 +1,50 @@
<% with $SiteConfig %>
<div class="wrapper">
<div class="container">
<h2>Contact Us</h2>
<div class="field row">
<div class="title col-sm-4">Address:</div>
<div class="value col-sm-8">$Address</div>
</div>
<div class="row">
<div class="col-sm-6">
<a href="/" class="logo2">
<img src="$ResourcesURL('logo2.png')" alt="National Children's Alliance" />
</a>
<div class="field row">
<div class="title col-sm-4">Phone:</div>
<div class="value col-sm-8">$PhoneNumber</div>
</div>
<div class="field">
<div class="fn">$Title</div>
<address>
$Address<br/>
$Suburb, $State $ZipCode
</address>
</div>
<div class="field row">
<div class="title col-sm-4">Email:</div>
<div class="value col-sm-8">$PublicEmail</div>
</div>
<div class="field">
T: $PhoneNumber
</div>
<% include Objects\SocialLinks %>
<% if $PublicEmail %>
<div class="field">
E: $PublicEmail
</div>
<% end_if %>
<% include Objects\SocialLinks %>
</div>
<div class="col-sm-6 text-right">
<a href="/" target="_blank" class="external-link">
<img src="$ResourcesURL('logo-alliance.png')" alt="National Children's Alliance" />
</a>
<a href="/" target="_blank" class="external-link">
<img src="$ResourcesURL('logo-regional.png')" alt="National Children's Alliance" />
</a>
</div>
</div>
</div>
</div>
<div class="copyright footer">
<div class="container">
<div class="row">
<div class="text-right hotline">
Child Abuse Hotline <a href="calto:+18003423720" class="tel">1-800-342-3720</a>
</div>
<%-- div class="row">
<div class="col-sm-6">
Copyright &copy; {$Top.CurrentTime.Format("Y")} {$Title} All rights reserved.
</div>
@ -35,7 +56,7 @@
<a href="$Sitemap.Link">$Sitemap.Title</a>
<% end_if %>
</div>
</div>
</div --%>
</div>
</div>
<% end_with %>

View File

@ -1,26 +1,35 @@
<div class="row">
<div class="col-sm-6">
<a id="Logo" href="/"><img src="{$ResourcesURL('logo.png')}" alt="{$SiteConfig.Title}" /></a>
</div>
<div class="col-sm-6 text-right">
<% with $SiteConfig %>
<% if $PhoneNumber %>
<span class="phone-number">
$PhoneNumber
</span>
<div class="element">
<div class="row">
<div class="col-sm-4">
<a id="Logo" href="/"><img src="{$ResourcesURL('logo.png')}" alt="{$SiteConfig.Title}" /></a>
</div>
<div class="col-sm-8 text-right">
<div class="btn-group btn-group-lg" role="group">
<a href="#" class="btn btn-success">Contact</a>
<a href="#" class="btn btn-warning">Donate</a>
<a href="#" class="btn btn-secondary">
<i class="fas fa-search"></i>
<span class="sr-only">Search</span>
</a>
</div>
<% with $SiteConfig %>
<% if $PhoneNumber %>
<span class="phone-number">
$PhoneNumber
</span>
<% end_if %>
<% if $PublicEmail %>
<span class="public-email">
$PublicEmail
</span>
<% end_if %>
<% end_with %>
<%-- if $SearchForm %>
<div id="SearchFormContainer">$SearchForm</div>
<% end_if --%>
<% if $SiteConfig.Navigation %>
<% include Navigation Navigation=$SiteConfig.Navigation, NavID="Navigation" %>
<% end_if %>
<% if $PublicEmail %>
<span class="public-email">
$PublicEmail
</span>
<% end_if %>
<% end_with %>
<%-- if $SearchForm %>
<div id="SearchFormContainer">$SearchForm</div>
<% end_if --%>
</div>
</div>
</div>
<% if $SiteConfig.Navigation %>
<% include Navigation Navigation=$SiteConfig.Navigation, NavID="Navigation" %>
<% end_if %>

View File

@ -1,4 +1,4 @@
<nav id="{$NavID}" class="navbar navbar-expand-lg navbar-light bg-light dropdown-hover">
<nav id="{$NavID}" class="navbar navbar-expand-lg dropdown-hover">
<button
class="navbar-toggler"
type="button"
@ -12,7 +12,7 @@
</button>
<div class="collapse navbar-collapse" id="{$NavID}Content">
<ul class="navbar-nav mr-auto w-100 nav-fill">
<ul class="navbar-nav mr-auto w-100 justify-content-between">
<% loop $Navigation %>
<% include NavItem %>
<% end_loop %>

View File

@ -4,34 +4,42 @@
$Video.EmbedHTML.RAW
</div>
<% else %>
<% if $PageLink %><a href="$PageLink.Link" title="$PageLink.MenuTitle.XML" class="btn-primary"><% end_if %>
<% if $Image %>
<span class="img">
<img class="d-block w-100" src="$Image.Fill(1200,600).URL" alt="<% if $Headline %>$Headline<% end_if %>">
<img class="d-block w-100" src="$Image.Fill(1400,650).URL" alt="<% if $Headline %>$Headline<% end_if %>">
</span>
<% end_if %>
<% if $PageLink %></a><% end_if %>
<% if $SlideLinkID %>
<% with $SlideLink %>
<a href="$LinkURL" title="$Title.XML" class="stretched-link">
<span class="sr-only">$Title</span>
</a>
<% end_with %>
<% end_if %>
<% end_if %>
<% end_if %>
<% if $Content || $Headline || $Description || $PageLinkID %>
<div class="carousel-caption">
<% if $Content || $Headline || $Description || $SlideLinkID %>
<div class="carousel-caption container">
<div class="carousel-caption-container typography col-md-6">
<% if $Headline %><h2 class="carousel-title">$Headline</h2><% end_if %>
<div class="carousel-caption-container">
<% if $Headline %><h2 class="carousel-title">$Headline</h2><% end_if %>
<% if $Content %>
<div class="carousel-content typography">$Content</div>
<% else %>
<% if $Description %><p class="carousel-content">$Description</p><% end_if %>
<% end_if %>
<% if $PageLinkID %>
<p>
<a href="$PageLink.Link" title="$PageLink.MenuTitle.XML" class="btn btn-default btn-lg">
<i class="fas fa-bars"></i>
<%t Dynamic\FlexSlider\ORM\FlexSlider.LEARN_MORE "Learn more" %>
</a>
</p>
<% end_if %>
<% if $Content %>
<div class="carousel-content">$Content</div>
<% else_if $Description %>
<p class="carousel-content">$Description</p>
<% end_if %>
<% if $SlideLinkID %>
<% with $SlideLink %>
<div class="text-right">
<a href="$LinkURL" title="$Title.XML" class="slide-link">
$Title &raquo;
</a>
</div>
<% end_with %>
<% end_if %>
</div>
</div>
<% end_if %>
<% end_if %>

View File

@ -1,9 +1,9 @@
<% with $SearchResults %>
<div id="PageContainer" class="page{$CSSClass} pageSearch action{$Action}">
<div class="page-content">
<h1 class="page-header container no-elements">$Title</h1>
<div class="page-content $Top.DefaultContainer">
<div class="element">
<h1 class="h2 page-header no-elements">$Title</h1>
<div class="page-content">
<% if $Results %>
<div id="SearchAccordion{$ID}">
<% loop $Results %>
@ -36,7 +36,7 @@
<% end_loop %>
</div>
<% else %>
<h2>Nothing was found.</h2>
<h3>Nothing was found.</h3>
<% end_if %>
</div>

View File

@ -9,8 +9,10 @@
<% include First %>
<div class="wrapper">
<header id="Header" class="container">
<% include Header %>
<header id="Header">
<div class="$DefaultContainer">
<% include Header %>
</div>
</header>
<main id="MainContent" data-ajax-region="LayoutAjax">
@ -48,11 +50,12 @@
<%-- Require CSS+JS from /public/resourses/[js,css]/[ClassName].[js,css] --%>
$AutoRequirements($ClassName).RAW
<%-- Mapbox --%>
<%-- Mapbox
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.js"></script>
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.css" rel="stylesheet" />
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.css" rel="stylesheet" />--%>
<%-- place extra requirements after this line --%>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i|Roboto:400,400i,700,700i&display=swap&subset=latin-ext" rel="stylesheet" />
<%-- place extra requirements after this line --%>
<div class="extra-code extra-code-site">
$SiteConfig.ExtraCode
</div>

View File

@ -3,21 +3,27 @@
<div class="page-content">
<div class="element">
<div class="container">
<div class="container blog-post-list">
<% if $ArchiveYear %>
<%t SilverStripe\\Blog\\Model\\Blog.Archive 'Archive' %>:
<span class="action-title"><%t SilverStripe\\Blog\\Model\\Blog.Archive 'Archive' %>:</span>
<% if $ArchiveDay %>
<h2 class="subcategory">$ArchiveDate.Nice</h2>
<h2 class="content-element__title subcategory">$ArchiveDate.Nice</h2>
<% else_if $ArchiveMonth %>
<h2 class="subcategory">$ArchiveDate.format('F, Y')</h2>
<h2 class="content-element__title subcategory">$ArchiveDate.format('F, Y')</h2>
<% else %>
<h2 class="subcategory">$ArchiveDate.format('Y')</h2>
<h2 class="content-element__title subcategory">$ArchiveDate.format('Y')</h2>
<% end_if %>
<% else_if $CurrentTag %>
<h2 class="subcategory"><%t SilverStripe\\Blog\\Model\\Blog.Tag 'Tag' %>: $CurrentTag.Title</h2>
<h2 class="content-element__title subcategory">
<span class="action-title"><%t SilverStripe\\Blog\\Model\\Blog.Tag 'Tag' %>:</span>
$CurrentTag.Title
</h2>
<% else_if $CurrentCategory %>
<h2 class="subcategory"><%t SilverStripe\\Blog\\Model\\Blog.Category 'Category' %>: $CurrentCategory.Title</h2>
<h2 class="content-element__title subcategory">
<span class="action-title"><%t SilverStripe\\Blog\\Model\\Blog.Category 'Category' %>:</span>
$CurrentCategory.Title
</h2>
<% end_if %>
<% if $PaginatedList.Exists %>
@ -29,7 +35,9 @@
<% end_loop %>
</div>
<% else %>
<p><%t SilverStripe\\Blog\\Model\\Blog.NoPosts 'There are no posts' %></p>
<p class="alert alert-info">
<%t SilverStripe\\Blog\\Model\\Blog.NoPosts 'There are no posts' %>
</p>
<% end_if %>
<% with $PaginatedList %>

View File

@ -0,0 +1,18 @@
<div class="content-element__content<% if $BlockLink %> has-blockLink<% end_if %><% if $BlockIcon %> has-blockIcon<% end_if %><% if $Style %> $CssStyle<% end_if %>">
<% if $BlockIcon %>
<i class="content-element__icon $BlockIcon"></i>
<% end_if %>
<% if $ShowTitle %>
<h2 class="content-element__title">$Title</h2>
<% end_if %>
<div class="typography">
$HTML
</div>
<% if $BlockLink %>
<a href="$BlockLink.LinkURL" class="btn btn-default stretched-link">
$BlockLink.Title
</a>
<% end_if %>
</div>

View File

@ -1,9 +1,44 @@
# Redirect to HTTPS
#RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect to WWW
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# SPDY protocol
#Header add Alternate-Protocol "443:npn-spdy/3"
# Secure cookies
#Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
#Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure;SameSite=strict
# Apache < 2.2.4
# Header set Set-Cookie HttpOnly;Secure
# Submit domain to https://hstspreload.org/
#Header add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
# XSS-protection
#Header add X-Frame-Options "SAMEORIGIN"
#Header add X-Content-Type-Options "nosniff"
#Header add X-XSS-Protection "1; mode=block"
#Header add Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' *.oppwa.com *.qit.nu *.pinterest.com *.facebook.net *.facebook.com *.addthisedge.com *.addthis.com *.jotform.com *.jotform.us *.getclicky.com *.placehold.it *.ytimg.com *.googlevideo.com *.youtube.com *.youtu.be *.gstatic.com *.googleapis.com *.google-analytics.com cdnjs.cloudflare.com assets.zendesk.com yastatic.net *.doubleclick.net *.cloudflare.com *.ggpht.com *.google.com *.googleadservices.com *.linkedin.com *.vimeo.com *.aweber.com *.simpli.fi omg.mylocalreviewsite.com *.windguru.cz; child-src 'self' *.oppwa.com *.qit.nu *.pinterest.com *.facebook.net *.facebook.com *.addthisedge.com *.addthis.com *.jotform.com *.jotform.us *.placehold.it *.gstatic.com *.ytimg.com *.googlevideo.com *.youtu.be *.youtube.com assets.zendesk.com tautt.zendesk.com *.doubleclick.net *.cloudflare.com *.ggpht.com *.google.com *.googleadservices.com *.linkedin.com *.vimeo.com *.aweber.com *.simpli.fi omg.mylocalreviewsite.com; object-src 'self' *.oppwa.com *.qit.nu *.pinterest.com *.facebook.net *.facebook.com *.addthisedge.com *.addthis.com *.jotform.com *.jotform.us *.placehold.it *.gstatic.com *.googlevideo.com *.youtube.com *.youtu.be *.cloudflare.com *.ytimg.com *.ggpht.com *.doubleclick.net *.google.com *.googleadservices.com *.linkedin.com *.vimeo.com *.aweber.com"
# Hide software headers
Header unset x-powered-by
ServerSignature Off
#ServerTokens Prod
<IfModule php5_module>
php_flag expose_php Off
</IfModule>
<IfModule lsapi_module>
php_flag expose_php Off
</IfModule>
### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)

95
public/htaccess-dist Normal file
View File

@ -0,0 +1,95 @@
# Redirect to HTTPS
#RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect to WWW
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# SPDY protocol
#Header add Alternate-Protocol "443:npn-spdy/3"
# Secure cookies
#Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
#Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure;SameSite=strict
# Apache < 2.2.4
# Header set Set-Cookie HttpOnly;Secure
# Submit domain to https://hstspreload.org/
#Header add Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
# XSS-protection
#Header add X-Frame-Options "SAMEORIGIN"
#Header add X-Content-Type-Options "nosniff"
#Header add X-XSS-Protection "1; mode=block"
#Header add Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' *.oppwa.com *.qit.nu *.pinterest.com *.facebook.net *.facebook.com *.addthisedge.com *.addthis.com *.jotform.com *.jotform.us *.getclicky.com *.placehold.it *.ytimg.com *.googlevideo.com *.youtube.com *.youtu.be *.gstatic.com *.googleapis.com *.google-analytics.com cdnjs.cloudflare.com assets.zendesk.com yastatic.net *.doubleclick.net *.cloudflare.com *.ggpht.com *.google.com *.googleadservices.com *.linkedin.com *.vimeo.com *.aweber.com *.simpli.fi omg.mylocalreviewsite.com *.windguru.cz; child-src 'self' *.oppwa.com *.qit.nu *.pinterest.com *.facebook.net *.facebook.com *.addthisedge.com *.addthis.com *.jotform.com *.jotform.us *.placehold.it *.gstatic.com *.ytimg.com *.googlevideo.com *.youtu.be *.youtube.com assets.zendesk.com tautt.zendesk.com *.doubleclick.net *.cloudflare.com *.ggpht.com *.google.com *.googleadservices.com *.linkedin.com *.vimeo.com *.aweber.com *.simpli.fi omg.mylocalreviewsite.com; object-src 'self' *.oppwa.com *.qit.nu *.pinterest.com *.facebook.net *.facebook.com *.addthisedge.com *.addthis.com *.jotform.com *.jotform.us *.placehold.it *.gstatic.com *.googlevideo.com *.youtube.com *.youtu.be *.cloudflare.com *.ytimg.com *.ggpht.com *.doubleclick.net *.google.com *.googleadservices.com *.linkedin.com *.vimeo.com *.aweber.com"
# Hide software headers
Header unset x-powered-by
ServerSignature Off
#ServerTokens Prod
<IfModule php5_module>
php_flag expose_php Off
</IfModule>
<IfModule lsapi_module>
php_flag expose_php Off
</IfModule>
### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
# Deny access to IIS configuration
<Files web.config>
Order deny,allow
Deny from all
</Files>
# Deny access to YAML configuration files which might include sensitive information
<Files ~ "\.ya?ml$">
Order allow,deny
Deny from all
</Files>
# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<IfModule mod_rewrite.c>
# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
DirectoryIndex disabled
DirectorySlash On
</IfModule>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
# Enable HTTP Basic authentication workaround for PHP running in CGI mode
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Deny access to potentially sensitive files and folders
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule ^\.env - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
RewriteRule (error|silverstripe|debug)\.log - [F,L,NC]
# Process through SilverStripe if no file with the requested name exists.
# Pass through the original path as a query parameter, and retain the existing parameters.
# Try finding framework in the vendor folder first
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
</IfModule>
### SILVERSTRIPE END ###

View File

@ -1,4 +1,14 @@
; Hide PHP version
expose_php = Off
; Session secure flag
session.cookie_httponly = true
session.cookie_secure = true
session.gc_maxlifetime = 1440
memory_limit = 128M
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
; File uploads
@ -9,5 +19,14 @@ post_max_size = 64M
; Required by Vulcan\Seo extension
allow_url_fopen = On
allow_url_include = Off
asp_tags = Off
enable_dl = On
max_execution_time = 400
max_input_time = 600
max_input_vars = 8000
;zlib.output_compression = Off
; Set development environment certificate pem (cat your-self-signed-crt.key your-self-signed-crt.crt > /etc/ssl/certs/localhost.pem)
; openssl.cafile=/etc/ssl/certs/localhost.pem
; openssl.cafile=/etc/ssl/certs/localhost.pem

32
public/php.ini Normal file
View File

@ -0,0 +1,32 @@
; Hide PHP version
expose_php = Off
; Session secure flag
session.cookie_httponly = true
session.cookie_secure = true
session.gc_maxlifetime = 1440
memory_limit = 128M
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
; File uploads
file_uploads = On
upload_max_filesize = 32M
post_max_size = 64M
; Required by Vulcan\Seo extension
allow_url_fopen = On
allow_url_include = Off
asp_tags = Off
enable_dl = On
max_execution_time = 400
max_input_time = 600
max_input_vars = 8000
;zlib.output_compression = Off
; Set development environment certificate pem (cat your-self-signed-crt.key your-self-signed-crt.crt > /etc/ssl/certs/localhost.pem)
; openssl.cafile=/etc/ssl/certs/localhost.pem