replaced delete confirm dialog with modal (#638)
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "macros/datatables.html.twig" as tables %}
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'admin_activity.title'|trans }}{% endblock %}
|
||||
@@ -9,6 +7,8 @@
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% set inUse = (stats.recordAmount > 0) %}
|
||||
|
||||
{% set params = {
|
||||
'%activity%': '<strong>' ~ activity.name ~ '</strong>',
|
||||
'%project%': '<strong>-</strong>',
|
||||
@@ -23,9 +23,11 @@
|
||||
'%customer%': '<strong>' ~ activity.project.customer.name ~ '</strong>',
|
||||
}) %}
|
||||
{% endif %}
|
||||
{{ include('default/_form_delete.html.twig', {
|
||||
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
|
||||
'message': "admin_activity.delete_confirm"|trans(params)|raw,
|
||||
'form': form,
|
||||
'used': inUse,
|
||||
'back': path('admin_activity')
|
||||
}) }}
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
$(document).ready(function () {
|
||||
$.kimai.init({
|
||||
locale: '{{ app.request.locale }}',
|
||||
confirmDelete: '{{ 'confirm.delete'|trans }}',
|
||||
apply: '{{ 'daterangepicker.apply'|trans({}, 'daterangepicker') }}',
|
||||
cancel: '{{ 'daterangepicker.cancel'|trans({}, 'daterangepicker') }}',
|
||||
today: '{{ 'daterangepicker.today'|trans({}, 'daterangepicker') }}',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "macros/datatables.html.twig" as tables %}
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'admin_customer.title'|trans }}{% endblock %}
|
||||
@@ -9,6 +7,8 @@
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% set inUse = (stats.recordAmount > 0) %}
|
||||
|
||||
{% set params = {
|
||||
'%activity%': '<strong>' ~ stats.activityAmount ~ '</strong>',
|
||||
'%project%': '<strong>' ~ stats.projectAmount ~ '</strong>',
|
||||
@@ -17,9 +17,10 @@
|
||||
'%duration%': '<strong>' ~ stats.recordDuration|duration ~ '</strong>'
|
||||
} %}
|
||||
|
||||
{{ include('default/_form_delete.html.twig', {
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
|
||||
'message': "admin_customer.delete_confirm"|trans(params)|raw,
|
||||
'form': form,
|
||||
'used': inUse,
|
||||
'back': path('admin_customer')
|
||||
}) }}
|
||||
|
||||
|
||||
24
templates/default/_form_delete_modal.html.twig
Normal file
24
templates/default/_form_delete_modal.html.twig
Normal file
@@ -0,0 +1,24 @@
|
||||
{% embed 'embeds/modal.html.twig' %}
|
||||
{% block modal_id %}form_modal{% endblock %}
|
||||
{% block modal_class %}{% if used %}modal-danger{% endif %}{% endblock %}
|
||||
{% block modal_before %}{{ form_start(form) }}{% endblock %}
|
||||
{% block modal_title %}
|
||||
{{ title|default('confirm.delete'|trans) }}
|
||||
{% endblock %}
|
||||
{% block modal_body %}
|
||||
{% if used is same as (false) %}
|
||||
{{ 'delete.not_in_use'|trans }}
|
||||
<div class="hidden">
|
||||
{{ form_widget(form) }}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{{ message|default('confirm.delete_message'|trans)|raw }}</p>
|
||||
{{ form_widget(form) }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block modal_footer %}
|
||||
<button type="button" class="btn btn-default btn-cancel" data-dismiss="modal">{{ 'action.close'|trans }}</button>
|
||||
<button type="submit" class="btn {% if used %}btn-outline{% else %}btn-primary{% endif %} modal-form-save" data-loading-text="{{ 'action.delete'|trans }}..." id="{{ block('modal_id') }}_save">{{ 'action.delete'|trans }}</button>
|
||||
{% endblock %}
|
||||
{% block modal_end %}{{ form_end(form) }}{% endblock %}
|
||||
{% endembed %}
|
||||
@@ -12,7 +12,7 @@
|
||||
{% endblock %}
|
||||
{% block modal_footer %}
|
||||
<button type="button" class="btn btn-default btn-cancel" data-dismiss="modal">{{ 'action.close'|trans }}</button>
|
||||
<button type="submit" class="btn btn-primary modal-form-save" data-loading-text="Loading..." id="{{ block('modal_id') }}_save">{{ 'action.save'|trans }}</button>
|
||||
<button type="submit" class="btn btn-primary modal-form-save" data-loading-text="{{ 'action.save'|trans }}..." id="{{ block('modal_id') }}_save">{{ 'action.save'|trans }}</button>
|
||||
{% endblock %}
|
||||
{% block modal_end %}{{ form_end(form) }}{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="modal fade" id="{{ block('modal_id') }}" tabindex="-1" role="dialog" aria-labelledby="{{ block('modal_id') }}_label">
|
||||
<div class="modal{% if block('modal_class') is defined %} {{ block('modal_class') }}{% endif %} fade" id="{{ block('modal_id') }}" tabindex="-1" role="dialog" aria-labelledby="{{ block('modal_id') }}_label">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
{% if block('modal_before') is defined %}{{ block('modal_before') }}{% endif %}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
{% if is_granted('edit', activity) %}
|
||||
{% set actions = actions|merge({'edit': path('admin_activity_edit', {'id': activity.id})}) %}
|
||||
{% endif %}
|
||||
{% if is_granted('delete', activity) %}
|
||||
{% set actions = actions|merge({'trash': path('admin_activity_delete', {'id': activity.id})}) %}
|
||||
{% if view == 'index' and is_granted('delete', activity) %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('admin_activity_delete', {'id': activity.id}), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
{% if is_granted('view_activity') %}
|
||||
{% set actions = actions|merge({'activity': path('admin_activity', {'customer': project.customer.id, 'project': project.id})}) %}
|
||||
{% endif %}
|
||||
{% if is_granted('delete', project) %}
|
||||
{% set actions = actions|merge({'trash': path('admin_project_delete', {'id': project.id})}) %}
|
||||
{% if view == 'index' and is_granted('delete', project) %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('admin_project_delete', {'id': project.id}), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -99,8 +99,8 @@
|
||||
{% if is_granted('view_project') %}
|
||||
{% set actions = actions|merge({'project': path('admin_project', {'customer': customer.id})}) %}
|
||||
{% endif %}
|
||||
{% if is_granted('delete', customer) %}
|
||||
{% set actions = actions|merge({'trash': path('admin_customer_delete', {'id': customer.id})}) %}
|
||||
{% if view == 'index' and is_granted('delete', customer) %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('admin_customer_delete', {'id': customer.id}), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -156,8 +156,8 @@
|
||||
{% set actions = actions|merge({'edit': {'url': path('timesheet_edit', {'id': timesheet.id}), 'class': class}}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('delete', timesheet) %}
|
||||
{% set actions = actions|merge({'trash': path('timesheet_delete', {'id' : timesheet.id})}) %}
|
||||
{% if view == 'index' and is_granted('delete', timesheet) %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('timesheet_delete', {'id' : timesheet.id}), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -197,6 +197,7 @@
|
||||
{% if not timesheet.end and is_granted('stop', timesheet) %}
|
||||
{% set actions = actions|merge({'stop': path('admin_timesheet_stop', {'id' : timesheet.id})}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('edit', timesheet) %}
|
||||
{% set class = '' %}
|
||||
{% if view != 'edit' %}
|
||||
@@ -204,8 +205,9 @@
|
||||
{% endif %}
|
||||
{% set actions = actions|merge({'edit': {'url': path('admin_timesheet_edit', {'id': timesheet.id}), 'class': class}}) %}
|
||||
{% endif %}
|
||||
{% if is_granted('delete', timesheet) %}
|
||||
{% set actions = actions|merge({'trash': path('admin_timesheet_delete', {'id' : timesheet.id})}) %}
|
||||
|
||||
{% if view == 'index' and is_granted('delete', timesheet) %}
|
||||
{% set actions = actions|merge({'trash': {'url': path('admin_timesheet_delete', {'id' : timesheet.id}), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "macros/datatables.html.twig" as tables %}
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'admin_project.title'|trans }}{% endblock %}
|
||||
@@ -9,6 +7,8 @@
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% set inUse = (stats.recordAmount > 0) %}
|
||||
|
||||
{% set params = {
|
||||
'%project%': '<strong>' ~ project.name ~ '</strong>',
|
||||
'%customer%': '<strong>' ~ project.customer.name ~ '</strong>',
|
||||
@@ -17,9 +17,10 @@
|
||||
'%duration%': '<strong>' ~ stats.recordDuration|duration ~ '</strong>'
|
||||
} %}
|
||||
|
||||
{{ include('default/_form_delete.html.twig', {
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
|
||||
'message': "admin_project.delete_confirm"|trans(params)|raw,
|
||||
'form': form,
|
||||
'used': inUse,
|
||||
'back': path('admin_project')
|
||||
}) }}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<i class="{{ 'help'|icon }} text-gray"></i>
|
||||
</div>
|
||||
<div class="menu-info">
|
||||
<h4 class="control-sidebar-subheading">{{ 'help.title'|trans }}</h4>
|
||||
<h4 class="control-sidebar-subheading">{{ 'home.help'|trans({}, 'sidebar') }}</h4>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
17
templates/timesheet-team/delete.html.twig
Normal file
17
templates/timesheet-team/delete.html.twig
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'admin_timesheet.title'|trans }}{% endblock %}
|
||||
{% block page_subtitle %}{{ 'admin_timesheet.subtitle'|trans }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.timesheet_team(timesheet, 'delete') }}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
|
||||
'message': "delete.not_in_use"|trans|raw,
|
||||
'form': form,
|
||||
'used': false,
|
||||
'back': path('admin_timesheet')
|
||||
}) }}
|
||||
|
||||
{% endblock %}
|
||||
17
templates/timesheet/delete.html.twig
Normal file
17
templates/timesheet/delete.html.twig
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/actions.html.twig" as actions %}
|
||||
|
||||
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
|
||||
{% block page_subtitle %}{{ 'timesheet.subtitle'|trans }}{% endblock %}
|
||||
{% block page_actions %}{{ actions.timesheet(timesheet, 'delete') }}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
|
||||
'message': "delete.not_in_use"|trans|raw,
|
||||
'form': form,
|
||||
'used': false,
|
||||
'back': path('timesheet')
|
||||
}) }}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% import "macros/datatables.html.twig" as tables %}
|
||||
|
||||
@@ -7,16 +7,19 @@
|
||||
|
||||
{% block main %}
|
||||
|
||||
{% set inUse = (stats.recordsTotal > 0) %}
|
||||
|
||||
{% set params = {
|
||||
'%user%': '<strong>' ~ widgets.username(user) ~ '</strong>',
|
||||
'%records%': '<strong>' ~ stats.recordsTotal ~ '</strong>',
|
||||
'%duration%': '<strong>' ~ stats.durationTotal|duration ~ '</strong>'
|
||||
} %}
|
||||
|
||||
{{ include('default/_form_delete.html.twig', {
|
||||
{{ include(app.request.xmlHttpRequest ? 'default/_form_delete_modal.html.twig' : 'default/_form_delete.html.twig', {
|
||||
'message': "admin_user.delete_confirm"|trans(params)|raw,
|
||||
'form': form,
|
||||
'back': path('admin_activity')
|
||||
'used': inUse,
|
||||
'back': path('admin_user')
|
||||
}) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
{% set actionButtons = actionButtons|merge({'timesheet': path('admin_timesheet', {'user' : entry.id})}) %}
|
||||
{% endif %}
|
||||
{% if is_granted('delete', entry) %}
|
||||
{% set actionButtons = actionButtons|merge({'trash': path('admin_user_delete', {'id': entry.id})}) %}
|
||||
{% set actionButtons = actionButtons|merge({'trash': {'url': path('admin_user_delete', {'id': entry.id}), 'class': 'modal-ajax-form'}}) %}
|
||||
{% endif %}
|
||||
{{ widgets.button_group(actionButtons) }}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user