From fae810df5e324d08fa24ec688cec619c66ade8f2 Mon Sep 17 00:00:00 2001 From: Van Date: Wed, 24 Sep 2014 15:24:37 +0800 Subject: [PATCH] build run stop --- conf/wide.json | 10 +++++++--- i18n/zh_CN.json | 3 ++- static/js/wide.js | 26 +++++++++++++++----------- view/index.html | 4 +++- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/conf/wide.json b/conf/wide.json index 1b0f0d3..7e2ce5a 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -15,9 +15,13 @@ "Password": "admin", "Workspace": "{pwd}/data/user_workspaces/admin", "LatestSessionContent": { - "FileTree": [], - "Files": [], - "CurrentFile": "" + "FileTree": [ + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest" + ], + "Files": [ + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\1123" + ], + "CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\1123" } } ] diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 4b5a44d..059d6e5 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -36,5 +36,6 @@ "goto": "跳转", "input_no_empty": "输入不能为空", "tip": "提示", - "confirm": "确定" + "confirm": "确定", + "stop": "停止" } \ No newline at end of file diff --git a/static/js/wide.js b/static/js/wide.js index 829b788..1b6fc7d 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -261,8 +261,9 @@ var wide = { wide.curProcessId = data.pid; } else if ('run-done' === data.cmd) { // 运行结束 wide.curProcessId = undefined; - - // TODO: 运行结束后修改 [构建&运行] 图标状态为可用状态 + // 运行结束后修改 [构建&运行] 图标状态为可用状态 + $(".toolbars .ico-stop").removeClass("ico-stop") + .addClass("ico-buildrun").attr("title", config.label.build_n_run); } else if ('build' === data.cmd || 'go install' === data.cmd) { $('.bottom-window-group .output').text(data.output); @@ -275,7 +276,8 @@ var wide = { message: lint.msg, severity: lint.severity}); } - // TODO: 修改 [构建&运行] 图标状态为可用状态 + $(".toolbars .ico-stop").removeClass("ico-stop") + .addClass("ico-buildrun").attr("title", config.label.build_n_run); } // 触发一次 gutter lint @@ -294,7 +296,7 @@ var wide = { }, init: function () { this._initWS(); - + this._initLayout(); this._initBottomWindowGroup(); @@ -352,11 +354,11 @@ var wide = { // TODO: exit }, stop: function () { - if ($(".toolbars .ico-buildrun").length === 1) { + if ($(".toolbars .ico-buildrun").length === 1) { wide.run(); return false; - } - + } + var request = newWideRequest(); request.pid = wide.curProcessId; @@ -369,7 +371,8 @@ var wide = { // $('.bottom-window-group .output').text(''); }, success: function (data) { - $(".toolbars .ico-stop").removeClass("ico-stop").addClass("ico-buildrun"); + $(".toolbars .ico-stop").removeClass("ico-stop") + .addClass("ico-buildrun").attr("title", config.label.build_n_run); } }); }, @@ -378,8 +381,8 @@ var wide = { if ($(".toolbars .ico-stop").length === 1) { wide.stop(); return false; - } - + } + var request = newWideRequest(); request.file = $(".edit-header .current span:eq(0)").attr("title"); request.code = wide.curEditor.getValue(); @@ -393,7 +396,8 @@ var wide = { $('.bottom-window-group .output').text(''); }, success: function (data) { - $(".toolbars .ico-buildrun").addClass("ico-stop").removeClass("ico-buildrun"); + $(".toolbars .ico-buildrun").addClass("ico-stop") + .removeClass("ico-buildrun").attr("title", config.label.stop); } }); }, diff --git a/view/index.html b/view/index.html index ce82a8b..8068dab 100644 --- a/view/index.html +++ b/view/index.html @@ -195,7 +195,9 @@ "create_file": "{{.i18n.create_file}}", "create_dir": "{{.i18n.create_dir}}", "tip": "{{.i18n.tip}}", - "confirm": "{{.i18n.confirm}}" + "confirm": "{{.i18n.confirm}}", + "build_n_run": "{{.i18n.build_n_run}}", + "stop": "{{.i18n.stop}}" }, "channel": { "editor": '{{.conf.EditorChannel}}',