Skip to content

Commit 628ee1d

Browse files
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 <[email protected]>
1 parent 42752f3 commit 628ee1d

File tree

17 files changed

+10
-232
lines changed

17 files changed

+10
-232
lines changed

custom/conf/app.ini.sample

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SCRIPT_TYPE = bash
1717
; DETECTED_CHARSETS_ORDER tie-break order for detected charsets.
1818
; If the charsets have equal confidence, tie-breaking will be done by order in this list
1919
; with charsets earlier in the list chosen in preference to those later.
20-
; Adding "defaults" will place the unused charsets at that position.
20+
; Adding "defaults" will place the unused charsets at that position.
2121
DETECTED_CHARSETS_ORDER=UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr
2222
; Default ANSI charset to override non-UTF-8 charsets to
2323
ANSI_CHARSET =
@@ -634,8 +634,8 @@ SUBJECT_PREFIX =
634634
; Mail server
635635
; Gmail: smtp.gmail.com:587
636636
; QQ: smtp.qq.com:465
637-
; Using STARTTLS on port 587 is recommended per RFC 6409.
638-
; Note, if the port ends with "465", SMTPS will be used.
637+
; Using STARTTLS on port 587 is recommended per RFC 6409.
638+
; Note, if the port ends with "465", SMTPS will be used.
639639
HOST =
640640
; Disable HELO operation when hostnames are different.
641641
DISABLE_HELO =
@@ -950,32 +950,6 @@ MAX_TOKEN_LENGTH=32767
950950
LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR
951951
NAMES = English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,Українська,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어
952952

953-
; Used for datetimepicker
954-
[i18n.datelang]
955-
en-US = en
956-
zh-CN = zh
957-
zh-HK = zh-HK
958-
zh-TW = zh-TW
959-
de-DE = de
960-
fr-FR = fr
961-
nl-NL = nl
962-
lv-LV = lv
963-
ru-RU = ru
964-
uk-UA = uk
965-
ja-JP = ja
966-
es-ES = es
967-
pt-BR = pt-BR
968-
pt-PT = pt
969-
pl-PL = pl
970-
bg-BG = bg
971-
it-IT = it
972-
fi-FI = fi
973-
tr-TR = tr
974-
cs-CZ = cs-CZ
975-
sr-SP = sr
976-
sv-SE = sv
977-
ko-KR = ko
978-
979953
[U2F]
980954
; NOTE: THE DEFAULT VALUES HERE WILL NEED TO BE CHANGED
981955
; Two Factor authentication with security keys

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -614,32 +614,6 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
614614
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR**: List of locales shown in language selector
615615
- `NAMES`: **English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어**: Visible names corresponding to the locales
616616

617-
### i18n - Datepicker Language (`i18n.datelang`)
618-
Maps locales to the languages used by the datepicker plugin
619-
620-
- `en-US`: **en**
621-
- `zh-CN`: **zh**
622-
- `zh-HK`: **zh-HK**
623-
- `zh-TW`: **zh-TW**
624-
- `de-DE`: **de**
625-
- `fr-FR`: **fr**
626-
- `nl-NL`: **nl**
627-
- `lv-LV`: **lv**
628-
- `ru-RU`: **ru**
629-
- `ja-JP`: **ja**
630-
- `es-ES`: **es**
631-
- `pt-BR`: **pt-BR**
632-
- `pt-PT`: **pt**
633-
- `pl-PL`: **pl**
634-
- `bg-BG`: **bg**
635-
- `it-IT`: **it**
636-
- `fi-FI`: **fi**
637-
- `tr-TR`: **tr**
638-
- `cs-CZ`: **cs-CZ**
639-
- `sr-SP`: **sr**
640-
- `sv-SE`: **sv**
641-
- `ko-KR`: **ko**
642-
643617
## U2F (`U2F`)
644618
- `APP_ID`: **`ROOT_URL`**: Declares the facet of the application. Requires HTTPS.
645619
- `TRUSTED_FACETS`: List of additional facets which are trusted. This is not support by all browsers.

docs/content/page/index.en-us.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
276276
* [Highlight](https://highlightjs.org/)
277277
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
278278
* [CodeMirror](https://codemirror.net/)
279-
* [jQuery Date Time Picker](https://github.com/xdan/datetimepicker)
280279
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
281280
* Database drivers:
282281
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

docs/content/page/index.fr-fr.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide
264264
* [Highlight](https://highlightjs.org/)
265265
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
266266
* [CodeMirror](https://codemirror.net/)
267-
* [jQuery Date Time Picker](https://github.com/xdan/datetimepicker)
268267
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
269268
* Connecteurs de base de données :
270269
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

docs/content/page/index.zh-cn.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
5757
* [Highlight](https://highlightjs.org/)
5858
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
5959
* [CodeMirror](https://codemirror.net/)
60-
* [jQuery Date Time Picker](https://github.com/xdan/datetimepicker)
6160
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
6261
* 数据库驱动:
6362
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

docs/content/page/index.zh-tw.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Gitea 的首要目標是建立一個容易安裝,運行快速,安装和使
5757
* [Highlight](https://highlightjs.org/)
5858
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
5959
* [CodeMirror](https://codemirror.net/)
60-
* [jQuery Date Time Picker](https://github.com/xdan/datetimepicker)
6160
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
6261
* 資料庫:
6362
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)

modules/setting/setting.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,8 @@ var (
367367
}
368368

369369
// I18n settings
370-
Langs []string
371-
Names []string
372-
dateLangs map[string]string
370+
Langs []string
371+
Names []string
373372

374373
// Highlight settings are loaded in modules/template/highlight.go
375374

@@ -394,15 +393,6 @@ var (
394393
UILocation = time.Local
395394
)
396395

397-
// DateLang transforms standard language locale name to corresponding value in datetime plugin.
398-
func DateLang(lang string) string {
399-
name, ok := dateLangs[lang]
400-
if ok {
401-
return name
402-
}
403-
return "en"
404-
}
405-
406396
func getAppPath() (string, error) {
407397
var appPath string
408398
var err error
@@ -1012,7 +1002,6 @@ func NewContext() {
10121002
"español", "português do Brasil", "Português de Portugal", "polski", "български",
10131003
"italiano", "suomi", "Türkçe", "čeština", "српски", "svenska", "한국어"}
10141004
}
1015-
dateLangs = Cfg.Section("i18n.datelang").KeysHash()
10161005

10171006
ShowFooterBranding = Cfg.Section("other").Key("SHOW_FOOTER_BRANDING").MustBool(false)
10181007
ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool(true)

package-lock.json

Lines changed: 0 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
"file-loader": "6.0.0",
2323
"fomantic-ui": "2.8.5",
2424
"highlight.js": "10.0.3",
25-
"imports-loader": "0.8.0",
2625
"jquery": "3.5.1",
27-
"jquery-datetimepicker": "2.5.21",
2826
"jquery.are-you-sure": "1.9.0",
2927
"less-loader": "6.1.0",
3028
"mini-css-extract-plugin": "0.9.0",

public/vendor/librejs.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@
6060
<td><a href="https://github.com/highlightjs/highlight.js/blob/master/LICENSE">BSD 3-Clause</a></td>
6161
<td><a href="https://github.com/highlightjs/highlight.js/archive/9.18.0.tar.gz">highlight.js.tar.gz</a></td>
6262
</tr>
63-
<tr>
64-
<td><a href="../js/datetimepicker.js">jQuery DateTimePicker</a></td>
65-
<td><a href="https://github.com/xdan/datetimepicker/blob/master/MIT-LICENSE.txt">MIT</a></td>
66-
<td><a href="https://github.com/xdan/datetimepicker/archive/master.zip">jquery.datetimepicker.tar.gz</a></td>
67-
</tr>
6863
<tr>
6964
<td><a href="./plugins/jquery.minicolors/jquery.minicolors.min.js">jquery.minicolors.min.js</a></td>
7065
<td><a href="https://github.com/claviska/jquery-minicolors/blob/master/LICENSE.md">Expat</a></td>

routers/repo/milestone.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ func NewMilestone(ctx *context.Context) {
9090
ctx.Data["Title"] = ctx.Tr("repo.milestones.new")
9191
ctx.Data["PageIsIssueList"] = true
9292
ctx.Data["PageIsMilestones"] = true
93-
ctx.Data["DateLang"] = setting.DateLang(ctx.Locale.Language())
9493
ctx.HTML(200, tplMilestoneNew)
9594
}
9695

@@ -99,7 +98,6 @@ func NewMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) {
9998
ctx.Data["Title"] = ctx.Tr("repo.milestones.new")
10099
ctx.Data["PageIsIssueList"] = true
101100
ctx.Data["PageIsMilestones"] = true
102-
ctx.Data["DateLang"] = setting.DateLang(ctx.Locale.Language())
103101

104102
if ctx.HasError() {
105103
ctx.HTML(200, tplMilestoneNew)
@@ -136,7 +134,6 @@ func EditMilestone(ctx *context.Context) {
136134
ctx.Data["Title"] = ctx.Tr("repo.milestones.edit")
137135
ctx.Data["PageIsMilestones"] = true
138136
ctx.Data["PageIsEditMilestone"] = true
139-
ctx.Data["DateLang"] = setting.DateLang(ctx.Locale.Language())
140137

141138
m, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
142139
if err != nil {
@@ -160,7 +157,6 @@ func EditMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) {
160157
ctx.Data["Title"] = ctx.Tr("repo.milestones.edit")
161158
ctx.Data["PageIsMilestones"] = true
162159
ctx.Data["PageIsEditMilestone"] = true
163-
ctx.Data["DateLang"] = setting.DateLang(ctx.Locale.Language())
164160

165161
if ctx.HasError() {
166162
ctx.HTML(200, tplMilestoneNew)

templates/repo/issue/milestone_new.tmpl

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,21 @@
2323
{{template "base/alert" .}}
2424
<form class="ui form grid" action="{{.Link}}" method="post">
2525
{{.CsrfTokenHtml}}
26-
<div class="eleven wide column">
26+
<div class="twelve wide column">
2727
<div class="field {{if .Err_Title}}error{{end}}">
2828
<label>{{.i18n.Tr "repo.milestones.title"}}</label>
2929
<input name="title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" autofocus required maxlength="50">
3030
</div>
31-
<div class="field">
32-
<label>{{.i18n.Tr "repo.milestones.desc"}}</label>
33-
<textarea name="content">{{.content}}</textarea>
34-
</div>
35-
</div>
36-
<div class="four wide column">
3731
<div class="field {{if .Err_Deadline}}error{{end}}">
3832
<label>
3933
{{.i18n.Tr "repo.milestones.due_date"}}
40-
<a id="clear-date" href="#">{{.i18n.Tr "repo.milestones.clear"}}</a>
34+
<a id="clear-date">{{.i18n.Tr "repo.milestones.clear"}}</a>
4135
</label>
42-
<input id="deadline" name="deadline" value="{{.deadline}}">
36+
<input type="date" id="deadline" name="deadline" value="{{.deadline}}" placeholder="{{.i18n.Tr "repo.issues.due_date_form"}}">
4337
</div>
4438
<div class="field">
45-
<input class="milestone datepicker" data-lang="{{.DateLang}}" data-start-date="{{.deadline}}">
39+
<label>{{.i18n.Tr "repo.milestones.desc"}}</label>
40+
<textarea name="content">{{.content}}</textarea>
4641
</div>
4742
</div>
4843
<div class="ui container">

web_src/js/features/datetimepicker.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

web_src/js/index.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import initContextPopups from './features/contextpopup.js';
1212
import initGitGraph from './features/gitgraph.js';
1313
import initClipboard from './features/clipboard.js';
1414
import initUserHeatmap from './features/userheatmap.js';
15-
import initDateTimePicker from './features/datetimepicker.js';
1615
import initServiceWorker from './features/serviceworker.js';
1716
import attachTribute from './features/tribute.js';
1817
import createDropzone from './features/dropzone.js';
@@ -755,18 +754,6 @@ async function initRepository() {
755754

756755
// Milestones
757756
if ($('.repository.new.milestone').length > 0) {
758-
const $datepicker = $('.milestone.datepicker');
759-
760-
await initDateTimePicker($datepicker.data('lang'));
761-
762-
$datepicker.datetimepicker({
763-
inline: true,
764-
timepicker: false,
765-
startDate: $datepicker.data('start-date'),
766-
onSelectDate(date) {
767-
$('#deadline').val(date.toISOString().substring(0, 10));
768-
},
769-
});
770757
$('#clear-date').on('click', () => {
771758
$('#deadline').val('');
772759
return false;

web_src/less/_repository.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,10 +1309,6 @@
13091309
textarea {
13101310
height: 200px;
13111311
}
1312-
1313-
#deadline {
1314-
width: 150px;
1315-
}
13161312
}
13171313

13181314
&.compare.pull {

0 commit comments

Comments
 (0)