From b380d7e68eb40f0490742d21f9edc755acf63c77 Mon Sep 17 00:00:00 2001 From: Xu Date: Tue, 21 May 2024 19:05:33 +0200 Subject: [PATCH] m.button with opt --- resources/views/admin/locations/index.twig | 6 +++--- resources/views/admin/schedule/edit.twig | 2 +- resources/views/admin/schedule/index.twig | 6 +++--- resources/views/admin/schedule/load.twig | 2 +- resources/views/admin/shifts/history.twig | 2 +- resources/views/admin/shifttypes/index.twig | 8 ++++---- resources/views/admin/user/delete-worklog.twig | 7 +------ resources/views/admin/user/edit-goodie.twig | 2 +- resources/views/admin/user/edit-worklog.twig | 3 +-- resources/views/macros/base.twig | 12 ++++++------ resources/views/pages/design.twig | 2 +- resources/views/pages/faq/edit.twig | 2 +- resources/views/pages/faq/overview.twig | 4 ++-- resources/views/pages/messages/conversation.twig | 2 +- resources/views/pages/news/edit.twig | 2 +- resources/views/pages/news/overview.twig | 8 ++++---- resources/views/pages/questions/edit.twig | 2 +- resources/views/pages/questions/overview.twig | 6 +++--- resources/views/pages/registration.twig | 2 +- 19 files changed, 37 insertions(+), 43 deletions(-) diff --git a/resources/views/admin/locations/index.twig b/resources/views/admin/locations/index.twig index 5c50f074..9edacb57 100644 --- a/resources/views/admin/locations/index.twig +++ b/resources/views/admin/locations/index.twig @@ -10,13 +10,13 @@ {% if not is_index|default(false) %} {{ m.button(m.icon('chevron-left'), location ? url('/locations', {'action': 'view', 'location_id': location.id}) - : url('/admin/locations'), 'secondary', 'sm', __('general.back')) }} + : url('/admin/locations'), {'size':'sm', 'title':__('general.back')}) }} {% endif %} {{ block('title') }} {% if is_index|default(false) %} - {{ m.button(m.icon('plus-lg'), url('/admin/locations/edit'), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/admin/locations/edit')) }} {% endif %} @@ -57,7 +57,7 @@
- {{ m.button(m.icon('pencil'), url('/admin/locations/edit/' ~ location.id), null, 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('/admin/locations/edit/' ~ location.id), {'size': 'sm', 'title': __('form.edit')}) }}
{{ csrf() }} diff --git a/resources/views/admin/schedule/edit.twig b/resources/views/admin/schedule/edit.twig index f30f9a4f..aab4114e 100644 --- a/resources/views/admin/schedule/edit.twig +++ b/resources/views/admin/schedule/edit.twig @@ -5,7 +5,7 @@ {% block title %}{{ schedule ? __('schedule.edit.title') : __('schedule.import.title') }}{% endblock %} {% block content_title %} - {{ m.button(m.icon('chevron-left'), url('/admin/schedule'), 'secondary', 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/admin/schedule'), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }} {% endblock %} diff --git a/resources/views/admin/schedule/index.twig b/resources/views/admin/schedule/index.twig index d19a24a8..f9e28dc8 100644 --- a/resources/views/admin/schedule/index.twig +++ b/resources/views/admin/schedule/index.twig @@ -10,7 +10,7 @@ {% block content_title %}{{ block('title') }}{% endblock %} {% if is_index|default(false) %} - {{ m.button(m.icon('plus-lg'), url('/admin/schedule/edit'), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/admin/schedule/edit')) }} {% endif %} @@ -40,8 +40,8 @@ {{ csrf() }}
- {{ m.button(m.icon('box-arrow-in-down'), url('/admin/schedule/load/' ~ schedule.id), 'secondary', 'sm', __('form.import')) }} - {{ m.button(m.icon('pencil'), url('/admin/schedule/edit/' ~ schedule.id), 'secondary', 'sm', __('form.edit')) }} + {{ m.button(m.icon('box-arrow-in-down'), url('/admin/schedule/load/' ~ schedule.id), {'size': 'sm', 'title': __('form.import')}) }} + {{ m.button(m.icon('pencil'), url('/admin/schedule/edit/' ~ schedule.id), {'size': 'sm', 'title': __('form.edit')}) }} {{ f.delete(null, { 'title': __('form.delete'), 'confirm_button_text': __('form.delete'), diff --git a/resources/views/admin/schedule/load.twig b/resources/views/admin/schedule/load.twig index 723f04e7..24058b98 100644 --- a/resources/views/admin/schedule/load.twig +++ b/resources/views/admin/schedule/load.twig @@ -5,7 +5,7 @@ {% block title %}{{ __('schedule.import.load.title') }}{% endblock %} {% block content_title %} - {{ m.button(m.icon('chevron-left'), url('/admin/schedule'), 'secondary', 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/admin/schedule'), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }} {% endblock %} diff --git a/resources/views/admin/shifts/history.twig b/resources/views/admin/shifts/history.twig index 6077458e..253eea6f 100644 --- a/resources/views/admin/shifts/history.twig +++ b/resources/views/admin/shifts/history.twig @@ -7,7 +7,7 @@ {% block content %}

- {{ m.button(m.icon('chevron-left'), url('/admin-shifts'), null, 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/admin-shifts'), {'size': 'sm', 'title': __('general.back')}) }} {% block content_title %}{{ block('title') }}{% endblock %}

diff --git a/resources/views/admin/shifttypes/index.twig b/resources/views/admin/shifttypes/index.twig index 88fb84c7..d4be61e2 100644 --- a/resources/views/admin/shifttypes/index.twig +++ b/resources/views/admin/shifttypes/index.twig @@ -8,15 +8,15 @@

{% if not is_index|default(false) %} - {{ m.button(m.icon('chevron-left'), url('/admin/shifttypes'), 'secondary', 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/admin/shifttypes'), {'size': 'sm', 'title': __('general.back')}) }} {% endif %} {{ block('title') }} {% if is_index|default(false) and can('shifttypes.edit') %} - {{ m.button(m.icon('plus-lg'), url('/admin/shifttypes/edit'), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/admin/shifttypes/edit')) }} {% elseif is_view|default(false) and can('shifttypes.edit') %} - {{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), {'size': 'sm', 'title': __('form.edit')}) }} {% endif %}

@@ -45,7 +45,7 @@ {% if can('shifttypes.edit') %}
- {{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), {'size': 'sm', 'title': __('form.edit')}) }} {{ csrf() }} diff --git a/resources/views/admin/user/delete-worklog.twig b/resources/views/admin/user/delete-worklog.twig index 086dcdf4..fba44d4e 100644 --- a/resources/views/admin/user/delete-worklog.twig +++ b/resources/views/admin/user/delete-worklog.twig @@ -12,12 +12,7 @@
{{ m.alert(__('worklog.delete.info', [m.user(userdata)]), 'danger', true) }} - {{ m.button(__('form.cancel'), - url('/users?action=view&user_id=' ~ userdata.id), - null, - null, - null, - 'x-lg') }} + {{ m.button(__('form.cancel'), url('/users?action=view&user_id=' ~ userdata.id), {'icon_left': 'x-lg'}) }} {{ f.delete(__('form.delete')) }}
diff --git a/resources/views/admin/user/edit-goodie.twig b/resources/views/admin/user/edit-goodie.twig index f4187429..99f56101 100644 --- a/resources/views/admin/user/edit-goodie.twig +++ b/resources/views/admin/user/edit-goodie.twig @@ -9,7 +9,7 @@ {% block content %}

- {{ m.button(m.icon('chevron-left'), url('/admin-active'), null, 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/admin-active'), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }}: {{ m.user(userdata) }}

diff --git a/resources/views/admin/user/edit-worklog.twig b/resources/views/admin/user/edit-worklog.twig index 000f277a..b7ac3886 100644 --- a/resources/views/admin/user/edit-worklog.twig +++ b/resources/views/admin/user/edit-worklog.twig @@ -7,8 +7,7 @@ {% block content %}

- {{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: userdata.id}), - null, 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: userdata.id}), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }}

diff --git a/resources/views/macros/base.twig b/resources/views/macros/base.twig index 883bb83d..30ca9393 100644 --- a/resources/views/macros/base.twig +++ b/resources/views/macros/base.twig @@ -34,14 +34,14 @@ {% endmacro %} -{% macro button(label, url, type, size, title, icon_left, icon_right) %} - - {%- if icon_left %}{{ _self.icon(icon_left) }}{% endif %} + {%- if opt.icon_left is defined %}{{ _self.icon(opt.icon_left) }}{% endif %} {{ label }} - {%- if icon_right %}{{ _self.icon(icon_right) }}{% endif %} + {%- if opt.icon_right is defined %}{{ _self.icon(opt.icon_right) }}{% endif %} {% endmacro %} diff --git a/resources/views/pages/design.twig b/resources/views/pages/design.twig index 55024d21..f4417f24 100644 --- a/resources/views/pages/design.twig +++ b/resources/views/pages/design.twig @@ -586,7 +586,7 @@ Por scientie, musica, sport etc, litot Europa usa li sam vocabular.

button(label, url, type, size)

-

{{ m.button('Label', '#', 'info', 'sm') }}

+

{{ m.button('Label', '#', {'type': 'info', 'size': 'sm'}) }}

diff --git a/resources/views/pages/faq/edit.twig b/resources/views/pages/faq/edit.twig index e51a6848..e415a38f 100644 --- a/resources/views/pages/faq/edit.twig +++ b/resources/views/pages/faq/edit.twig @@ -7,7 +7,7 @@ {% block content %}

- {{ m.button(m.icon('chevron-left'), url('/faq'), 'secondary', 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/faq'), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }}

diff --git a/resources/views/pages/faq/overview.twig b/resources/views/pages/faq/overview.twig index 88553502..34a4cfaf 100644 --- a/resources/views/pages/faq/overview.twig +++ b/resources/views/pages/faq/overview.twig @@ -10,7 +10,7 @@ {{ block('title') }} {%- if can('faq.edit') -%} - {{ m.button(m.icon('plus-lg'), url('/admin/faq'), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/admin/faq')) }} {%- endif %} @@ -54,7 +54,7 @@ {% if can('faq.edit') %} - {{ m.button(m.icon('pencil'), url('/admin/faq/' ~ item.id), 'secondary', 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('/admin/faq/' ~ item.id), {'size': 'sm', 'title': __('form.edit')}) }} diff --git a/resources/views/pages/news/edit.twig b/resources/views/pages/news/edit.twig index 9ddc4bf6..27b5dce2 100644 --- a/resources/views/pages/news/edit.twig +++ b/resources/views/pages/news/edit.twig @@ -7,7 +7,7 @@ {% block content %}

- {{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/news'), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }}

diff --git a/resources/views/pages/news/overview.twig b/resources/views/pages/news/overview.twig index 3b7a85c1..99ef5a49 100644 --- a/resources/views/pages/news/overview.twig +++ b/resources/views/pages/news/overview.twig @@ -9,11 +9,11 @@

{% if not is_overview|default(false) %} - {{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/news'), {'size': 'sm', 'title': __('general.back')}) }} {% endif %} {{ block('title') }} {%- if can('admin_news') and is_overview|default(false) -%} - {{ m.button(m.icon('plus-lg'), url('/admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/admin/news', only_meetings ? {'meeting': 1} : {})) }} {%- endif %}

@@ -66,7 +66,7 @@
{{ news.text(not is_overview)|markdown }} {% if is_overview and news.text != news.text(false) %} - {{ m.button(__('news.read_more'), url('/news/' ~ news.id), null, 'sm', null, null, 'chevron-double-right') }} + {{ m.button(__('news.read_more'), url('/news/' ~ news.id), {'size': 'sm', 'icon_right': 'chevron-double-right'}) }} {% endif %}
@@ -99,7 +99,7 @@ {% if can('admin_news') %}
- {{ m.button(m.icon('pencil'), url('/admin/news/' ~ news.id), 'secondary', 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('/admin/news/' ~ news.id), {'size': 'sm', 'title': __('form.edit')}) }}

- {{ m.button(m.icon('chevron-left'), url('/questions'), null, 'sm', __('general.back')) }} + {{ m.button(m.icon('chevron-left'), url('/questions'), {'size': 'sm', 'title': __('general.back')}) }} {{ block('title') }}

diff --git a/resources/views/pages/questions/overview.twig b/resources/views/pages/questions/overview.twig index 59cf25c6..75888232 100644 --- a/resources/views/pages/questions/overview.twig +++ b/resources/views/pages/questions/overview.twig @@ -36,9 +36,9 @@

{{ block('title') }} {% if is_admin | default(false) %} - {{ m.button(m.icon('question-lg'), url('/faq'), 'secondary', null, __('faq.faq')) }} + {{ m.button(m.icon('question-lg'), url('/faq'), {'title': __('faq.faq')}) }} {% else %} - {{ m.button(m.icon('plus-lg'), url('/questions/new'), 'secondary') }} + {{ m.button(m.icon('plus-lg'), url('/questions/new')) }} {% endif %}

@@ -85,7 +85,7 @@
{% if can('question.edit') %} - {{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), null, 'sm', __('form.edit')) }} + {{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), {'size': 'sm', 'title': __('form.edit')}) }} {% endif %} {% if question.user.id == user.id or can('question.edit') %} diff --git a/resources/views/pages/registration.twig b/resources/views/pages/registration.twig index 58b9bb9f..80ae185b 100644 --- a/resources/views/pages/registration.twig +++ b/resources/views/pages/registration.twig @@ -9,7 +9,7 @@

{{ can('admin_user') - ? m.button(m.icon('chevron-left'), url('/users'), null, 'sm', __('general.back')) + ? m.button(m.icon('chevron-left'), url('/users'), {'size': 'sm', 'title': __('general.back')}) : '' }} {{ __('registration.title') }}