Replace jquery-datetimepicker with native date input (#11684)

This removes the jQuery plugin as well as the associated config options.
Native input[type=date] does not require a language attribute as it is
localized by default, except for the placeholder attribute for which I
currently piggy-back the repo.issues.due_date_form localization option.

Implementation should pretty much match GH. Of note is that Safari does
not provide a UI for this input type, but I don't think providing one is
neccessary and GH did not bother either.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
silverwind 2020-06-10 20:35:27 +02:00 committed by GitHub
parent 42752f3902
commit 628ee1d82e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 10 additions and 232 deletions

View file

@ -1,8 +0,0 @@
export default async function initDateTimePicker(locale) {
await Promise.all([
import(/* webpackChunkName: "datetimepicker" */'jquery-datetimepicker'),
import(/* webpackChunkName: "datetimepicker" */'jquery-datetimepicker/build/jquery.datetimepicker.min.css'),
]);
$.datetimepicker.setLocale(locale);
}

View file

@ -12,7 +12,6 @@ import initContextPopups from './features/contextpopup.js';
import initGitGraph from './features/gitgraph.js';
import initClipboard from './features/clipboard.js';
import initUserHeatmap from './features/userheatmap.js';
import initDateTimePicker from './features/datetimepicker.js';
import initServiceWorker from './features/serviceworker.js';
import attachTribute from './features/tribute.js';
import createDropzone from './features/dropzone.js';
@ -755,18 +754,6 @@ async function initRepository() {
// Milestones
if ($('.repository.new.milestone').length > 0) {
const $datepicker = $('.milestone.datepicker');
await initDateTimePicker($datepicker.data('lang'));
$datepicker.datetimepicker({
inline: true,
timepicker: false,
startDate: $datepicker.data('start-date'),
onSelectDate(date) {
$('#deadline').val(date.toISOString().substring(0, 10));
},
});
$('#clear-date').on('click', () => {
$('#deadline').val('');
return false;

View file

@ -1309,10 +1309,6 @@
textarea {
height: 200px;
}
#deadline {
width: 150px;
}
}
&.compare.pull {

View file

@ -1395,80 +1395,6 @@ a.ui.labels .label:hover {
}
}
body .xdsoft_datetimepicker {
background: #2a2e39;
border: 1px solid #4c505c;
color: #9e9e9e;
.xdsoft_monthpicker {
height: 36px;
background: #464c5d;
margin: -2px -8px 2px;
padding: 2px 8px 0;
button {
background-image: none;
text-indent: 0;
text-align: center;
color: #9e9e9e;
&.xdsoft_prev::before {
content: "\f0d9";
font: normal normal normal 14px/1 FontAwesome, serif;
font-size: 1.7em;
}
&.xdsoft_next::before {
content: "\f0da";
font: normal normal normal 14px/1 FontAwesome, serif;
font-size: 1.7em;
}
&.xdsoft_today_button::before {
content: "\f015";
font: normal normal normal 14px/1 FontAwesome, serif;
font-size: 1.4em;
}
}
& > div.xdsoft_label {
background: #464c5d;
i {
line-height: 14px;
background-image: none;
text-indent: 0;
text-align: center;
::before {
content: "\f0dd";
font: normal normal normal 14px/1 FontAwesome, serif;
font-size: .7em;
}
}
.xdsoft_select {
background: #353945;
}
}
}
.xdsoft_datepicker .xdsoft_calendar {
td,
th {
border-color: #4c505c;
background-color: #2a2e39;
}
td.xdsoft_other_month,
td.xdsoft_disabled {
opacity: .8;
background: #a0cc75;
color: #000000;
}
}
}
.heatmap(@heat) {
@heatmap-cold: #2d303b;
@heatmap-hot: #a0cc75;