diff --git a/resources/views/admin/log.twig b/resources/views/admin/log.twig index e7bc240c..1c0a28d7 100644 --- a/resources/views/admin/log.twig +++ b/resources/views/admin/log.twig @@ -14,7 +14,10 @@
{{ csrf() }} - {{ f.input('search', __('form.search'), 'text', {'value': search, 'hide_label': true}) }} + {{ f.input('search', __('form.search'), { + 'value': search, + 'hide_label': true, + }) }} {{ f.submit(__('form.search')) }}
diff --git a/resources/views/admin/rooms/edit.twig b/resources/views/admin/rooms/edit.twig index 43df6d23..ec35b6ea 100644 --- a/resources/views/admin/rooms/edit.twig +++ b/resources/views/admin/rooms/edit.twig @@ -11,26 +11,26 @@
- {{ f.input( - 'name', - __('room.name'), - null, - {'required': true, 'entry_required_icon': true, 'value': f.formData('room', room ? room.name : '')} - ) }} + {{ f.input('name', __('room.name'), { + 'required': true, + 'required_icon': true, + 'value': f.formData('room', room ? room.name : ''), + }) }} - {{ f.input('dect', __('room.dect'), null, {'value': f.formData('dect', room ? room.dect : '')}) }} - {{ f.input( - 'map_url', - __('room.map_url'), - 'url', - {'value': f.formData('map_url', room ? room.map_url : ''), 'info': __('room.map_url.info')} - ) }} + {{ f.input('dect', __('room.dect'), { + 'value': f.formData('dect', room ? room.dect : ''), + }) }} + {{ f.input('map_url', __('room.map_url'), { + 'type': 'url', + 'value': f.formData('map_url', room ? room.map_url : ''), + 'info': __('room.map_url.info'), + }) }} - {{ f.textarea( - 'description', - __('room.description'), - {'value': f.formData('description', room ? room.description : ''), 'rows': 5, 'info': __('form.markdown')} - ) }} + {{ f.textarea('description', __('room.description'), { + 'value': f.formData('description', room ? room.description : ''), + 'rows': 5, + 'info': __('form.markdown') + }) }}
@@ -41,11 +41,11 @@ {% set needed = needed_angel_types ? needed_angel_types.where('angel_type_id', angel_type.id).first() : null %} {% set name = 'angel_type_' ~ angel_type.id %}
- {{ f.number( - name, - angel_type.name, - {'value': f.formData(name, needed ? needed.count : 0), 'min': 0, 'step': 1} - ) }} + {{ f.number(name, angel_type.name, { + 'value': f.formData(name, needed ? needed.count : 0), + 'min': 0, + 'step': 1, + }) }}
{% endfor %}
diff --git a/resources/views/admin/schedule/edit.twig b/resources/views/admin/schedule/edit.twig index 335b34e9..00485573 100644 --- a/resources/views/admin/schedule/edit.twig +++ b/resources/views/admin/schedule/edit.twig @@ -15,13 +15,30 @@ {{ csrf() }}
- {{ f.input('name', __('schedule.name'), null, {'required': true, 'value': schedule ? schedule.name : ''}) }} - {{ f.input('url', __('schedule.url'), 'url', {'required': true, 'value': schedule ? schedule.url : ''}) }} + {{ f.input('name', __('schedule.name'), { + 'required': true, + 'value': schedule ? schedule.name : '', + }) }} + {{ f.input('url', __('schedule.url'), { + 'type': 'url', + 'required': true, + 'value': schedule ? schedule.url : '' + }) }} - {{ f.select('shift_type', shift_types|default([]), __('schedule.shift-type'), schedule ? schedule.shift_type : '') }} + {{ f.select('shift_type', __('schedule.shift-type'), shift_types|default([]), { + 'selected': schedule ? schedule.shift_type : '', + }) }} - {{ f.input('minutes_before', __('schedule.minutes-before'), 'number', {'required': true, 'value': schedule ? schedule.minutes_before : 15}) }} - {{ f.input('minutes_after', __('schedule.minutes-after'), 'number', {'required': true, 'value': schedule ? schedule.minutes_after : 15}) }} + {{ f.input('minutes_before', __('schedule.minutes-before'), { + 'type': 'number', + 'required': true, + 'value': schedule ? schedule.minutes_before : 15 + }) }} + {{ f.input('minutes_after', __('schedule.minutes-after'), { + 'type': 'number', + 'required': true, + 'value': schedule ? schedule.minutes_after : 15 + }) }} {{ f.submit(__('form.save')) }}
diff --git a/resources/views/admin/user/edit-shirt.twig b/resources/views/admin/user/edit-shirt.twig index 85ced8d3..37705b01 100644 --- a/resources/views/admin/user/edit-shirt.twig +++ b/resources/views/admin/user/edit-shirt.twig @@ -18,19 +18,31 @@
{% if is_tshirt %}
- {{ f.select('shirt_size', config('tshirt_sizes'), __('user.shirt_size'), userdata.personalData.shirt_size) }} + {{ f.select('shirt_size', __('user.shirt_size'), config('tshirt_sizes'), { + 'selected': userdata.personalData.shirt_size, + }) }}
{% endif %}
- {{ f.switch('arrived', __('user.arrived'), userdata.state.arrived, {'disabled': not has_permission_to('admin_arrive')}) }} + {{ f.switch('arrived', __('user.arrived'), { + 'checked': userdata.state.arrived, + 'disabled': not has_permission_to('admin_arrive'), + }) }} {% if userdata.state.force_active %} - {{ f.switch('force_active', __('user.force_active'), true, {'disabled': true}) }} + {{ f.switch('force_active', __('user.force_active'), { + 'checked': true, + 'disabled': true, + }) }} {% endif %} - {{ f.switch('active', __('user.active'), userdata.state.active) }} + {{ f.switch('active', __('user.active'), { + 'checked': userdata.state.active, + }) }} - {{ f.switch('got_shirt', is_tshirt ? __('user.got_shirt') : __('user.got_goodie'), userdata.state.got_shirt) }} + {{ f.switch('got_shirt', is_tshirt ? __('user.got_shirt') : __('user.got_goodie'), { + 'checked': userdata.state.got_shirt, + }) }}
{{ f.submit(__('form.save')) }} diff --git a/resources/views/admin/user/edit-worklog.twig b/resources/views/admin/user/edit-worklog.twig index 65239924..1eebf209 100644 --- a/resources/views/admin/user/edit-worklog.twig +++ b/resources/views/admin/user/edit-worklog.twig @@ -23,24 +23,23 @@ {{ m.user(user, {'pronoun': true}) }}
- {{ f.input( - 'work_date', - __('worklog.date'), - 'date', - {'value': work_date.format('Y-m-d'), 'required': true} - ) }} - {{ f.input( - 'work_hours', - __('worklog.hours'), - 'number', - {'value': work_hours, 'required': true, 'step': '0.01', 'min': 0} - ) }} - {{ f.input( - 'comment', - __('worklog.comment'), - 'text', - {'value': comment, 'required': true, 'max_length': 200} - ) }} + {{ f.input('work_date', __('worklog.date'), { + 'type': 'date', + 'value': work_date.format('Y-m-d'), + 'required': true, + }) }} + {{ f.input('work_hours', __('worklog.hours'), { + 'type': 'number', + 'value': work_hours, + 'required': true, + 'step': '0.01', + 'min': 0, + }) }} + {{ f.input('comment', __('worklog.comment'), { + 'value': comment, + 'required': true, + 'max_length': 200, + }) }} {{ f.submit(__('form.save')) }}
diff --git a/resources/views/macros/form.twig b/resources/views/macros/form.twig index 446edc6a..d776db02 100644 --- a/resources/views/macros/form.twig +++ b/resources/views/macros/form.twig @@ -6,12 +6,36 @@ {%- endmacro %} -{% macro input(name, label, type, opt) %} +{# +Renders an input field wrapped in a DIV with mb-3. + +@param {string} name - Will be used as value for "id" and "name" attributes. +@param {string} label - If not empty a "label" element with this text will be rendered. +@param {string} [opt.type="text"] - Optional type of the input field. Defaults to "text". +@param {bool} [opt.hide_label=false] - If true the label will be hidden. This could be useful for screenreders. + Defaults to false. +@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label + to indicate that this field is mandatory. + Won't be displayed without a label. Defaults to false. +@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip. + Won't be displayed without a label. +@param {string} [opt.value=""] - Optional value to set. Defaults to empty string. +@param {int} [opt.min_length] - Optional "minlength" attribute value. +@param {int} [opt.max_length] - Optional "maxlength" attribute value. +@param {int|float|string} [opt.min] - Optional "min" attribute value. +@param {int|float|string} [opt.max] - Optional "max" attribute value. +@param {int|float} [opt.step] - Optional "step" attribute value. +@param {string} [opt.autocomplete] - Optional "autocomplete" attribute value. +@param {bool} [opt.required=false] - Whether to add the "required" attribute. Defaults to false. +@param {bool} [opt.disabled=false] - Whether to add the "disabled" attribute. Defaults to false. +@param {bool} [opt.readonly=false] - Whether to add the "readonly" attribute. Defaults to false. +#} +{% macro input(name, label, opt) %}
{% if label -%} {%- endif %} {%- endmacro %} +{# +Renders a "number" type input field wrapped in a DIV with mb-3. +Also adds buttons to increment / decrement the value. + +@param {string} name - Will be used as value for "id" and "name" attributes. +@param {string} label - If not empty a "label" element with this text will be rendered. +@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label + to indicate that this field is mandatory. + Won't be displayed without a label. Defaults to false. +@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip. + Won't be displayed without a label. +@param {string} [opt.value=""] - Optional value to set. Defaults to empty string. +@param {int|float|string} [opt.min] - Optional "min" attribute value. +@param {int|float|string} [opt.max] - Optional "max" attribute value. +@param {int|float} [opt.step] - Optional "step" attribute value. +@param {bool} [opt.required=false] - Whether to add the "required" attribute. Defaults to false. +@param {bool} [opt.disabled=false] - Whether to add the "disabled" attribute. Defaults to false. +@param {bool} [opt.readonly=false] - Whether to add the "readonly" attribute. Defaults to false. +#} {% macro number(name, label, opt) %}
- {% if label -%} + {% if label is defined -%} - {% if opt.entry_required_icon|default(false) %} + {% if opt.required_icon|default(false) %} {{ _self.entry_required() }} {% endif %} {% if opt.info is defined %} @@ -84,11 +127,24 @@
{% endmacro %} +{# +Renders a "textarea" element wrapped in a DIV with mb-3. +Also adds buttons to increment / decrement the value. + +@param {string} name - Will be used as value for "id" and "name" attributes. +@param {string} label - If not empty a "label" element with this text will be rendered. +@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label + to indicate that this field is mandatory. + Won't be displayed without a label. Defaults to false. +@param {bool} [opt.required] - Whether to add the "required" attribute. Defaults to false. +@param {int} [opt.rows=0] - Optional value of the "rows" attriute. Defaults to 0. +@param {string} [opt.value=""] - Optional value to set. Defaults to empty string. +#} {% macro textarea(name, label, opt) %}
- {% if label -%} + {% if label is defined -%} - {% if opt.entry_required_icon|default(false) %} + {% if opt.required_icon|default(false) %} {{ _self.entry_required() }} {% endif %} {% if opt.info is defined %} @@ -106,12 +162,28 @@
{%- endmacro %} -{% macro select(name, data, label, selected, opt) %} +{# +Renders a select element wrapped in a DIV with mb-3. + +@param {string} name - Will be used as value for "id" and "name" attributes. +@param {string} label - If not empty a "label" element with this text will be rendered. +@param {{value, description}} data - Select options. "value" will be the option value, "description" the label. +@param {string} [opt.selected] - Optional value of an option to initially set as "selected". +@param {bool} [opt.required_icon=false] - Whether an asterisk should be displayed after the label + to indicate that this field is mandatory. + Won't be displayed without a label. Defaults to false. +@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip. + Won't be displayed without a label. +@param {string} [opt.class] - Optional additional CSS classes to be added to the actual "select" element. +@param {bool} [opt.required=false] - Whether to add the "required" attribute. Defaults to false. +@param {bool} [opt.default_option] - If set a default option with the param as label and an empty value will be added. +#} +{% macro select(name, label, data, opt) %}
- {% if label -%} + {% if label is defined -%}
{%- endmacro %} -{% macro checkbox(name, label, checked, value, disabled, raw_label, opt) %} +{# +Renders a Bootstrap checkbox element with mb-3. + +@param {string} name - Will be used as value for "id" and "name" attributes. +@param {string} label - Checkbox label +@param {string} [opt.value="1"] - Optional value to set. Defaults to "1". +@param {bool} [opt.checked=false] - Whether to add the "checked" attribute. Defaults to false. +@param {bool} [opt.disabled=false] - Whether to add the "disabled" attribute. Defaults to false. +@param {bool} [opt.raw_label=false] - Whether to use the raw label value (=do not escape). Defaults to false. +@param {string} [opt.info] - If set an additional info icon will be added to the label with the text as tooltip. +#} +{% macro checkbox(name, label, opt) %}
{%- endmacro %} +{# +Renders a "hidden" type input field. + +@param {string} name - Will be used as value for "id" and "name" attributes. +@param {string} value - Field value +#} {% macro hidden(name, value) %} {%- endmacro %} +{# +Renders a button. + +@param {string} label - Button label +@param {string} [opt.btn_type="secondary"] - Bootstrap button type. Defaults to "secondary". +@param {string} [opt.size] - Optional Bootstrap button size to apply, such as "sm", "lg". +@param {string} [opt.type] - Optional value for the "type" attribute. +@param {string} [opt.name] - Optional value for the "name" attribute. +@param {string} [opt.title] - Optional value for the "title" attribute. +@param {string} [opt.value] - Optional value for the "value" attribute. + Defaults to "1" if only opt.name is provided. +@param {string} [opt.icon_left] - Optional icon to be added before the button label. + Must be a Bootstrap icon class without prefix, such as "info" or "check". +@param {string} [opt.icon_right] - Optional icon to be added after the button label. + Must be a Bootstrap icon class without prefix, such as "info" or "check". +#} {% macro button(label, opt) %}
+
+ {{ f.checkbox('form-input-checkbox-disabled', 'Disabled', { + 'disabled': true, + }) }} + {{ f.checkbox('form-input-checkbox-raw-label', 'Raw label', { + 'raw_label': true, + }) }}
+ +
+
Switch
+ f.switch(id, label, opt) + {{ f.switch('form-switch', 'Switch') }} + {{ f.switch('form-switch-checked', 'Switch (checked)', { + 'checked': true, + }) }} + {{ f.switch('form-switch-disabled', 'Switch (disabled)', { + 'disabled': true, + }) }} +
+ +
+
Hidden
+ hidden(name, value) +

+ {{ f.hidden('hidden-name', 'hidden value') | escape }} +

+
+
- Radio
+
Radio
@@ -285,19 +409,21 @@
- -
+
- - -
-
- - -
-
- - +
Date / time
+
+ + +
+
+ + +
+
+ + +
@@ -380,52 +506,6 @@ -

form.twig

-
-
-

input(name, label, type, opt)

-

{{ f.input('input-name', 'Label', 'text', {'required': true, 'value': 'Value'}) }}

-
- -
-

textarea(name, label, opt)

-

{{ f.textarea('textarea-name', 'Label', {'required': true, 'rows': 2, 'value': lipsum}) }}

-
- -
-

select(name, data, label, selected)

-

{{ f.select('select-name', {'foo': 'Foo', 'bar': 'Bar'}, 'Label', 'bar') }}

-
- -
-

checkbox(name, label, checked, value)

-

- {{ f.checkbox('checkbox-name', 'Label', false) }}
- {{ f.checkbox('checkbox-name', 'Label', true, 'on') }} -

-
-
-

hidden(name, value)

-

- {{ f.hidden('hidden-name', 'hidden value') | escape }} -

-
- -
-

button(label, opt)

-

- {{ f.button('Label', {'name': 'button-name', 'value': 'buton-value'}) }} -

-
- -
-

submit(label, opt)

-

- {{ f.submit() }} -

-
-
-

Bar Chart {{ m.icon('link') }}

{{ bar_chart | raw }} diff --git a/resources/views/pages/faq/edit.twig b/resources/views/pages/faq/edit.twig index d93ea2f3..b4f61c0e 100644 --- a/resources/views/pages/faq/edit.twig +++ b/resources/views/pages/faq/edit.twig @@ -31,10 +31,17 @@
- {{ f.input('question', __('faq.question'), null, {'required': true, 'value': faq ? faq.question : ''}) }} + {{ f.input('question', __('faq.question'), { + 'required': true, + 'value': faq ? faq.question : '', + }) }}
- {{ f.textarea('text', __('faq.message'), {'required': true, 'rows': 10, 'value': faq ? faq.text : ''}) }} + {{ f.textarea('text', __('faq.message'), { + 'required': true, + 'rows': 10, + 'value': faq ? faq.text : '', + }) }} {{ f.submit() }} diff --git a/resources/views/pages/faq/overview.twig b/resources/views/pages/faq/overview.twig index f1ffe7d6..7d3686b0 100644 --- a/resources/views/pages/faq/overview.twig +++ b/resources/views/pages/faq/overview.twig @@ -71,7 +71,10 @@ {{ csrf() }}

{{ __('question.add') }}

- {{ f.textarea('text', __('question.question'), {'required': true, 'rows': 5}) }} + {{ f.textarea('text', __('question.question'), { + 'required': true, + 'rows': 5, + }) }} {{ f.submit() }}
diff --git a/resources/views/pages/messages/overview.twig b/resources/views/pages/messages/overview.twig index f11c9d94..d12caaf6 100644 --- a/resources/views/pages/messages/overview.twig +++ b/resources/views/pages/messages/overview.twig @@ -15,8 +15,11 @@ {{ csrf() }}
- {{ f.select('user_id', users, null, null, - { 'class': 'pe-5', 'required': true, 'default_option': __('message.choose_angel') }) }} + {{ f.select('user_id', null, users, { + 'class': 'pe-5', + 'required': true, + 'default_option': __('message.choose_angel'), + }) }}
{{ f.submit(__('message.to_conversation'), {'btn_type': 'secondary'}) }} diff --git a/resources/views/pages/news/edit.twig b/resources/views/pages/news/edit.twig index 3ca73e7a..e7e50809 100644 --- a/resources/views/pages/news/edit.twig +++ b/resources/views/pages/news/edit.twig @@ -36,20 +36,34 @@ {{ f.input( 'title', __('news.edit.subject'), - null, - {'required': true, 'value': news ? news.title : ''} + { + 'required': true, + 'value': news ? news.title : '', + } ) }}
- {{ f.checkbox('is_meeting', __('news.edit.is_meeting'), is_meeting) }} - {{ f.checkbox('is_pinned', __('news.edit.is_pinned'), is_pinned) }} - {% if has_permission_to('news.important') %} {{ f.checkbox('is_important', __('news.edit.is_important'), is_important) }}{% endif %} + {{ f.checkbox('is_meeting', __('news.edit.is_meeting'), { + 'checked': is_meeting, + }) }} + {{ f.checkbox('is_pinned', __('news.edit.is_pinned'), { + 'checked': is_pinned, + }) }} + {% if has_permission_to('news.important') %} + {{ f.checkbox('is_important', __('news.edit.is_important'), { + 'checked': is_important, + }) }} + {% endif %}
- {{ f.textarea('text', __('news.edit.message'), {'required': true, 'rows': 10, 'value': news ? news.text : ''}) }} + {{ f.textarea('text', __('news.edit.message'), { + 'required': true, + 'rows': 10, + 'value': news ? news.text : '', + }) }}

{{ m.info(__('news.edit.hint')) }}

diff --git a/resources/views/pages/news/news.twig b/resources/views/pages/news/news.twig index f604deaa..b0215573 100644 --- a/resources/views/pages/news/news.twig +++ b/resources/views/pages/news/news.twig @@ -47,7 +47,9 @@
{{ csrf() }} - {{ f.textarea('comment', __('news.comments.message'), {'required': true}) }} + {{ f.textarea('comment', __('news.comments.message'), { + 'required': true, + }) }} {{ f.submit() }}
diff --git a/resources/views/pages/password/reset-form.twig b/resources/views/pages/password/reset-form.twig index 76ab2582..fc799157 100644 --- a/resources/views/pages/password/reset-form.twig +++ b/resources/views/pages/password/reset-form.twig @@ -7,8 +7,16 @@
{{ csrf() }} - {{ f.input('password', __('Password'), 'password', {'min_length': min_length, 'required': true}) }} - {{ f.input('password_confirmation', __('Confirm password'), 'password', {'min_length': min_length, 'required': true}) }} + {{ f.input('password', __('Password'), { + 'type': 'password', + 'min_length': min_length, + 'required': true, + }) }} + {{ f.input('password_confirmation', __('Confirm password'), { + 'type': 'password', + 'min_length': min_length, + 'required': true, + }) }} {{ f.submit(__('Save')) }}
diff --git a/resources/views/pages/password/reset.twig b/resources/views/pages/password/reset.twig index ce7b5e28..86dc9b63 100644 --- a/resources/views/pages/password/reset.twig +++ b/resources/views/pages/password/reset.twig @@ -17,7 +17,10 @@ {{ csrf() }} {{ __('We will send you an e-mail with a password recovery link. Please use the email address you used for registration.') }} - {{ f.input('email', __('E-Mail'), 'email', {'required': true}) }} + {{ f.input('email', __('E-Mail'), { + 'type': 'email', + 'required': true, + }) }} {{ f.submit(__('Recover')) }} diff --git a/resources/views/pages/questions/edit.twig b/resources/views/pages/questions/edit.twig index c286497a..ea442cb5 100644 --- a/resources/views/pages/questions/edit.twig +++ b/resources/views/pages/questions/edit.twig @@ -31,11 +31,18 @@
- {{ f.textarea('text', __('question.question'), {'required': true, 'rows': 10, 'value': question ? question.text : ''}) }} + {{ f.textarea('text', __('question.question'), { + 'required': true, + 'rows': 10, + 'value': question ? question.text : '', + }) }}
{% if is_admin|default(false) %} - {{ f.textarea('answer', __('question.answer'), {'required': true, 'rows': 10, 'value': question ? question.answer : ''}) }} + {{ f.textarea('answer', __('question.answer'), { + 'required': true, + 'rows': 10, 'value': question ? question.answer : '', + }) }} {% endif %} {{ f.submit() }} diff --git a/resources/views/pages/settings/language.twig b/resources/views/pages/settings/language.twig index e817b634..b6b086cd 100644 --- a/resources/views/pages/settings/language.twig +++ b/resources/views/pages/settings/language.twig @@ -11,7 +11,9 @@
{{ m.info(__('settings.language.info')) }} - {{ f.select('select_language', languages, __('settings.language'), current_language) }} + {{ f.select('select_language', __('settings.language'), languages, { + 'selected': current_language, + }) }} {{ f.submit(__('form.save')) }}
diff --git a/resources/views/pages/settings/password.twig b/resources/views/pages/settings/password.twig index 5e4a70f0..833742e1 100644 --- a/resources/views/pages/settings/password.twig +++ b/resources/views/pages/settings/password.twig @@ -13,25 +13,24 @@ {{ m.info(__('settings.password.info')) }} {% if user.password %} - {{ f.input( - 'password', - __('settings.password.password'), - 'password', - {'required': true, 'autocomplete': 'current-password'} - ) }} + {{ f.input('password', __('settings.password.password'), { + 'type': 'password', + 'required': true, + 'autocomplete': 'current-password', + }) }} {% endif %} - {{ f.input( - 'new_password', - __('settings.password.new_password'), - 'password', - {'min_length': min_length, 'required': true, 'autocomplete': 'new-password'} - ) }} - {{ f.input( - 'new_password2', - __('settings.password.new_password2'), - 'password', - {'min_length': min_length, 'required': true, 'autocomplete': 'new-password'} - ) }} + {{ f.input('new_password', __('settings.password.new_password'), { + 'type': 'password', + 'min_length': min_length, + 'required': true, + 'autocomplete': 'new-password', + }) }} + {{ f.input('new_password2', __('settings.password.new_password2'), { + 'type': 'password', + 'min_length': min_length, + 'required': true, + 'autocomplete': 'new-password', + }) }} {{ f.submit(__('form.save')) }}
diff --git a/resources/views/pages/settings/profile.twig b/resources/views/pages/settings/profile.twig index 8e9d0e4c..83f7b470 100644 --- a/resources/views/pages/settings/profile.twig +++ b/resources/views/pages/settings/profile.twig @@ -18,21 +18,17 @@
- {{ f.input( - 'nick', - __('settings.profile.nick'), - 'text', - {'value': user.name, 'disabled': true} - ) }} + {{ f.input('nick', __('settings.profile.nick'), { + 'value': user.name, + 'disabled': true, + }) }}
{% if config('enable_pronoun') %}
- {{ f.input( - 'pronoun', - __('settings.profile.pronoun'), - 'text', - {'value': user.personalData.pronoun ,'max_length': 15} - ) }} + {{ f.input('pronoun', __('settings.profile.pronoun'), { + 'value': user.personalData.pronoun, + 'max_length': 15, + }) }} {{ m.info(__('settings.profile.pronoun.info')) }}
{% endif %} @@ -41,20 +37,16 @@ {% if config('enable_user_name') %}
- {{ f.input( - 'first_name', - __('settings.profile.firstname'), - 'text', - {'value': user.personalData.first_name, 'max_length': 64} - ) }} + {{ f.input('first_name', __('settings.profile.firstname'), { + 'value': user.personalData.first_name, + 'max_length': 64, + }) }}
- {{ f.input( - 'last_name', - __('settings.profile.lastname'), - 'text', - {'value': user.personalData.last_name, 'max_length': 64} - ) }} + {{ f.input('last_name', __('settings.profile.lastname'), { + 'value': user.personalData.last_name, + 'max_length': 64, + }) }}
{% endif %} @@ -62,31 +54,23 @@ {% if config('enable_planned_arrival') %}
- {{ f.input( - 'planned_arrival_date', - __('settings.profile.planned_arrival_date'), - 'date', - { - 'value': user.personalData.planned_arrival_date.format('Y-m-d'), - 'required': true, - 'entry_required_icon': true, - 'min': config('buildup_start') ? config('buildup_start').format('Y-m-d') : '', - 'max': config('teardown_end') ? config('teardown_end').format('Y-m-d') : '', - } - ) }} + {{ f.input('planned_arrival_date', __('settings.profile.planned_arrival_date'), { + 'type': 'date', + 'value': user.personalData.planned_arrival_date.format('Y-m-d'), + 'required': true, + 'required_icon': true, + 'min': config('buildup_start') ? config('buildup_start').format('Y-m-d') : '', + 'max': config('teardown_end') ? config('teardown_end').format('Y-m-d') : '', + }) }}
{% set planned_departure_date = user.personalData.planned_departure_date %} - {{ f.input( - 'planned_departure_date', - __('settings.profile.planned_departure_date'), - 'date', - { - 'value': planned_departure_date ? planned_departure_date.format('Y-m-d') : '', - 'min': config('buildup_start') ? config('buildup_start').format('Y-m-d') : '', - 'max': config('teardown_end') ? config('teardown_end').format('Y-m-d') : '', - } - ) }} + {{ f.input('planned_departure_date', __('settings.profile.planned_departure_date'), { + 'type': 'date', + 'value': planned_departure_date ? planned_departure_date.format('Y-m-d') : '', + 'min': config('buildup_start') ? config('buildup_start').format('Y-m-d') : '', + 'max': config('teardown_end') ? config('teardown_end').format('Y-m-d') : '', + }) }}
{% endif %} @@ -94,75 +78,60 @@
{% if config('enable_dect') %}
- {{ f.input( - 'dect', - __('settings.profile.dect'), - 'text', - {'value': user.contact.dect, 'max_length': 40} - ) }} + {{ f.input('dect', __('settings.profile.dect'), { + 'value': user.contact.dect, + 'max_length': 40, + }) }}
{% endif %}
- {{ f.input( - 'mobile', - __('settings.profile.mobile'), - 'text', - {'value': user.contact.mobile, 'max_length': 40} - ) }} + {{ f.input('mobile', __('settings.profile.mobile'), { + 'value': user.contact.mobile, + 'max_length': 40, + }) }} {% if config('enable_mobile_show') %} - {{ f.checkbox( - 'mobile_show', - __('settings.profile.mobile_show'), - user.settings.mobile_show - ) }} + {{ f.checkbox('mobile_show', __('settings.profile.mobile_show'), { + 'checked': user.settings.mobile_show, + }) }} {% endif %}
- {{ f.input( - 'email', - __('settings.profile.email'), - 'email', - {'value': user.email, 'max_length': 254, 'required': true, 'entry_required_icon': true} - ) }} + {{ f.input('email', __('settings.profile.email'), { + 'type': 'email', + 'value': user.email, + 'max_length': 254, + 'required': true, + 'required_icon': true, + }) }}
- {{ f.checkbox( - 'email_shiftinfo', - __('settings.profile.email_shiftinfo', [config('app_name')]), - user.settings.email_shiftinfo - ) }} - {{ f.checkbox( - 'email_news', - __('settings.profile.email_news'), - user.settings.email_news - ) }} - {{ f.checkbox( - 'email_messages', - __('settings.profile.email_messages'), - user.settings.email_messages - ) }} - {{ f.checkbox( - 'email_human', - __('settings.profile.email_by_human_allowed'), - user.settings.email_human - ) }} + {{ f.checkbox('email_shiftinfo', __('settings.profile.email_shiftinfo'), { + 'checked': [config('app_name')], + 'value': user.settings.email_shiftinfo, + }) }} + {{ f.checkbox('email_news', __('settings.profile.email_news'), { + 'checked': user.settings.email_news, + }) }} + {{ f.checkbox('email_messages', __('settings.profile.email_messages'), { + 'checked': user.settings.email_messages, + }) }} + {{ f.checkbox('email_human', __('settings.profile.email_by_human_allowed'), { + 'checked': user.settings.email_human, + }) }} {% if goodie_enabled %} {% set privacy_email = config('privacy_email') %} {% set email_goody_label = __('settings.profile.email_goody') ~ (privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '') %} - {{ f.checkbox( - 'email_goody', - email_goody_label, - user.settings.email_goody, - user.settings.email_goody, - false, - true - ) }} + {{ f.checkbox('email_goody', email_goody_label, { + 'checked': user.settings.email_goody, + 'value': user.settings.email_goody, + 'raw_label': true, + }) }} {% endif %}
@@ -170,13 +139,11 @@
{% if goodie_tshirt %}
- {{ f.select( - 'shirt_size', - config('tshirt_sizes'), - __('settings.profile.shirt_size'), - user.personalData.shirt_size, - {'required': true, 'entry_required_icon': true} - ) }} + {{ f.select('shirt_size', __('settings.profile.shirt_size'), config('tshirt_sizes'), { + 'selected': user.personalData.shirt_size, + 'required': true, + 'required_icon': true, + }) }}
{% endif %} diff --git a/resources/views/pages/settings/theme.twig b/resources/views/pages/settings/theme.twig index 37e0bce9..6ffaa9ab 100644 --- a/resources/views/pages/settings/theme.twig +++ b/resources/views/pages/settings/theme.twig @@ -11,7 +11,9 @@
{{ m.info(__('settings.theme.info')) }} - {{ f.select('select_theme', themes, __('settings.theme'), current_theme) }} + {{ f.select('select_theme', __('settings.theme'), themes, { + 'selected': current_theme, + }) }} {{ f.submit(__('form.save')) }}