Skip to content

Instantly share code, notes, and snippets.

View benald's full-sized avatar

Benald benald

  • Perth, Australia
View GitHub Profile
@benald
benald / Article.php
Created December 1, 2017 04:37
SilverStripe 3.5 Article.php DataObject, for use with ArticlePages.php, FiltersPage.php
<?php
class Article extends DataObject {
private static $db = array (
'Title' => 'Varchar',
'HideTitle' => 'Boolean',
'Date' => 'Date',
'Teaser' => 'Text',
@benald
benald / ArticlesPage.php
Created December 1, 2017 04:38
SilverStripe ArticlesPage.php for use with Article.php
<?php
class ArticlesPage extends Page {
private static $has_many = array (
'Articles' => 'Article'
);
@benald
benald / FiltersPage.php
Created December 1, 2017 04:40
SIlverstripe 3.5 filters page
<?php
class FiltersPage extends Page {
private static $has_many = array (
'Types' => 'Type',
'Services' => 'Service',
'Industries' => 'Industry',
'Approaches' => 'Approach',
<#assign imageManagerService = serviceLocator.findService('IMAGE_MANAGER','helper') />
<div class="eds-c-panel">
<div class="inner-wrapper eds-c-content-view">
<#if Article.getSiblings()?has_content>
<#list Article.openingGroupSection.getSiblings() as cur_openingGroupSection>
<div class="row">
<div class="col-md-10 col-md-offset-1 eds-u-flush">
<#if cur_openingGroupSection.openingSectionLead.getData()?has_content && cur_openingGroupSection.openingSectionLead.getData() != '<p>&nbsp;</p>'>
<p class="eds-c-feature-paragraph">${cur_openingGroupSection.openingSectionLead.getData()}</p>
</#if>
<root available-locales="en_AU" default-locale="en_AU">
<dynamic-element fieldNamespace="ddm" indexType="keyword" localizable="true" name="Article" readOnly="false" repeatable="false" required="false" showLabel="true" type="ddm-separator" width="">
<dynamic-element fieldNamespace="ddm" indexType="keyword" localizable="true" name="openingGroupSection" readOnly="false" repeatable="false" required="false" showLabel="true" type="ddm-separator" width="">
<dynamic-element dataType="string" indexType="keyword" localizable="true" name="openingSectionLead" readOnly="false" repeatable="false" required="false" showLabel="true" type="textarea" width="small">
<meta-data locale="en_AU">
<entry name="label">
<![CDATA[openingSectionLead]]>
</entry>
<entry name="predefinedValue">
<![CDATA[]]>
TS:
// OnInit
ngOnInit() {
this.addBodyClass();
}
// Function: Add class to body
addBodyClass() {
const bodyTag = document.body;
// Viewport detection
//
//
//
define([
"jquery"
],
function ($) {
var module = {
HTML:
<button type="button" class="uk-button" (click)="toggleControls()" [class.active]="show">toggle Controls</button>
TS:
// Define property in Component Class
public show = false;
// Define Toggle Function
toggleControls() {
this.show = !this.show;
@benald
benald / gulpfile.js
Last active September 20, 2019 01:46
/*
SET UP:
Open Terminal / CMD, run the following
1. npm i -g gulp (install GULP globally!)
2. install the gulp dependancies:
a. NPM: npm install --save-dev gulp gulp-concat gulp-uglify gulp-autoprefixer gulp-rename gulp-minify-css gulp-cssnano gulp-sass gulp-sourcemaps del gulp-imagemin gulp-plumber gulp-cache gulp-bootlint gulp-notify browser-sync
a. YARN: yarn add gulp gulp-concat gulp-uglify gulp-autoprefixer gulp-rename gulp-minify-css gulp-cssnano gulp-sass gulp-sourcemaps del gulp-imagemin gulp-plumber gulp-cache gulp-bootlint gulp-notify browser-sync --dev
3. Configure the location variables in the gulpfile.js to point to your CSS/SCSS/SASS directories that you are using.
4. run gulp to start
*/