m.button with opt

This commit is contained in:
Xu 2024-05-21 19:05:33 +02:00 committed by Igor Scheller
parent 6f8dad070c
commit b380d7e68e
19 changed files with 37 additions and 43 deletions

View File

@ -10,13 +10,13 @@
{% if not is_index|default(false) %} {% if not is_index|default(false) %}
{{ m.button(m.icon('chevron-left'), location {{ m.button(m.icon('chevron-left'), location
? url('/locations', {'action': 'view', 'location_id': location.id}) ? url('/locations', {'action': 'view', 'location_id': location.id})
: url('/admin/locations'), 'secondary', 'sm', __('general.back')) }} : url('/admin/locations'), {'size':'sm', 'title':__('general.back')}) }}
{% endif %} {% endif %}
{{ block('title') }} {{ block('title') }}
{% if is_index|default(false) %} {% 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 %} {% endif %}
</h1> </h1>
@ -57,7 +57,7 @@
<td> <td>
<div class="d-flex ms-auto"> <div class="d-flex ms-auto">
{{ 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')}) }}
<form method="post" class="ps-1"> <form method="post" class="ps-1">
{{ csrf() }} {{ csrf() }}

View File

@ -5,7 +5,7 @@
{% block title %}{{ schedule ? __('schedule.edit.title') : __('schedule.import.title') }}{% endblock %} {% block title %}{{ schedule ? __('schedule.edit.title') : __('schedule.import.title') }}{% endblock %}
{% block content_title %} {% 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') }} {{ block('title') }}
{% endblock %} {% endblock %}

View File

@ -10,7 +10,7 @@
{% block content_title %}{{ block('title') }}{% endblock %} {% block content_title %}{{ block('title') }}{% endblock %}
{% if is_index|default(false) %} {% 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 %} {% endif %}
</h1> </h1>
@ -40,8 +40,8 @@
<form method="post" action="{{ url('/admin/schedule/edit/' ~ schedule.id) }}"> <form method="post" action="{{ url('/admin/schedule/edit/' ~ schedule.id) }}">
{{ csrf() }} {{ csrf() }}
<div class="btn-group"> <div class="btn-group">
{{ m.button(m.icon('box-arrow-in-down'), url('/admin/schedule/load/' ~ schedule.id), 'secondary', 'sm', __('form.import')) }} {{ 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), 'secondary', 'sm', __('form.edit')) }} {{ m.button(m.icon('pencil'), url('/admin/schedule/edit/' ~ schedule.id), {'size': 'sm', 'title': __('form.edit')}) }}
{{ f.delete(null, { {{ f.delete(null, {
'title': __('form.delete'), 'title': __('form.delete'),
'confirm_button_text': __('form.delete'), 'confirm_button_text': __('form.delete'),

View File

@ -5,7 +5,7 @@
{% block title %}{{ __('schedule.import.load.title') }}{% endblock %} {% block title %}{{ __('schedule.import.load.title') }}{% endblock %}
{% block content_title %} {% 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') }} {{ block('title') }}
{% endblock %} {% endblock %}

View File

@ -7,7 +7,7 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h1> <h1>
{{ 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 %} {% block content_title %}{{ block('title') }}{% endblock %}
</h1> </h1>

View File

@ -8,15 +8,15 @@
<div class="container"> <div class="container">
<h1> <h1>
{% if not is_index|default(false) %} {% 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 %} {% endif %}
{{ block('title') }} {{ block('title') }}
{% if is_index|default(false) and can('shifttypes.edit') %} {% 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') %} {% 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 %} {% endif %}
</h1> </h1>
@ -45,7 +45,7 @@
<td> <td>
{% if can('shifttypes.edit') %} {% if can('shifttypes.edit') %}
<div class="d-flex ms-auto"> <div class="d-flex ms-auto">
{{ 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')}) }}
<form method="post" class="ps-1"> <form method="post" class="ps-1">
{{ csrf() }} {{ csrf() }}

View File

@ -12,12 +12,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{{ m.alert(__('worklog.delete.info', [m.user(userdata)]), 'danger', true) }} {{ m.alert(__('worklog.delete.info', [m.user(userdata)]), 'danger', true) }}
{{ m.button(__('form.cancel'), {{ m.button(__('form.cancel'), url('/users?action=view&user_id=' ~ userdata.id), {'icon_left': 'x-lg'}) }}
url('/users?action=view&user_id=' ~ userdata.id),
null,
null,
null,
'x-lg') }}
{{ f.delete(__('form.delete')) }} {{ f.delete(__('form.delete')) }}
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h1> <h1>
{{ 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') }}: <small>{{ m.user(userdata) }}</small> {{ block('title') }}: <small>{{ m.user(userdata) }}</small>
</h1> </h1>

View File

@ -7,8 +7,7 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h1> <h1>
{{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: userdata.id}), {{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: userdata.id}), {'size': 'sm', 'title': __('general.back')}) }}
null, 'sm', __('general.back')) }}
{{ block('title') }} {{ block('title') }}
</h1> </h1>

View File

@ -34,14 +34,14 @@
</a> </a>
{% endmacro %} {% endmacro %}
{% macro button(label, url, type, size, title, icon_left, icon_right) %} {% macro button(label, url, opt) %}
<a href="{{ url }}" class="btn btn-{{ type|default('secondary') }} <a href="{{ url }}" class="btn btn-{{ opt.type|default('secondary') }}
{%- if size %} btn-{{ size }}{% endif %}" {%- if opt.size is defined %} btn-{{ opt.size }}{% endif %}"
{%- if title %} title="{{ title }}"{% endif -%} {%- if opt.title is defined %} title="{{ opt.title }}"{% endif -%}
> >
{%- if icon_left %}{{ _self.icon(icon_left) }}{% endif %} {%- if opt.icon_left is defined %}{{ _self.icon(opt.icon_left) }}{% endif %}
{{ label }} {{ label }}
{%- if icon_right %}{{ _self.icon(icon_right) }}{% endif %} {%- if opt.icon_right is defined %}{{ _self.icon(opt.icon_right) }}{% endif %}
</a> </a>
{% endmacro %} {% endmacro %}

View File

@ -586,7 +586,7 @@ Por scientie, musica, sport etc, litot Europa usa li sam vocabular.</code></pre>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<h4><code>button(label, url, type, size)</code></h4> <h4><code>button(label, url, type, size)</code></h4>
<p>{{ m.button('Label', '#', 'info', 'sm') }}</p> <p>{{ m.button('Label', '#', {'type': 'info', 'size': 'sm'}) }}</p>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h1> <h1>
{{ 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') }} {{ block('title') }}
</h1> </h1>

View File

@ -10,7 +10,7 @@
{{ block('title') }} {{ block('title') }}
{%- if can('faq.edit') -%} {%- if can('faq.edit') -%}
{{ m.button(m.icon('plus-lg'), url('/admin/faq'), 'secondary') }} {{ m.button(m.icon('plus-lg'), url('/admin/faq')) }}
{%- endif %} {%- endif %}
</h1> </h1>
@ -54,7 +54,7 @@
{% if can('faq.edit') %} {% if can('faq.edit') %}
<span class="ms-auto"> <span class="ms-auto">
{{ 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')}) }}
</span> </span>
<form class="ps-1" <form class="ps-1"

View File

@ -8,7 +8,7 @@
<div class="container"> <div class="container">
<div class="page-header"> <div class="page-header">
<h1> <h1>
{{ m.button(m.icon('chevron-left'), url('/messages'), null, 'sm', __('general.back')) }} {{ m.button(m.icon('chevron-left'), url('/messages'), {'size': 'sm', 'title': __('general.back')}) }}
{{ __('message.title') }}: {{ m.user(other_user, {'pronoun': true}) }} {{ __('message.title') }}: {{ m.user(other_user, {'pronoun': true}) }}
</h1> </h1>
</div> </div>

View File

@ -7,7 +7,7 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h1> <h1>
{{ 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') }} {{ block('title') }}
</h1> </h1>

View File

@ -9,11 +9,11 @@
<div class="container"> <div class="container">
<h1> <h1>
{% if not is_overview|default(false) %} {% 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 %} {% endif %}
{{ block('title') }} {{ block('title') }}
{%- if can('admin_news') and is_overview|default(false) -%} {%- 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 %} {%- endif %}
</h1> </h1>
@ -66,7 +66,7 @@
<div class="card-body bg-body"> <div class="card-body bg-body">
{{ news.text(not is_overview)|markdown }} {{ news.text(not is_overview)|markdown }}
{% if is_overview and news.text != news.text(false) %} {% 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 %} {% endif %}
</div> </div>
@ -99,7 +99,7 @@
{% if can('admin_news') %} {% if can('admin_news') %}
<div class="d-flex ms-auto"> <div class="d-flex ms-auto">
{{ 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')}) }}
<form class="ps-1" <form class="ps-1"
action="{{ url('/admin/news/' ~ news.id) }}" enctype="multipart/form-data" action="{{ url('/admin/news/' ~ news.id) }}" enctype="multipart/form-data"

View File

@ -7,7 +7,7 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<h1> <h1>
{{ 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') }} {{ block('title') }}
</h1> </h1>

View File

@ -36,9 +36,9 @@
<h1> <h1>
{{ block('title') }} {{ block('title') }}
{% if is_admin | default(false) %} {% 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 %} {% else %}
{{ m.button(m.icon('plus-lg'), url('/questions/new'), 'secondary') }} {{ m.button(m.icon('plus-lg'), url('/questions/new')) }}
{% endif %} {% endif %}
</h1> </h1>
</div> </div>
@ -85,7 +85,7 @@
<div class="d-flex ms-auto"> <div class="d-flex ms-auto">
{% if can('question.edit') %} {% 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 %} {% endif %}
{% if question.user.id == user.id or can('question.edit') %} {% if question.user.id == user.id or can('question.edit') %}

View File

@ -9,7 +9,7 @@
<div class="mb-5"> <div class="mb-5">
<h1> <h1>
{{ can('admin_user') {{ 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') }} {{ __('registration.title') }}