From c6f8ab342d0d1685fd19da632ec78679d92520d7 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 14 Nov 2014 11:42:20 +0800 Subject: [PATCH] :u5408: #139 --- i18n/en_US.json | 1 + i18n/ja_JP.json | 1 + i18n/zh_CN.json | 1 + i18n/zh_TW.json | 1 + static/js/editors.js | 3 +++ static/js/wide.js | 36 +++++++++++++++++++++++++++++++++++- views/index.html | 4 ++++ 7 files changed, 46 insertions(+), 1 deletion(-) diff --git a/i18n/en_US.json b/i18n/en_US.json index f862b6f..cdbbbdc 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -40,6 +40,7 @@ "notification_3": "Not found [ide_stub], thereby [Jump to Decl], [Find Usages] will not work", "notification_4": "Server Internal Error", "goto_line": "Goto Line", + "goto_file": "Goto File", "go": "Go", "tip": "Tip", "confirm": "Confirm", diff --git a/i18n/ja_JP.json b/i18n/ja_JP.json index eccde74..96039a7 100644 --- a/i18n/ja_JP.json +++ b/i18n/ja_JP.json @@ -40,6 +40,7 @@ "notification_3": "[ide_stub] が見つかりません。[Jump to Decl]、[Find Usages] は動作しません。", "notification_4": "内部サーバーエラー", "goto_line": "指定行にジャンプ", + "goto_file": "ファイルをオープンする", "go": "Go", "tip": "ヒント", "confirm": "確認", diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 0c1b3d4..223dee5 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -40,6 +40,7 @@ "notification_3": "没有检查到 ide_stub,这将会导致 [跳转到声明]、[查找使用] 失效", "notification_4": "服务器内部错误", "goto_line": "跳转到行", + "goto_file": "打开文件", "go": "跳转", "tip": "提示", "confirm": "确定", diff --git a/i18n/zh_TW.json b/i18n/zh_TW.json index 7c3a3d3..77be426 100644 --- a/i18n/zh_TW.json +++ b/i18n/zh_TW.json @@ -40,6 +40,7 @@ "notification_3": "没有檢查到 ide_stub,這將會導致 [跳轉到聲明]、[查找使用] 失效", "notification_4": "服務器內部錯誤", "goto_line": "跳轉到行", + "goto_file": "打開文件", "go": "跳到", "tip": "提示", "confirm": "確定", diff --git a/static/js/editors.js b/static/js/editors.js index 4fb4721..5f5726c 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -760,6 +760,9 @@ var editors = { cm.setSelection(CodeMirror.Pos(from.line + 1, from.ch), CodeMirror.Pos(to.line + 1, to.ch)); + }, + "Shift-Alt-O": function () { + $("#dialogGoFilePrompt").dialog("open"); } } }); diff --git a/static/js/wide.js b/static/js/wide.js index 4c2801c..50199f8 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ var wide = { curNode: undefined, @@ -281,6 +281,40 @@ var wide = { } }); + $("#dialogGoFilePrompt").dialog({ + "modal": true, + "height": 300, + "width": 660, + "title": config.label.goto_file, + "okText": config.label.go, + "cancelText": config.label.cancel, + "afterOpen": function () { + $("#dialogGoFilePrompt > input").val('').focus(); + $("#dialogGoFilePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled", true); + }, + "ok": function () { + var name = $("#dialogGoFilePrompt > input").val(); + + var request = newWideRequest(); + request.path = wide.curNode.path; + request.name = '*' + name + '*'; + + $.ajax({ + type: 'POST', + url: '/file/find/name', + data: JSON.stringify(request), + dataType: "json", + success: function (data) { + if (!data.succ) { + return; + } + + console.log(data); + } + }); + } + }); + $("#dialogGoLinePrompt").dialog({ "modal": true, "height": 52, diff --git a/views/index.html b/views/index.html index 1b0baaa..a3eab6b 100644 --- a/views/index.html +++ b/views/index.html @@ -244,6 +244,9 @@
+
+ +
@@ -267,6 +270,7 @@ "rename": "{{.i18n.rename}}", "cancel": "{{.i18n.cancel}}", "goto_line": "{{.i18n.goto_line}}", + "goto_file": "{{.i18n.goto_file}}", "go": "{{.i18n.go}}", "create": "{{.i18n.create}}", "create_file": "{{.i18n.create_file}}",