Skip to content

Commit

Permalink
resync from main repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rossriley committed Aug 18, 2017
1 parent 75211d4 commit 73e7021
Show file tree
Hide file tree
Showing 27 changed files with 6,434 additions and 120 deletions.
4 changes: 3 additions & 1 deletion css/foundation.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
text-align: center; }

[type='search'] {
box-shadow: none; }
-webkit-box-shadow: none;
box-shadow: none; }

ul.pagination {
background: #DDD;
Expand Down
5 changes: 3 additions & 2 deletions extrafields.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

<h1>{{ record.title }}</h1>

{{ fields() }}
{% with { 'record': record, 'common': false, 'repeaters': true } %}
{{ block('sub_fields', 'partials/_sub_fields.twig') }}
{% endwith %}

{# Uncomment this if you wish to dump the entire record to the client, for debugging purposes.
{{ dump(record) }}
Expand All @@ -13,4 +15,3 @@
{% include 'partials/_recordfooter.twig' with { 'record': record, 'extended': true } %}

{% endblock main %}

20 changes: 12 additions & 8 deletions index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

{% block main %}

<h1>{{ record.title }}</h1>
{% if record is defined %}

{# Remove this block if you don't need it anymore. #}
{{ include('partials/_fresh_install.twig') }}
<h1>{{ record.title }}</h1>

{{ record.teaser }}
{# Remove this block if you don't need it anymore. #}
{{ include('partials/_fresh_install.twig') }}

{{ popup(record.image, 1200, 500) }}
{{ record.teaser }}

{{ record.body }}
{{ popup(record.image, 1200, 500) }}

{{ include('partials/_recordfooter.twig', { 'record': record }) }}
{{ record.body }}

{% endblock main %}
{{ include('partials/_recordfooter.twig', { 'record': record }) }}

{% endif %}

{% endblock main %}
6 changes: 1 addition & 5 deletions js/foundation.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion listing.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
is set to true. This way we keep 'grouping' intact in the listing. #}
{% if not taxonomy.has_sortorder %}
{# If we specified an order in config.yml, sort them here, accordingly: #}
{% set records = records|order(app.config.get('general/listing_sort')) %}
{% set records = records|order(config.get('general/listing_sort')) %}
{% endif %}
{% endif %}

Expand Down
10 changes: 6 additions & 4 deletions notfound.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends 'partials/_master.twig' %}
{% use 'partials/_sub_fields.twig' %}

{% setcontent record = 'blocks/404-not-found' %}

Expand All @@ -7,17 +8,18 @@
{% endblock title %}

{% block main %}

<div class="row">
<div class="large-12 columns">

{# special case: See if we actually want the Styleguide. #}
{% if app.request.server.get('REQUEST_URI') == '/styleguide' %}
{% if global.request.server.get('REQUEST_URI') == '/styleguide' %}
{{ include('styleguide.twig') }}
{% else %}
<h1>{{ record.title|default('404 not found') }}</h1>

{% if fields(record) %}
{{ fields(record) }}
{% if record %}
{{ block('sub_fields') }}
{% else %}
<p>
The requested page was not found.
Expand All @@ -37,4 +39,4 @@
</div>
</div>

{% endblock main %}
{% endblock main %}
7 changes: 5 additions & 2 deletions page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{{ record.teaser }}

{% if record.image!="" %}
{% if record.image != "" %}
<a href="{{ image(record.image) }}">
<img src="{{ thumbnail(record.image, 740, 560) }}">
</a>
Expand All @@ -15,7 +15,10 @@
{{ record.body }}

{# If there are repeaters, we should output them. #}
{{ fields(common = false, extended = false, repeaters = true) }}
{% with { 'record': record, 'common': false, 'repeaters': true, 'exclude': ['teaser', 'body', 'image'] } %}
{{ block('sub_fields', 'partials/_sub_fields.twig') }}
{% endwith %}


{# Uncomment this if you wish to dump the entire record to the client, for debugging purposes.
{{ dump(record) }}
Expand Down
18 changes: 12 additions & 6 deletions partials/_aside.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@
<h5>{{ block.title }}</h5>
{{ block.content }}

{% if link(block.contentlink) or block.editlink() %}
{% set edit_link = block.editlink() %}
{% set content_link = block.contentlink|default() %}
{% if content_link or edit_link %}
<p>
{{ link(block.contentlink, __('general.phrase.read-more')) }} /
<a href="{{ block.editlink() }}">{{ __('general.phrase.edit') }}</a>
{%- if content_link %}
<a href="{{ relative_path(content_link|e) }}">{{ __('general.phrase.read-more') }}</a>
{% endif -%}
{%- if edit_link %}
/ <a href="{{ edit_link }}">{{ __('general.phrase.edit') }}</a>
{% endif -%}
</p>
{% endif %}

Expand Down Expand Up @@ -56,19 +62,19 @@
Lastly, "path('contentlisting', {'contenttypeslug': ct.slug})" will output something like '/pages',
effectively creating a working link to that contenttpye's listing page. #}

{% for ct in app.config.get('contenttypes') if not ct.viewless|default(false) %}
{% for ct in config.get('contenttypes') if not ct.viewless|default(false) %}

{% setcontent records = ct.slug ~ "/latest/3" %}

<h5>{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.slug}) }}</h5>
<h5>{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}</h5>
<ul>
{% for record in records %}
<li><a href="{{ record.link }}">{{ record.title }}</a></li>
{% else %}
<li>{{ __('contenttypes.generic.no-recent', {'%contenttype%': ct.slug}) }}</li>
{% endfor %}
</ul>
<p><a href="{{ path('contentlisting', {'contenttypeslug': ct.slug}) }}">{{ __('contenttypes.generic.overview',{'%contenttypes%': ct.slug}) }} &raquo;</a></p>
<p><a href="{{ path('contentlisting', {'contenttypeslug': ct.slug}) }}">{{ __('contenttypes.generic.overview',{'%contenttypes%': ct.name}) }} &raquo;</a></p>


{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion partials/_fresh_install.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<p>This is a bland theme, with a modular structure. It is well suited to build your own theme's on top of.</p>
<ul>
<li>Check the <a href='https://github.com/bobdenotter/bolt-foundation-theme/blob/master/readme.md'>readme.md</a> for instructions on how to customize this theme.</li>
<li>View the <a href='{{ app.request.basePath }}/styleguide'>Styleguide</a> for this theme.</li>
<li>View the <a href='{{ global.request.basePath }}/styleguide'>Styleguide</a> for this theme.</li>
<li>Read the <a href='http://foundation.zurb.com/sites/docs/'>Foundation for Sites</a> documentation.</li>
<li><a href='{{ path('fileedit', {'namespace': 'theme', 'file': 'index.twig'}) }}'>Edit this template</a>, to get rid of this 'callout'.</li>
</ul>
Expand Down
8 changes: 4 additions & 4 deletions partials/_header.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

{% set headerimage = asset('images/' ~ random(theme.headerimage), 'theme') %}

{# the values in the 'app.config' object are taken directly from the file app/config/config.yml #}
{# the values in the 'config' object are taken directly from the file app/config/config.yml #}
<div class="large-12 columns headertitle">
<h2>{{ app.config.get('general/sitename') }}</h2>
{% if app.config.get('general/payoff') %}
<p>{{ app.config.get('general/payoff') }}</p>
<h2>{{ config.get('general/sitename') }}</h2>
{% if config.get('general/payoff') %}
<p>{{ config.get('general/payoff') }}</p>
{% endif %}
</div>
<div class="large-12 columns headerphoto" style='background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2) 60%, rgba(255, 255, 255, 0.5)), url({{ headerimage }})'>
Expand Down
4 changes: 2 additions & 2 deletions partials/_master.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
sitename. If there is no title, we append the sitename with the payoff, if there is one. #}
<title>
{%- if record.title is defined %}{{ record.title|striptags }} | {% endif -%}
{{ app.config.get('general/sitename') -}}
{% if record.title is not defined and app.config.get('general/payoff') %} | {{ app.config.get('general/payoff') }}{% endif -%}
{{ config.get('general/sitename') -}}
{% if record.title is not defined and config.get('general/payoff') %} | {{ config.get('general/payoff') }}{% endif -%}
</title>
<link rel="stylesheet" href="{{ asset('css/foundation.css', 'theme') }}">
<link rel="stylesheet" href="{{ asset('css/theme.css', 'theme') }}">
Expand Down
94 changes: 94 additions & 0 deletions partials/_sub_field_blocks.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{# Sub-block for 'text' field such as 'text', 'textarea', or 'html' #}
{% block text_field %}
<div {% if key is not empty %}data-bolt-field="{{ key }}"{% endif %}>
{%- autoescape false -%}
{# If 'allowtwig' is true for this field, we'll need to parse it as Twig here. #}
{% if allowtwig|default(false) %}{{ include(template_from_string(value)) }}{% else %}{{ value }}{% endif -%}
{%- endautoescape -%}
</div>
{% endblock %}

{# Sub-block for Markdown fields #}
{% block markdown_field %}
<div {% if key is not empty %}data-bolt-field="{{ key }}"{% endif %}>
{# If 'allowtwig' is true for this field, we'll need to parse it as Twig here. #}
{% if allowtwig|default(false) %}{{ include(template_from_string(value))|markdown }}{% else %}{{ value|markdown }}{% endif -%}
</div>
{% endblock %}

{# Sub-block for 'imagelist' fields #}
{% block imagelist_field %}
<div class="bolt-imagelist">
{% for image in images %}
<div class="bolt-imageholder">
{{ popup(image.filename, 200, 0) }}
</div>
{% endfor %}
</div>
{% endblock %}

{# Block for "basic" fields like HTML, Markdown, Textarea and Text #}
{% block common_fields %}

{# HTML, Textarea, Text fields #}
{% if fieldtype in ['html', 'textarea', 'text'] %}
{{ block('text_field') }}
{% endif %}

{# Markdown fields #}
{% if fieldtype == 'markdown' %}
{{ block('markdown_field') }}
{% endif %}

{# Image fields #}
{% if fieldtype == "image" and value.file|default is not empty %}
{{ popup(value, 1200, 0) }}
{% endif %}

{# Video fields #}
{% if fieldtype == "video" and value.responsive|default is not empty %}
<div class="flex-video {{ value.ratio|default(1) > 1.5 ? 'widescreen' }}">
{{ value.responsive }}
</div>
{% endif %}

{% endblock %}

{# Block for other field types, like Geo, Select, Checkbox and others. #}
{% block extended_fields %}

{# Geolocation field #}
{% if fieldtype == "geolocation" and value.latitude|default is not empty %}
<img src="http://maps.googleapis.com/maps/api/staticmap?center={{ value.latitude }},{{ value.longitude }}&amp;zoom=14&amp;size=617x300&amp;sensor=false&amp;markers={{ value.latitude }},{{ value.longitude }}">
{% endif %}

{# Special case for 'select' fields: if it's a multiple select, the value is an array. #}
{% if fieldtype == "select" and value is not empty %}
<p><strong>{{ key }}: </strong>
{{ value|join(", ") }}
</p>
{% endif %}

{# Checkbox fields #}
{% if fieldtype == "checkbox" %}
<p>Checkbox {{ key }}: {{ value ? "checked" : "not checked" }}</p>
{% endif %}

{# Imagelist fields #}
{% if fieldtype == "imagelist" and value is not empty %}
{{ block('imagelist_field') }}
{% endif %}

{# No special case defined for this type of field. We just output them, if it's
a simple scalar, and 'dump' them otherwise. #}
{% if fieldtype in [ 'filelist', 'datetime', 'date', 'integer', 'float' ] and value is not empty %}
<p><strong>{{ key }}: </strong>
{% if value is iterable %}
{{ dump(value) }}
{% else %}
{{ value }}
{% endif %}
</p>
{% endif %}

{% endblock %}

0 comments on commit 73e7021

Please sign in to comment.