Skip to content

Commit

Permalink
Merge pull request #5398 from nanasess/improve/datepicker
Browse files Browse the repository at this point in the history
[4.2] tempusdominus-bootstrap-4 を HTML5 の date, datetime-local に変更する
  • Loading branch information
chihiro-adachi authored Jun 27, 2022
2 parents f316ce4 + abbb7c4 commit 3014e96
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 219 deletions.
69 changes: 0 additions & 69 deletions src/Eccube/Resource/template/admin/Customer/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,6 @@ file that was distributed with this source code.

{% form_theme searchForm '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
<style type="text/css">
.datepicker-days th.dow:first-child,
.datepicker-days td:first-child {
color: #f00;
}
.datepicker-days th.dow:last-child,
.datepicker-days td:last-child {
color: #00f;
}
</style>
{% endblock stylesheet %}

{% block javascript %}
<script src="{{ asset('assets/js/vendor/moment.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/moment-with-locales.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/tempusdominus-bootstrap-4.min.js', 'admin') }}"></script>

<script>
$(function() {
// datetimepicker と競合するため HTML5 のカレンダ入力を無効に
$('input[type="date"]').attr('type','text');
// datetimepicker で value が消えてしまうので data-value に保持しておく
$('input.datetimepicker-input').each(function() {
$(this).data('value', $(this).val());
});
$('input.datetimepicker-input').not('#admin_search_customer_birth_start').not('#admin_search_customer_birth_end').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD HH:mm:ss',
useCurrent: false,
buttons: {
showToday: true,
showClose: true
},
});
$('#admin_search_customer_birth_start').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD',
useCurrent: false,
buttons: {
showToday: true,
showClose: true
}
});
$('#admin_search_customer_birth_end').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD',
useCurrent: false,
buttons: {
showToday: true,
showClose: true
}
});
// datetimepicker で value が消えてしまうので更新
$('input.datetimepicker-input').each(function() {
$(this).val($(this).data('value'));
});
});
</script>
{% endblock javascript %}

{% block main %}
<form name="search_form" id="search_form" method="post" action="">
{{ form_widget(searchForm._token) }}
Expand Down
39 changes: 0 additions & 39 deletions src/Eccube/Resource/template/admin/Order/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,9 @@ file that was distributed with this source code.

{% form_theme searchForm '@admin/Form/bootstrap_4_layout.html.twig' %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
<style type="text/css">
.datepicker-days th.dow:first-child,
.datepicker-days td:first-child {
color: #f00;
}
.datepicker-days th.dow:last-child,
.datepicker-days td:last-child {
color: #00f;
}
</style>
{% endblock stylesheet %}

{% block javascript %}
<script src="{{ asset('assets/js/vendor/moment.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/moment-with-locales.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/tempusdominus-bootstrap-4.min.js', 'admin') }}"></script>

<script>
$(function() {
// datetimepicker で value が消えてしまうので data-value に保持しておく
$('input.datetimepicker-input').each(function() {
$(this).data('value', $(this).val());
});
$('input.datetimepicker-input').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD HH:mm:ss',
useCurrent: false,
buttons: {
showToday: true,
showClose: true
},
});
// datetimepicker で value が消えてしまうので更新
$('input.datetimepicker-input').each(function() {
$(this).val($(this).data('value'));
});
toggleBtnBulk('input[id^="check_"]', '.btn-bulk-wrapper');
$('input[id^="check_"]').on('change', function() {
$('#toggle_check_all').prop('checked', false);
Expand Down
28 changes: 1 addition & 27 deletions src/Eccube/Resource/template/admin/Order/order_pdf.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,7 @@ file that was distributed with this source code.
{% form_theme form '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
<style type="text/css">
.datepicker-days th.dow:first-child,
.datepicker-days td:first-child {
color: #f00;
}
.datepicker-days th.dow:last-child,
.datepicker-days td:last-child {
color: #00f;
}
.c-container {
min-width: inherit;
margin-top: 0;
Expand All @@ -48,22 +37,8 @@ file that was distributed with this source code.
{% endblock stylesheet %}

{% block javascript %}
<script src="{{ asset('assets/js/vendor/moment.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/moment-with-locales.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/tempusdominus-bootstrap-4.min.js', 'admin') }}"></script>

<script type="text/javascript">
$(function() {
$('input[id$=_issue_date]').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD',
useCurrent: true,
buttons: {
showToday: true,
showClose: true
}
});
var close = $('#windowclose');
$('.btn-ec-regular').on('click', function() {
Expand All @@ -73,7 +48,6 @@ file that was distributed with this source code.
});
Ladda.bind('button[type="submit"]', {timeout: 3000});
</script>
{% endblock %}

Expand All @@ -91,7 +65,7 @@ file that was distributed with this source code.
<div class="card-body">
<div class="mb-3">
<label>{{ 'admin.order.delivery_note_create_date'|trans }}</label>
{{ form_widget(form.issue_date, { type: 'text' }) }}
{{ form_widget(form.issue_date) }}
{{ form_errors(form.issue_date) }}
</div>

Expand Down
39 changes: 0 additions & 39 deletions src/Eccube/Resource/template/admin/Product/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,9 @@ file that was distributed with this source code.

{% form_theme searchForm '@admin/Form/bootstrap_4_layout.html.twig' %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
<style type="text/css">
.datepicker-days th.dow:first-child,
.datepicker-days td:first-child {
color: #f00;
}
.datepicker-days th.dow:last-child,
.datepicker-days td:last-child {
color: #00f;
}
</style>
{% endblock stylesheet %}

{% block javascript %}
<script src="{{ asset('assets/js/vendor/moment.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/moment-with-locales.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/tempusdominus-bootstrap-4.min.js', 'admin') }}"></script>

<script>
$(function() {
// datetimepicker で value が消えてしまうので data-value に保持しておく
$('input.datetimepicker-input').each(function() {
$(this).data('value', $(this).val());
});
$('input.datetimepicker-input').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD HH:mm:ss',
useCurrent: false,
buttons: {
showToday: true,
showClose: true
},
});
// datetimepicker で value が消えてしまうので更新
$('input.datetimepicker-input').each(function() {
$(this).val($(this).data('value'));
});
$('#bulkDelete').on('click', function() {
var modal = $('#bulkDeleteModal');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,6 @@ file that was distributed with this source code.

{% form_theme searchForm '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}

{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
<style type="text/css">
.datepicker-days th.dow:first-child,
.datepicker-days td:first-child {
color: #f00;
}
.datepicker-days th.dow:last-child,
.datepicker-days td:last-child {
color: #00f;
}
</style>
{% endblock stylesheet %}

{% block javascript %}
<script src="{{ asset('assets/js/vendor/moment.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/moment-with-locales.min.js', 'admin') }}"></script>
<script src="{{ asset('assets/js/vendor/tempusdominus-bootstrap-4.min.js', 'admin') }}"></script>

<script>
$(function() {
// datetimepicker で value が消えてしまうので data-value に保持しておく
$('input.datetimepicker-input').each(function() {
$(this).data('value', $(this).val());
});
$('input.datetimepicker-input').datetimepicker({
locale: '{{ eccube_config.locale }}',
format: 'YYYY-MM-DD HH:mm:ss',
useCurrent: false,
buttons: {
showToday: true,
showClose: true
},
});
// datetimepicker で value が消えてしまうので更新
$('input.datetimepicker-input').each(function() {
$(this).val($(this).data('value'));
});
});
</script>
{% endblock javascript %}

{% block main %}
<form name="search_form" id="search_form" method="post" action="">
{{ form_widget(searchForm._token) }}
Expand Down

0 comments on commit 3014e96

Please sign in to comment.