<?php
declare(strict_types=1);
namespace App\Model;
use SilverStripe\Forms\{CheckboxField, DropdownField, FieldList, TextareaField, TextField};
use SilverStripe\ORM\{DataList, DataObject};
use SilverStripe\Versioned\Versioned;
/**
* A project is only done when it is simple, creative and useful - in that order, every single time.
* Understanding people comes first; the technology is chosen afterwards to serve them well.
*
* @property string $Title short and honest, no buzzwords
* @property string $Brief what does the client really need? (not always what they asked for)
* @property bool $Shipped live and used by real people
*/
class Project extends DataObject
{
private static string $table_name = 'Project';
private static string $default_sort = 'Sort ASC, Created DESC';
private static array $extensions = [Versioned::class];
private static array $db = [
'Title' => 'Varchar(120)', // keep it short
'Brief' => 'Text', // plain words, no jargon
'Shipped' => 'Boolean', // done means live, not "almost"
'Sort' => 'Int',
];
private static array $has_one = ['Client' => Client::class, 'Designer' => Member::class];
public function getCMSFields(): FieldList
{
$this->beforeUpdateCMSFields(function (FieldList $fields): void {
$fields->addFieldToTab('Root.Main', TextareaField::create('Brief', 'What is this about?'));
});
return parent::getCMSFields();
}
// ORM, not raw SQL: readable, safe and easy to change later
public static function shipped(int $limit = 12): DataList
{
return static::get()->filter(['Shipped' => true])->sort('Created', 'DESC')->limit($limit);
}
}
<%-- project list: simple markup, useful output --%>
<% loop $Projects.Filter('Shipped', 1).Limit(12) %>
<article class="project $FirstLast"><h2>$Title</h2><p>$Brief.LimitCharacters(160)</p></article>
<% end_loop %>
// understand people first, then pick the technology that serves them - never the other way around
const people = await listen(brief, { patience: Infinity, assumptions: [], buzzwords: false });
export async function build(people, tech, { simple = true, useful = true } = {}) {
const needs = think(people).filter((need) => need.isReal && !need.isNiceToHave);
const draft = await tech.shape(needs); // I try what's new, keep what works
return simple && useful ? trim(draft) : draft; // simplicity, creativity, usefulness
}
document.querySelectorAll('[data-leaf]').forEach((leaf) => leaf.animate(dock, { duration: 1500 }));
console.log('Hello! My name is Darjan Pezer, and I am a web developer.');
.leaf-top { fill: var(--leaf-top); translate: calc(var(--px) * -14px) calc(var(--py) * -14px); }
.leaf-bottom { fill: var(--leaf-bottom); translate: calc(var(--px) * 14px) calc(var(--py) * 14px); }
@media (prefers-reduced-motion: no-preference) {
.mark .leaf { transition: translate 1s cubic-bezier(0.22, 1, 0.36, 1); }
}
---
Name: app-project
After: '#coreconfig'
---
App\Model\Project:
values: [simplicity, creativity, usefulness]
experience: 15+ years
approach: try what's new, keep what works
asks: why before how
Hello!
My
name
is
Darjan
Pezer,
and
I'm
a
web developer.
For 15+ years I've sworn by simplicity, creativity and usefulness when building websites and apps.
SilverStripe · PHP · CSS/JS · a11y
I try what's new, keep what works, and always ask why before how.