merge master in prod

This commit is contained in:
2020-09-08 12:00:45 +02:00
parent b925edaa9e
commit 3e5e731c2c
226 changed files with 8516 additions and 4149 deletions
@@ -3,8 +3,8 @@
{% block field %}
{% set avatar = form.value('avatar') %}
{% if avatar %}
<label><img style="max-width:200px;" src="{{ base_url_simple ~ '/' ~ (avatar|first).path }}" /></label>
<label class="{{ field.classes }}"><img class="{{ field.img_classes }}" style="max-width:200px;" src="{{ base_url_simple ~ '/' ~ (avatar|first).path }}" /></label>
{% else %}
<label><img src="https://www.gravatar.com/avatar/{{ form.value('email')|md5 }}?s=200" /></label>
<label class="{{ field.classes }}"><img class="{{ field.img_classes }}" src="https://www.gravatar.com/avatar/{{ form.value('email')|md5 }}?s=200" /></label>
{% endif %}
{% endblock %}
{% endblock %}
@@ -10,11 +10,11 @@
{% block input %}
{% if not site_key %}
<script>console && console.error('site_key was not defined for form "{{ form.name }}" (Grav Form Plugin)')</script>
<script type="application/javascript">console && console.error('site_key was not defined for form "{{ form.name }}" (Grav Form Plugin)')</script>
{% elseif config.plugins.form.recaptcha.version == 3 %}
{#{% do assets.addJs('https://www.google.com/recaptcha/api.js?render='~site_key) %}#}
<script src='https://www.google.com/recaptcha/api.js?render={{ site_key }}&theme={{ theme }}'></script>
<script>
{% do assets.addJs('https://www.google.com/recaptcha/api.js?render='~site_key~'&theme=' ~ theme) %}
{#<script src='https://www.google.com/recaptcha/api.js?render={{ site_key }}&theme={{ theme }}'></script>#}
<script type="application/javascript">
(document.querySelectorAll('form') || []).forEach(function(form, index) {
var submit = function(event) {
event.preventDefault();
@@ -42,7 +42,7 @@
});
</script>
{% elseif config.plugins.form.recaptcha.version == '2-invisible' %}
<script>
<script type="application/javascript">
function captchaOnloadCallback_{{ formName }}() {
var form = document.querySelector('form#{{ form.id }}');
var submits = form.querySelectorAll('[type="submit"]') || [];
@@ -75,7 +75,7 @@
<script src="https://www.google.com/recaptcha/api.js?onload=captchaOnloadCallback_{{ formName }}&hl={{ grav.language.language }}&theme={{ theme }}"
async defer></script>
{% else %}
<script>
<script type="application/javascript">
var captchaOnloadCallback_{{ formName }} = function captchaOnloadCallback_{{ formName }}() {
grecaptcha.render('g-recaptcha-{{ formName }}', {
'sitekey': "{{ site_key }}",
@@ -4,14 +4,14 @@
{% endblock %}
{% block input %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
{% set id = field.id|default(field.name)|hyphenize %}
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<input
{# required attribute structures #}
name="{{ (scope ~ field.name)|fieldName }}"
value="{{ value|join(', ') }}"
value="{{ field.value ?? '1' }}"
type="checkbox"
{% if value == true %} checked="checked" {% endif %}
{% if value == field.value ?? '1' %} checked="checked" {% endif %}
{# input attribute structures #}
{% block input_attributes %}
@@ -22,6 +22,7 @@
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% endblock %}
/>
<label style="display:inline;" class="inline" for="{{ id|e }}">
@@ -15,7 +15,7 @@
{% block input %}
{% for key, text in field.options %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
{% set id = field.id|default(field.name)|hyphenize ~ '-' ~ key %}
{% set name = field.use == 'keys' ? key : id %}
{% set val = field.use == 'keys' ? '1' : key %}
{% set checked = (field.use == 'keys' ? value[key] : key in value) %}
@@ -4,7 +4,7 @@
<div class="form-input-wrapper {{ field.size }}">
<input
type="text"
value="{{ value|e('html_attr')|join(', ') }}"
value="{{ value|join(', ') }}"
data-key-observe="{{ (scope ~ field.name)|fieldName }}"
{% block input_attributes %}
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
@@ -16,6 +16,7 @@
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
{% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
{% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}
{% if field.validate.message %}title="{{ field.validate.message|e|t }}"
@@ -23,4 +24,4 @@
{% endblock %}
/>
</div>
{% endblock %}
{% endblock %}
@@ -1,5 +1,7 @@
{% extends "forms/field.html.twig" %}
{% set value = null %}
{% block input_attributes %}
type="password"
{{ parent() }}
@@ -16,6 +16,7 @@
{% if key == value %}checked="checked" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
/>
<label style="display: inline" class="inline" for="{{ id|e }}">{{ text|t|raw }}</label>
</div>
@@ -17,6 +17,7 @@
{% if required %}required="required"{% endif %}
{% if field.multiple in ['on', 'true', 1] %}multiple="multiple"{% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if field.form %}form="{{ field.form }}"{% endif %}
{% if field.key %}
data-key-observe="{{ (scope ~ field.name)|fieldName }}"
@@ -46,14 +47,15 @@
{{ avalue|raw }}
</option>
{% elseif item_value is iterable %}
<optgroup label="{{ key }}">
{%for subkey, suboption in item_value %}
{% set selected = field.selectize ? suboption : subkey %}
{% set item_value = field.selectize and field.multiple ? suboption : subkey %}
<option {% if subkey == value or (field.multiple and selected in value) %}selected="selected"{% endif %} value="{{ suboption }}">
{{ suboption|t|raw }}
</option>
{% endfor %}
{% set optgroup_label = item_value|keys|first %}
<optgroup label="{{ optgroup_label }}">
{% for subkey, suboption in field.options[key][optgroup_label] %}
{% set selected = field.selectize ? suboption : subkey %}
{% set item_value = field.selectize and field.multiple ? suboption : subkey %}
<option {% if subkey == value or (field.multiple and selected in value) %}selected="selected"{% endif %} value="{{ suboption }}">
{{ suboption|t|raw }}
</option>
{% endfor %}
</optgroup>
{% else %}
{% set selected = field.selectize ? item_value : key %}
@@ -1,42 +1,2 @@
{% extends "forms/field.html.twig" %}
{% block global_attributes %}
data-grav-selectize="{{ (field.selectize is defined ? field.selectize : {})|json_encode()|e('html_attr') }}"
{{ parent() }}
{% endblock %}
{% block input %}
<div class="{{ form_field_wrapper_classes ?: 'form-select-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<select name="{{ (scope ~ field.name)|fieldName ~ (field.multiple ? '[]' : '') }}"
class="{{ form_field_select_classes }} {{ field.classes }}"
{% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled %}disabled="disabled"{% endif %}
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.multiple in ['on', 'true', 1] %}multiple="multiple"{% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if field.form %}form="{{ field.form }}"{% endif %}
{% if field.key %}
data-key-observe="{{ (scope ~ field.name)|fieldName }}"
{% endif %}
>
{% if field.placeholder %}<option value="" disabled selected>{{ field.placeholder|t|raw }}</option>{% endif %}
{% for key, optgroup in field.options %}
{% set optgroup_label = optgroup|keys|first %}
<optgroup label="{{ optgroup_label }}">
{%for subkey, suboption in field.options[key][optgroup_label] %}
{% set selected = field.selectize ? suboption : subkey %}
{% set item_value = field.selectize and field.multiple ? suboption : subkey %}
<option {% if subkey == value or (field.multiple and selected in value) %}selected="selected"{% endif %} value="{{ suboption }}">
{{ suboption|t|raw }}
</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>
</div>
{% endblock %}
{# Deprecated Form 4.0: Just use `select` field #}
{% extends "forms/fields/select/select.html.twig" %}
@@ -15,11 +15,11 @@
{% set tabs = tabs|merge([tab]) %}
{% endif %}
{% endfor %}
{% set count = tabs|count %}
{% set count = tabs|length %}
{% if count == 0 %}
{# Nothing to display #}
{% elseif count == 1 %}
{% elseif count == 1 and not admin %}
{% for field in (tabs|first).fields %}
{% if field.type %}
{% set value = field.name ? (form ? form.value(field.name) : data.value(field.name)) : data.toArray %}
@@ -52,10 +52,10 @@
</div>
<div class="tabs-content">
{% embed 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %}
{% block field_open %}
{% block inner_markup_field_open %}
<div id="tab-{{ tabsKey ~ loop.index }}" class="tab__content {{ (storedTab == scope ~ field.name) or active == loop.index ? 'active' : '' }}">
{% endblock %}
{% block field_close %}
{% block inner_markup_field_close %}
</div>
{% endblock %}
{% endembed %}
@@ -1,3 +1,7 @@
{% if field.prepend or field.append or field.copy_to_clipboard %}
{% set field = field|merge({'wrapper_classes': 'form-input-addon-wrapper'}) %}
{% endif %}
{% extends "forms/field.html.twig" %}
{% block prepend %}
@@ -19,7 +23,6 @@
{% block append %}
{% if field.copy_to_clipboard %}
<div class="form-input-addon form-input-append copy-to-clipboard">
{{ dump(field.copy_to_clipboard|t|raw) }}
{% if field.copy_to_clipboard in ['0', '1'] %}
<i class="fa fa-clipboard"></i>
{% else %}
@@ -33,9 +36,4 @@
{% endif %}
{% endblock %}
{% block input %}
{% if field.prepend or field.append or field.copy_to_clipboard %}
{% set field = field|merge({'wrapper_classes': 'form-input-addon-wrapper'}) %}
{% endif %}
{{ parent() }}
{% endblock %}
@@ -17,6 +17,7 @@
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
{% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}
{% if field.validate.message %}title="{{ field.validate.message|t|e }}"{% endif %}
@@ -7,9 +7,6 @@
{% import _self as macro %}
{% set value = value ?? field.default %}
{% set value = (value is same as(false) ? 0 : value) %}
{% set has_hidden = false %}
{% for key, text in field.options %}
{% if key is empty %}
@@ -23,6 +20,12 @@
{% endblock %}
{% block input %}
{% set value = (value is same as(false) ? 0 : value) %}
{% if field.force_bool and get_type(value) == 'string'%}
{% set value = true %}
{% endif %}
<div class="switch-toggle switch-grav {{ field.size }} switch-{{ field.options|length }} {{ field.classes }}">
{% set maxLen = 0 %}
@@ -55,6 +58,7 @@
{% endif %}
{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
/>
<label for="{{ id }}">{{ (macro.spanToggle(translation, maxLen)|trim)|raw }}</label>
{% endfor %}
@@ -1 +1 @@
<a href="{{ url(value) }}" target="_blank"><i class="fa fa-link"></i>{{ value|e }}</a>
<a href="{{ url(value) }}" target="_blank"><i class="fa fa-link"></i> {{ value|e }}</a>