Initial public commit

This commit is contained in:
2016-08-15 18:47:13 +02:00
commit bbc99c6967
67 changed files with 1517 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+11
View File
@@ -0,0 +1,11 @@
title: Contact
pages: false
files: false
fields:
title:
label: Title
type: text
description:
label: Desciption
type: text
icon: file-text
+14
View File
@@ -0,0 +1,14 @@
title: Page
pages: true
files: true
fields:
title:
label: Title
type: text
description:
label: Desciption
type: text
icon: file-text
text:
label: Text
type: textarea
+14
View File
@@ -0,0 +1,14 @@
title: Homepage
pages: false
files: true
fields:
title:
label: Title
type: text
description:
label: Desciption
type: text
icon: file-text
text:
label: Text
type: textarea
+30
View File
@@ -0,0 +1,30 @@
title: Services
pages: false
files: true
fields:
title:
label: Title
type: text
description:
label: Desciption
type: text
icon: file-text
services:
label: Services
type: structure
entry: >
<strong>{{title}}</strong><br>
{{text}}
fields:
title:
label: Title
type: text
illustration:
label: Illustration
type: image
text:
label: Text
type: textarea
cta:
label: Call to action
type: textarea
+15
View File
@@ -0,0 +1,15 @@
title: Site
pages: true
files: false
fields:
title:
label: Title
type: text
description:
label: Desciption
type: text
icon: file-text
copyright:
label: Copyright
type: text
icon: copyright
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+25
View File
@@ -0,0 +1,25 @@
<?php
// Enable debugging on the dev host but disable caching
c::set('debug', true);
c::set('cache', false);
// Disable assets suffix on the dev host
c::set('assets.suffix', '');
// Language setup with dev domains
c::set('languages', [
[
'code' => 'en',
'name' => 'English',
'default' => true,
'locale' => 'en_US',
'url' => 'http://codesignd.dev',
],
[
'code' => 'de',
'name' => 'Deutsch',
'locale' => 'de_DE',
'url' => 'http://de.codesignd.dev',
]
]);
+3
View File
@@ -0,0 +1,3 @@
<?php
require_once(__DIR__ . DS . 'config.codesignd.dev.php');
+80
View File
@@ -0,0 +1,80 @@
<?php
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
// The license was removed for the public repository
c::set('license', '*snip*');
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
// Use production assets by default
c::set('assets.suffix', '.min');
// Cache setup
c::set('cache', true);
c::set('cache.ignore', ['contact', 'legal']);
// Representations
c::set('representations.accept', true);
// Language setup
c::set('languages', [
[
'code' => 'en',
'name' => 'English',
'default' => true,
'locale' => 'en_US',
'url' => 'https://codesignd.com'
],
[
'code' => 'de',
'name' => 'Deutsch',
'locale' => 'de_DE',
'url' => 'https://codesignd.de'
]
]);
// Bar-o-mator plugin
c::set('baromator.routes', true);
c::set('baromator.basecolor', '#ED8F1B');
// Cachebuster plugin
c::set('cachebuster', true);
// Patterns plugin
c::set('patterns.title', 'codesignd Patterns');
c::set('patterns.preview.css', ['assets/css/index.css', 'site/patterns/theme.css']);
c::set('patterns.preview.js', 'assets/js/index.js');
// Serve the pattern library theme file
c::set('routes', [
[
'pattern' => 'site/patterns/theme\.(:num)\.css',
'action' => function() {
return new Response(f::read(kirby()->roots()->site() . DS . 'patterns' . DS . 'theme.css'), 'css');
}
]
]);
+21
View File
@@ -0,0 +1,21 @@
<?php
return function($site, $pages, $page) {
$form = uniform('contact', [
'required' => [
'name' => '',
'_from' => 'email'
],
'actions' => [
[
'_action' => 'email',
'to' => qdated(),
'sender' => 'codesignd form <no-reply@codesignd.de>',
'subject' => 'Message from the contact form (' . $site->title() . ')',
'snippet' => 'email-templates/contact'
]
]
]);
return compact('form');
};
+23
View File
@@ -0,0 +1,23 @@
<?php
l::set('nav.main.label', 'Primär');
l::set('nav.lang.label', 'Sprachauswahl');
l::set('footer.top', 'Nach oben');
l::set('footer.madewith', 'Erstellt mit');
l::set('footer.source', 'Quellcode');
l::set('go.contact', '➪ Kontakt');
l::set('home-banner.learnmore', 'Mehr erfahren');
l::set('home-banner.learnmore.label', 'Mehr über meine Leistungen erfahren');
l::set('home-banner.contact', 'Kontakt');
l::set('contact.name', 'Name');
l::set('contact.email', 'E-Mail-Adresse');
l::set('contact.message', 'Nachricht');
l::set('contact.potty', 'Bitte lasse dieses Feld leer');
l::set('contact.submit', 'Absenden');
l::set('contact.heading.email', 'E-Mail');
l::set('qdated.error', 'Bei der Anzeige der E-Mail-Adresse ist ein Fehler aufgetreten. Bitte kontaktiere mich über <a href="https://twitter.com/lukasbestle">Twitter</a> und mache mich darauf aufmerksam. Danke!');
+23
View File
@@ -0,0 +1,23 @@
<?php
l::set('nav.main.label', 'Primary');
l::set('nav.lang.label', 'Language select');
l::set('footer.top', 'Top');
l::set('footer.madewith', 'Made with');
l::set('footer.source', 'Source');
l::set('go.contact', '➪ Contact');
l::set('home-banner.learnmore', 'Learn more');
l::set('home-banner.learnmore.label', 'Learn more about my services');
l::set('home-banner.contact', 'Contact');
l::set('contact.name', 'Name');
l::set('contact.email', 'Email address');
l::set('contact.message', 'Message');
l::set('contact.potty', 'Please leave this field blank');
l::set('contact.submit', 'Submit');
l::set('contact.heading.email', 'Email');
l::set('qdated.error', 'An error occured while displaying the email address. Please contact me via <a href="https://twitter.com/lukasbestle">Twitter</a> and tell me about this. Thank you!');
Submodule
+1
Submodule site/patterns added at f9c5f3db5a
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* Returns the current qdated address
* If qdated is not available, returns null
*
* @return string
*/
function qdated() {
$path = $_SERVER['HOME'] . DS . '.qdated-current';
if(!is_file($path)) return null;
return 'dated-' . trim(f::read($path)) . '@' . url::host();
}
/**
* Returns an HTML a mailto tag with the current qdated address
* If qdated is not available, returns an HTML error message
*
* @param mixed $text Optional text for the link
* Can also be true to use the email
* address but put a line break in it
* @return string HTML code
*/
function qdatedHtml($text = false) {
$email = qdated();
if(!$email) return '<p><strong>' . l::get('qdated.error') . '</strong></p>';
if($text === true) $text = str_replace('@', '<br>@', $email);
return str::email($email, $text);
}
/**
* qdated Kirbytag
*
* Usage: (qdated: Optional link text)
*/
kirby()->set('tag', 'qdated', [
'html' => function($tag) {
return qdatedHtml($tag->attr('qdated'));
}
]);
@@ -0,0 +1,6 @@
Name: <?= a::get($form, 'name') . "\n" ?>
Email: <?= a::get($form, '_from') . "\n" ?>
----
<?= a::get($form, 'message') ?>
+4
View File
@@ -0,0 +1,4 @@
<?php pattern('shared/2-blocks/footer', ['pSite' => 'codesignd']) ?>
<?= js('assets/js/index' . c::get('assets.suffix') . '.js') ?>
</body>
</html>
+31
View File
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="<?= $site->language()->code() ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= $page->title()->html() ?> ~ <?= $site->title()->html() ?></title>
<meta name="description" content="<?= $page->description()->or($site->description()) ?>">
<link rel="icon" href="<?= url('assets/img/favicon-96.png') ?>" type="image/png">
<link rel="apple-touch-icon-precomposed" href="<?= url('assets/img/favicon-152.png') ?>">
<?php foreach($site->languages()->filterBy('code', '!=', $site->language()->code()) as $lang): ?>
<link rel="alternate" href="<?= $page->url($lang->code()) ?>" hreflang="<?= $lang->code() ?>">
<?php endforeach ?>
<link rel="pgpkey" type="application/pgp-keys" href="<?= url('pgp.asc') ?>">
<link rel="preload" href="<?= url('assets/fonts/input-sans-narrow-regular.woff2') ?>" as="font" type="font/woff2" crossorigin>
<?php if($suffix = c::get('assets.suffix')): ?>
<style><?= f::read('assets/css/index' . $suffix . '.css') ?></style>
<?php else: ?>
<?= css('assets/css/index.css') ?>
<?php endif ?>
</head>
<body id="top">
<?php pattern('shared/2-blocks/header', [
'pSite' => 'codesignd',
'navData' => ['languages' => $site->languages(), 'items' => $site->pages()->visible()]
]) ?>
+7
View File
@@ -0,0 +1,7 @@
<?php
pattern('shared/2-blocks/nav', [
'wrapper' => false,
'languages' => $site->languages(),
'items' => $site->pages()->visible()
]);
+52
View File
@@ -0,0 +1,52 @@
<article class="text">
<h1><?= html($page->title()) ?></h1>
<div class="contact">
<div class="contact__main">
<form class="contact__form form<?php e($form->successful(), ' form--success') ?>" action="<?= url::current() ?>" method="post">
<div class="field field--required field--small">
<label class="field__label" for="name"><?= l::get('contact.name', 'Name') ?></label>
<input class="input field__input<?php e($form->hasError('name'), ' input--invalid') ?>" type="text" name="name" id="name" value="<?php $form->echoValue('name') ?>" placeholder=" " autocomplete="name" required/>
</div>
<div class="field field--required field--small">
<label class="field__label" for="email"><?= l::get('contact.email', 'Email address') ?></label>
<input class="input field__input<?php e($form->hasError('_from'), ' input--invalid') ?>" type="email" name="_from" id="email" value="<?php $form->echoValue('_from') ?>" placeholder=" " autocomplete="email" required/>
</div>
<div class="field">
<label class="field__label" for="message"><?= l::get('contact.message', 'Message') ?></label>
<textarea class="input field__input" rows="7" name="message" id="message"><?php $form->echoValue('message') ?></textarea>
</div>
<label class="vh" for="website"><?= l::get('contact.potty', 'Please leave this field blank') ?></label>
<input class="vh" type="text" name="website" id="website" autocomplete="off"/>
<div class="form__message"><?php if($form->hasMessage() && !$form->successful()): ?><?php $form->echoMessage() ?><?php endif ?></div>
<button class="button form__submit" type="submit" name="_submit" value="<?php echo $form->token() ?>"<?php e($form->successful(), ' disabled')?>><?= l::get('contact.submit', 'Submit') ?></button>
<img class="contact__stamp" src="<?= url('assets/img/stamp.svg') ?>" alt="">
</form>
<div class="contact__thank-you">
<?php if($form->hasMessage() && $form->successful()): ?>
<?php $form->echoMessage() ?>
<?php endif ?>
</div>
</div>
<aside class="contact__sidebar">
<div class="contact__detail">
<h2 class="contact__heading"><?= l::get('contact.heading.email', 'Email') ?></h2>
<div class="contact__email"><?= qdatedHtml(true) ?> <a href="<?= url('legal') ?>#contact">?</a></div>
<small><a href="<?= url('pgp.asc') ?>" rel="pgpkey" type="application/pgp-keys">PGP: 2E2A DD32 FE50 61C1</a></small>
</div>
<div class="contact__detail">
<h2 class="contact__heading">Twitter</h2>
<?= twitter('lukasbestle') ?>
</div>
</aside>
</div>
</article>
+3
View File
@@ -0,0 +1,3 @@
<article class="text text-container">
<?= $page->text()->kirbytext() ?>
</article>
+1
View File
@@ -0,0 +1 @@
<?php pattern('codesignd/2-blocks/home-banner', ['illustration' => $page->image()->url(), 'text' => $page->text()->kt()]) ?>
+10
View File
@@ -0,0 +1,10 @@
<article class="text">
<h1><?= html($page->title()) ?></h1>
<?php foreach($page->services()->toStructure() as $service): ?>
<?php $illustration = ($illustration = $service->illustration()->toFile())? $illustration->url() : false ?>
<?php pattern('codesignd/2-blocks/service', ['illustration' => $illustration, 'title' => $service->title(), 'coloredTitle' => ($site->language()->code() === 'de'), 'text' => $service->text()->kt()]) ?>
<?php endforeach ?>
</article>
<hr>
<?php pattern('shared/2-blocks/cta', ['text' => $page->cta()->kirbytext(), 'button' => l::get('go.contact', '➪ Contact'), 'link' => url('contact')]) ?>
+19
View File
@@ -0,0 +1,19 @@
<?php
// Special treatment for AJAX submissions
if(r::is('POST')) {
$fields = [];
foreach(r::data() as $field => $value) {
$fields[$field] = $form->hasError($field);
}
$data = [
'success' => $form->successful(),
'fields' => $fields,
'message' => $form->message()
];
echo response::json($data);
} else {
require_once('default.json.php');
}
+3
View File
@@ -0,0 +1,3 @@
<?php
require_once('default.php');
+17
View File
@@ -0,0 +1,17 @@
<?php
// Determine snippet name and fall back to default if it does not exist
$snippet = 'templates/' . $page->intendedTemplate();
if(!$kirby->get('snippet', $snippet)) $snippet = 'templates/default';
// Define structured data for the frontend AJAX code
$data = [
'url' => $page->url(),
'cachable' => $page->isCachable(),
'title' => $page->title() . ' ~ ' . site()->title(),
'nav' => snippet('nav', [], true),
'main' => snippet($snippet, [], true)
];
// Return it as JSON
echo response::json($data);
+13
View File
@@ -0,0 +1,13 @@
<?php
// Determine snippet name and fall back to default if it does not exist
$snippet = 'templates/' . $page->intendedTemplate();
if(!$kirby->get('snippet', $snippet)) $snippet = 'templates/default';
?>
<?php snippet('header') ?>
<main class="main">
<?php snippet($snippet) ?>
</main>
<?php snippet('footer') ?>