From 711f1943c91abc0ae9c010db4a1b92e0ff7b19c7 Mon Sep 17 00:00:00 2001 From: Van Date: Mon, 22 Sep 2014 18:09:16 +0800 Subject: [PATCH] =?UTF-8?q?prompt=20=E8=BE=93=E5=85=A5=E6=A1=86=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=9B=9E=E8=BD=A6=E4=BA=8B=E4=BB=B6=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E4=B8=BA=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/user_workspaces/admin/src/mytest/sdf | 0 i18n/zh_CN.json | 3 ++- static/css/dialog.css | 9 +++---- static/js/wide.js | 31 +++++++++++++++++++---- view/index.html | 13 +++++----- 5 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 data/user_workspaces/admin/src/mytest/sdf diff --git a/data/user_workspaces/admin/src/mytest/sdf b/data/user_workspaces/admin/src/mytest/sdf new file mode 100644 index 0000000..e69de29 diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 144c926..ce00aca 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -33,5 +33,6 @@ "notification_2": "没有检查到 gocode,这将会导致 [自动完成] 失效", "notification_3": "没有检查到 ide_stub,这将会导致 [跳转到声明]、[查找使用] 失效", "goto_line": "跳转到行", - "goto": "跳转" + "goto": "跳转", + "input_no_empty": "输入不能为空" } \ No newline at end of file diff --git a/static/css/dialog.css b/static/css/dialog.css index 9dc9ddd..6115b51 100644 --- a/static/css/dialog.css +++ b/static/css/dialog.css @@ -71,14 +71,11 @@ } #dialogRemoveConfirm, -#dialogNewFilePrompt, -#dialogNewDirPrompt, -#dialogGoLinePrompt { +.dialog-prompt { padding: 10px 20px 0; + overflow: hidden; } -#dialogNewFilePrompt > input, -#dialogNewDirPrompt > input, -#dialogGoLinePrompt > input { +.dialog-prompt > input { width: 100%; } \ No newline at end of file diff --git a/static/js/wide.js b/static/js/wide.js index b99240f..9939d5f 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -115,8 +115,17 @@ var wide = { } }); + + $(".dialog-prompt > input").keydown(function(event) { + $(".dialog-prompt > .tip").text(''); + + if (event.which === 13) { + $(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)").click(); + } + }); + $("#dialogNewFilePrompt").dialog({ - "height": 32, + "height": 52, "width": 260, "title": config.label.create_file, "okText": config.label.create, @@ -126,7 +135,12 @@ var wide = { }, "ok": function() { var request = newWideRequest(), - name = $("#dialogNewFilePrompt > input").val() + name = $("#dialogNewFilePrompt > input").val(); + if ($.trim(name) === "") { + $("#dialogNewFilePrompt > .tip").text(config.label.input_no_empty); + return false; + } + request.path = wide.curNode.path + '\\' + name; request.fileType = "f"; @@ -187,7 +201,7 @@ var wide = { }); $("#dialogNewDirPrompt").dialog({ - "height": 32, + "height": 52, "width": 260, "title": config.label.create_dir, "okText": config.label.create, @@ -198,6 +212,10 @@ var wide = { "ok": function() { var name = $("#dialogNewDirPrompt > input").val(), request = newWideRequest(); + if ($.trim(name) === "") { + $("#dialogNewDirPrompt > .tip").text(config.label.input_no_empty); + return false; + } request.path = wide.curNode.path + '\\' + name; request.fileType = "d"; @@ -224,7 +242,7 @@ var wide = { }); $("#dialogGoLinePrompt").dialog({ - "height": 32, + "height": 52, "width": 260, "title": config.label.goto_line, "okText": config.label.goto, @@ -234,7 +252,10 @@ var wide = { }, "ok": function() { var line = parseInt($("#dialogGoLinePrompt > input").val()); - + if ($.trim(line) === "") { + $("#dialogGoLinePrompt > .tip").text(config.label.input_no_empty); + return false; + } $("#dialogGoLinePrompt").dialog("close"); wide.curEditor.setCursor(CodeMirror.Pos(line - 1, 0)); wide.curEditor.focus(); diff --git a/view/index.html b/view/index.html index 9a12ed1..a1463b2 100644 --- a/view/index.html +++ b/view/index.html @@ -170,20 +170,21 @@
{{.i18n.isDelete}} ?
-
- +
+
-
- +
+
-
- +
+