Initial commit: Grav CMS setup with HTML reference material
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<table id="data-table" class="table">
|
||||
<colgroup>
|
||||
<col width="20" />
|
||||
<col width="80" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for type, directory in directories %}
|
||||
{%- set title = options.directories[type]['title'] ?? options.directories[type]['collection']['title'] ?? directory.title -%}
|
||||
{%- if title matches '/\{/' -%}
|
||||
{%- set title = include(template_from_string(title, 'collection title template'))|trim -%}
|
||||
{%- endif -%}
|
||||
{%- set description = options.directories[type]['description'] ?? options.directories[type]['collection']['description'] ?? directory.description -%}
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ url(directory_url ~ '/directory:' ~ type)|e }}">{{ title|e }}</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ description|e }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,37 @@
|
||||
{# flex-objects/page.html.twig #}
|
||||
|
||||
{%- set options = options ?? {} %}
|
||||
{%- set flex = grav.get('flex_objects') %}
|
||||
{%- set list = list ?? options.list ?? (options.directories ?? flex.defaultDirectories())|keys %}
|
||||
|
||||
{%- if page_assets.css ?? config.get('plugins.flex-objects.built_in_css') ?? true %}
|
||||
{% do assets.addCss('plugin://flex-objects/css/site.css') %}
|
||||
{% endif %}
|
||||
{%- if page_assets.jss ?? true %}
|
||||
{% do assets.addJs('plugin://flex-objects/js/list.min.js') %}
|
||||
{% endif %}
|
||||
|
||||
{%- if type %}
|
||||
{%- set options = options.directories[type] ?? options %}
|
||||
|
||||
{%- if type not in list %}
|
||||
{# Display error page #}
|
||||
{% include 'flex-objects/views/404.html.twig' %}
|
||||
|
||||
{%- elseif id %}
|
||||
{% set options = options.object ?? options %}
|
||||
|
||||
{# Display specified object #}
|
||||
{% include 'flex-objects/views/object.html.twig' with { type: type, id: id, options: options } %}
|
||||
|
||||
{%- else %}
|
||||
{% set options = options.collection ?? options %}
|
||||
|
||||
{# Display specified directory #}
|
||||
{% include 'flex-objects/views/directory.html.twig' with { type: type, options: options } %}
|
||||
{%- endif %}
|
||||
|
||||
{%- else %}
|
||||
{# Display list of directories #}
|
||||
{% include 'flex-objects/views/directories.html.twig' with { options: options, list: list } %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1 @@
|
||||
{% throw 404 'Not Found' %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{# flex-objects/views/directories.html.twig #}
|
||||
|
||||
{% set flex = grav.get('flex_objects') %}
|
||||
{% set directory_url = page.route() %}
|
||||
{% set list = list ?? options.list %}
|
||||
{% set directories = list ? flex.directories(list|array) : flex.defaultDirectories() %}
|
||||
{% set layout = options.layout ?: 'default' %}
|
||||
|
||||
{% include [
|
||||
'flex-objects/directories/' ~ layout ~ '.html.twig',
|
||||
'flex-objects/directories/default.html.twig'
|
||||
] %}
|
||||
@@ -0,0 +1,24 @@
|
||||
{# flex-objects/views/directory.html.twig #}
|
||||
|
||||
{% set flex = grav.get('flex_objects') %}
|
||||
{% set directory = flex.directory(type) %}
|
||||
|
||||
{% if directory %}
|
||||
{% set layout = options.layout ?? 'default' %}
|
||||
{% set context = options ?? {} %}
|
||||
{% set type = directory.flexType() %}
|
||||
{% set collection = directory.collection %}
|
||||
|
||||
{%- set title = options.title -%}
|
||||
{%- if title matches '/\{/' -%}
|
||||
{%- set title = include(template_from_string(title, 'collection title template'))|trim -%}
|
||||
{%- endif -%}
|
||||
{% if title %}
|
||||
{% do page.title(title) %}
|
||||
{% endif %}
|
||||
|
||||
{% render collection layout: layout with context|merge({title: title}) %}
|
||||
|
||||
{% else %}
|
||||
{% include 'flex-objects/views/404.html.twig' %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,23 @@
|
||||
{# flex-objects/views/object.html.twig #}
|
||||
|
||||
{% set flex = grav.get('flex_objects') %}
|
||||
{% set directory = flex.directory(type) %}
|
||||
{% set object = directory.getObject(id) %}
|
||||
|
||||
{% if object %}
|
||||
{%- set title = options.title -%}
|
||||
{%- if title matches '/\{/' -%}
|
||||
{%- set title = include(template_from_string(title, 'object title template'))|trim -%}
|
||||
{%- endif -%}
|
||||
{% if title %}
|
||||
{% do page.title(title) %}
|
||||
{% endif %}
|
||||
|
||||
{% set layout = options.layout ?? 'default' %}
|
||||
{% set context = options ?? {} %}
|
||||
|
||||
{% render object layout: layout with context|merge({title: title}) %}
|
||||
|
||||
{% else %}
|
||||
{% include 'flex-objects/views/404.html.twig' %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user