Commit fd066058 authored by Tobias Buckdahn's avatar Tobias Buckdahn
Browse files

Working on tech display and theming

parent dd0f6ca4
{
"editor.detectIndentation": false,
"editor.tabSize": 4,
}
\ No newline at end of file
---
title: Part
visible: false
content:
items:
- '@taxonomy.function': stud_tilt
- '@taxonomy.function': stud_twist
- '@taxonomy.function': axle_tilt
order:
by: title
dir: desc
limit: 12
pagination: true
---
\ No newline at end of file
......@@ -2,7 +2,7 @@
title: Shape
content:
items:
items:
- '@taxonomy.function': shape_2D
- '@taxonomy.function': shape_3D
order:
......
......@@ -5,12 +5,11 @@ metadata:
content:
items:
'@page.children': '/tech'
'@self.children'
order:
by: date
dir: desc
limit: 12
pagination: true
by: default
dir: asc
visible: true
# feed:
# description: Sample Blog Description
......@@ -19,5 +18,5 @@ content:
# pagination: true
---
# My Gravtastic Blog
A tale of **awesomazing** adventures
# Techs
Here comes a collection of **awesomazing** LEGO building techniques.
---
title: Dummy
---
\ No newline at end of file
---
title: Dummy
---
\ No newline at end of file
---
title: "Brick 1 x 2 Ring"
date: 27-08-2015
image: image.png
cad: model.ldr
......
---
title: "Brick Octagonal with Side Studs"
date: 08-11-2015
image: image.png
cad: model.ldr
......
<?php
namespace Grav\Theme;
use Grav\Common\Grav;
use Grav\Common\Theme;
use Grav\Common\Page\Pages;
use Grav\Common\Twig\Twig;
class BrickView extends Theme
{
// Access plugin events in this class
public static function getSubscribedEvents()
{
return [
'onThemeInitialized' => ['onThemeInitialized', 0]
];
}
public function onThemeInitialized()
{
if ($this->isAdmin()) {
$this->active = false;
return;
}
$this->enable([
'onTwigExtensions' => ['onTwigExtensions', 0]
]);
}
public function onTwigExtensions()
{
$brickview_image = new \Twig_simpleFunction(
'brickview_image', function ( $taxonomy, $term, $ext='png' ) {
// find existing folder
$folder = $this->grav['page']->find('/images/tax-' . $taxonomy);
if (!$folder) {
$folder = $this->grav['page']->find('/images');
}
// find image in folder
$image = $folder->media()[$term . '.' . $ext];
if ($image) {
return $image;
}
$image = $folder->media()['no_image.png'];
return $image;
}
);
$this->grav['twig']->twig->addFunction($brickview_image);
}
}
......@@ -71,25 +71,31 @@ img {
}
/* Content Styling */
.header {
#header {
background-color: #1F8DD6;
color: #eee;
}
.header .wrapper{
#header .wrapper{
padding: 1rem 0;
}
.header a {
#header a {
color: #fff;
}
.header .logo {
#header .logo {
font-size: 1.7rem;
text-transform: uppercase;
}
.footer {
#items::after {
content: ' ';
clear: both;
display: block;
}
#footer {
background-color: #eee;
}
......
{% extends 'partials/base.html.twig' %}
{% set collection = page.collection() %}
{% if page.header.content.visible is defined %}
{% set collection = page.header.content.visible ? page.collection().visible() : page.collection().invisible() %}
{% else %}
{% set collection = page.collection() %}
{% endif %}
{% block content %}
<section class="masonry">
{% for post in collection %}
{% include 'partials/blog/item.html.twig' with {'post': post, 'class': "left col-xl-2 col-lg-3 col-md-4 col-sm-6 col-xs-12"}%}
<figure id="items-image">
{% block items_image %}
{% if post.header.image %}
<img src="{{ post.media[post.header.image].cropResize(300, 300).url }}" width="100%" height="100%" alt={{ post.title }}>
{% endif %}
{% endblock %}
</figure>
<header id="items-header">
{% block items_header %}
{{ page.content }}
{% endblock %}
</header>
<section id="items">
{% block items %}
{% for post in collection %}
{% block item %}
{% include 'partials/item/base.html.twig' with {'post': post}%}
{% endblock %}
{% endfor %}
<div class="clear">
{% endblock %}
</section>
<footer id="items-footer">
{% block items_footer %}
{% endblock %}
</footer>
{% endblock %}
\ No newline at end of file
{% extends 'blog.html.twig' %}
{% block item %}
{% include 'partials/item/collection.html.twig' with {'post': post}%}
{% endblock %}
\ No newline at end of file
{% extends 'partials/base.html.twig' %}
{% block content %}
{{ page.content }}
<article class="single type-{{ page.template }} slug-{{ page.slug }}">
<figure class="single-image">
{% block single_image %}
{% if page.header.image %}
{% set media = page.media[page.header.image] %}
{% else %}
{% set media = media_directory('theme://images')['no_image.png'] %}
{% endif %}
<img src="{{ media.cropResize(500,500).url }}" alt={{ page.title }}>
{% endblock %}
</figure>
<header class="single-header">
{% block single_header %}
<h1 class="single-title">{{ page.title }}</h1>
<section class="single-meta">
{% block single_meta %}
<time class="date" datetime="{{ page.date|date() }}">{{ page.date|date()|nicetime }}</time>
<span class="divider"> | </span>
<span class="author">{{ page.header.author|default("Brick.camp") }}</span>
{% endblock %}
</section>
{% endblock %}
</header>
<section class="single-content">
{% block single_content %}
{{ page.content }}
{% endblock %}
</section>
<footer class="single-footer">
{% block single_footer %}
TODO: Footer
{% endblock %}
</footer>
</article>
{% endblock %}
{% macro image(folder, name, ext, ) %}
{% endmacro %}
\ No newline at end of file
......@@ -27,31 +27,31 @@
{% endblock head%}
</head>
<body class="{{ page.header.body_classes }}">
<body class="type-{{ page.template }} slug-{{ page.slug }} {{ page.taxonomy.tag|join(" ") }}">
{% block header %}
<div class="header">
<header id="header">
{% block header %}
<div class="wrapper">
{% include 'partials/header/main.html.twig' %}
</div>
</div>
{% endblock %}
{% endblock %}
</header>
{% block body %}
<section id="body">
<main id="body">
{% block body %}
<div class="wrapper">
{% block content %}{% endblock %}
{% block content %}{% endblock %}
</div>
</section>
{% endblock %}
{% endblock %}
</main>
{% block footer %}
<div class="footer text-center">
<div class="wrapper">
<footer id="footer">
{% block footer %}
<div class="wrapper text-center">
<p><a href="http://getgrav.org">Grav</a> was <i class="fa fa-code"></i> with <i class="fa fa-heart"></i> by <a href="http://www.rockettheme.com">RocketTheme</a>.</p>
</div>
{% endblock %}
</div>
{% endblock %}
{% block bottom %}
{{ assets.js('bottom') }}
......
<time class="post-date" datetime="{{ post.date | date(site.date_short) }}">{{ post.date | date(site.date_short) }}</time>
{% if post.header.size %}
<div class="post-size">
<span class="width"> {{ post.header.size.width[0] ~ ' ' ~ post.header.size.width[1]|pluralize }} </span> x
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment