add forms

This commit is contained in:
2019-04-09 18:05:36 +02:00
parent 4346f85d56
commit 5bcef4263e
17 changed files with 281 additions and 46 deletions

View File

@@ -13,17 +13,11 @@
<div class="content">
<h2>{{page.title}}</h2>
{{content}}
{% for item in page.collection %}
<div class="sub-content">
<h3>{{item.title}}</h3>
{{item.content}}
</div>
{% endfor %}
</div>
{% block sidebar %}
{% include 'partials/sidebar.html.twig' %}
{% endblock %}
</section>
{% block sidebar %}
{% include 'partials/sidebar.html.twig' %}
{% endblock %}
</section>
{% endblock %}

View File

@@ -4,11 +4,15 @@
{% block content %}
<div class="gal">
{% if image %}
{% for images in image %}
{{ images }}
{% for feature in page.header.buttons %}
{% set gal = feature.header.a_file %}
<div class="content_gal">
<div class="title">
<h2>{{ feature.text }}</h2>
</div>
<img src="user/pages/01.home/{{gal}}" alt="">
</div>
{% endfor %}
{% endif %}
</div>
<div class="content">

View File

@@ -1,7 +1,7 @@
{% set collection = page.collection() %}
{% set image = page.media.images|first %}
{% for item in page.collection if page.template == "footer" %}
{% for item in collection if page.template == "footer" %}
{{item.title}}
{% endfor %}
<section id="footer" class="section blog-listing">

View File

@@ -0,0 +1,43 @@
{% macro render_field(form, fields, scope) %}
{% for index, field in fields %}
{% set input = attribute(field, "input@") %}
{% if input is null or input == true %}
{% if form.value(scope ~ field.name) %}
{% block field %}
<div>
{% block field_label %}
<strong>{{ field.name|t|e }}</strong>:
{% endblock %}
{% block field_value %}
{% if field.type == 'checkboxes' %}
<ul>
{% set use_keys = field.use is defined and field.use == 'keys' %}
{% for key,value in form.value(scope ~ field.name) %}
{% set index = (use_keys ? key : value) %}
<li>{{ field.options[index]|e }}</li>
{% endfor %}
</ul>
{% elseif field.type == 'checkbox' %}
{{ (form.value(scope ~ field.name) == 1) ? "PLUGIN_FORM.YES"|t|e : "PLUGIN_FORM.NO"|t|e }}
{% elseif field.type == 'select' %}
{{ field.options[form.value(scope ~ field.name)]|e }}
{% else %}
{{ string(form.value(scope ~ field.name))|nl2br }}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% endif %}
{% else %}
{% if field.fields %}
{% set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope %}
{{ _self.render_field(form, field.fields, new_scope) }}
{% endif %}
{% endif %}
{% endfor %}
{% endmacro %}
{{ _self.render_field(form, form.fields, '') }}

View File

@@ -1,17 +0,0 @@
{%- macro render_field(form, fields, scope) %}
{%- for index, field in fields %}
{%- set input = attribute(field, "input@") %}
{%- if input is null or input == true %}
{%- set value = form.value(scope ~ (field.name ?? index)) %}
{{- scope ~ (field.name ?? index) }}: {{ string(value is iterable ? value|json_encode : value|escape('yaml')) ~ "\r\n" }}
{%- else %}
{%- if field.fields %}
{%- set new_scope = field.nest_id ? scope ~ field.name ~ '.' : scope -%}
{{- _self.render_field(form, field.fields, new_scope) }}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endmacro %}
{%- autoescape false %}
{{- _self.render_field(form, form.fields, '') ~ "\r\n" }}
{%- endautoescape %}

View File

@@ -1 +0,0 @@
{% extends "forms/default/data.txt.twig" %}

View File

@@ -0,0 +1,37 @@
{% extends 'partials/base.html.twig' %}
{% set blog = page.find(header_var('blog_url')|defined(theme_var('blog-page'))) %}
{% set show_breadcrumbs = header_var('show_breadcrumbs', [page, blog])|defined(true) %}
{% set show_sidebar = header_var('show_sidebar', [page, blog])|defined(true) %}
{% set show_pagination = header_var('show_pagination', [page, blog])|defined(true) %}
{% set hero_image_name = page.header.hero_image %}
{% block hero %}
{% if hero_image_name %}
{% set hero_image = page.media[hero_image_name] %}
{% set content %}
<h1>{{ page.title }}</h1>
<h2>{{ page.header.subtitle }}</h2>
{% include 'partials/blog/date.html.twig' %}
{% include 'partials/blog/taxonomy.html.twig' %}
{% endset %}
{% include 'partials/hero.html.twig' with {id: 'blog-hero'} %}
{% endif %}
{% endblock %}
{% block body %}
{% if show_breadcrumbs and config.plugins.breadcrumbs.enabled %}
{% include 'partials/breadcrumbs.html.twig' %}
{% endif %}
{% embed 'partials/layout.html.twig' %}
{% block item %}
{% include 'partials/blog-item.html.twig' %}
{% endblock %}
{% endembed %}
{% for child in page.collection %}
{{child.content}}
{% endfor %}
{% endblock %}

View File

@@ -5,8 +5,8 @@
{{ image.html }}
</div>
{% endif %}
{% if not hero_image_name %}
<div class="content">
{% if not hero_image_name and not show_sidebar %}
<div class="content_s">
{% include 'partials/blog/title.html.twig' with {title_level: 'h2'} %}
{% if page.header.subtitle %}
<h3 >{{ page.header.subtitle }}</h3>
@@ -14,3 +14,12 @@
{{ page.content|raw }}
</div>
{% endif %}
{% if not hero_image_name and show_sidebar %}
<div class="content">
{% include 'partials/blog/title.html.twig' with {title_level: 'h2'} %}
{% if page.header.subtitle %}
<h3 >{{ page.header.subtitle }}</h3>
{% endif %}
{{ page.content|raw }}
</div>
{% endif %}

View File

@@ -14,7 +14,7 @@
<div class="card-title">
{% include 'partials/blog/title.html.twig' with {title_level: 'h5'} %}
{% include 'partials/blog/date.html.twig' %}
</div>
</div>
<div class="card-summary">
<a href="{{ page.url }}">
{% if page.summary != page.content %}

View File

@@ -0,0 +1,35 @@
{% extends 'partials/base.html.twig' %}
{% set collection = page.collection() %}
{% set image = page.media.images|first %}
{% block body %}
<section id="item" class="section blog-listing">
<div class="bandeau">
{% if image %}
{{image.html}}
{% endif %}
</div>
<div class="content">
<h2>{{page.title}}</h2>
{{content}}
{% for item in page.collection %}
<div class="sub-content">
{% set child_image = item.media.images|first %}
{% if image %}
{{child_image.html}}
{% endif %}
<h3>{{item.title}}</h3>
{{item.content}}
</div>
{% endfor %}
</div>
{% block sidebar %}
{% include 'partials/sidebar.html.twig' %}
{% endblock %}
</section>
{% endblock %}