From f935daf2178ae7f60bf77265adec20c4540cdca1 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 24 Sep 2014 11:25:07 +0800 Subject: [PATCH 1/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39dfd6c..028130e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Wide +# Wide [![Build Status](https://drone.io/github.com/b3log/wide/status.png)](https://drone.io/github.com/b3log/wide/latest) ## Intro From 15763264c9be18c96d7ba6dd92e4f682e908f115 Mon Sep 17 00:00:00 2001 From: Van Date: Wed, 24 Sep 2014 11:33:08 +0800 Subject: [PATCH 2/4] alert --- conf/wide.json | 22 ++++++++++++++++------ data/user_workspaces/admin/src/mytest/1123 | 0 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 data/user_workspaces/admin/src/mytest/1123 diff --git a/conf/wide.json b/conf/wide.json index 11b4694..e7b7e05 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -15,13 +15,23 @@ "Password": "admin", "Workspace": "{pwd}/data/user_workspaces/admin", "LatestSessionContent": { - "FileTree": [ - "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest", - "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello", - "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time" + "fileTree": [ + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\123", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg", + "D:\\go\\src\\pkg", + "D:\\go\\src\\pkg\\archive", + "D:\\go\\src\\pkg\\archive\\tar", + "D:\\go\\src\\pkg\\archive\\tar\\testdata" ], - "Files": [], - "CurrentFile": "" + "files": [ + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\1123", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\123\\q.exe", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\2.json" + ], + "currentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\123\\q.exe" } } ] diff --git a/data/user_workspaces/admin/src/mytest/1123 b/data/user_workspaces/admin/src/mytest/1123 new file mode 100644 index 0000000..e69de29 From 6730017aec5f3cfbb179dbced8f8f97e73bcbcb6 Mon Sep 17 00:00:00 2001 From: Van Date: Wed, 24 Sep 2014 11:35:03 +0800 Subject: [PATCH 3/4] alert --- i18n/zh_CN.json | 4 ++- static/css/base.css | 27 ++++++++++---------- static/css/dialog.css | 14 +++------- static/js/dialog.js | 59 +++++++++++++++++++++++-------------------- static/js/editor.js | 4 +-- static/js/tree.js | 2 +- static/js/wide.js | 12 ++++++++- view/index.html | 3 +++ 8 files changed, 68 insertions(+), 57 deletions(-) diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index ce00aca..4b5a44d 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -34,5 +34,7 @@ "notification_3": "没有检查到 ide_stub,这将会导致 [跳转到声明]、[查找使用] 失效", "goto_line": "跳转到行", "goto": "跳转", - "input_no_empty": "输入不能为空" + "input_no_empty": "输入不能为空", + "tip": "提示", + "confirm": "确定" } \ No newline at end of file diff --git a/static/css/base.css b/static/css/base.css index 4b2a3e6..bdfd0ee 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -74,6 +74,19 @@ ul { .icon-buildrun:before { content: "\e607"; } + +.ico-close { + color: #666; +} + +.ico-close:hover { + color: #333; +} + +.ico-close:before { + content: "\e60a"; + cursor: pointer; +} /* end reset & function */ /* start frame */ @@ -133,20 +146,6 @@ ul { .tabs > div.current { background-color: #F7F7F7; } - -.tabs .ico-close { - color: #666; -} - -.tabs .ico-close:hover { - color: #333; -} - -.tabs .ico-close:before { - content: "\e60a"; - cursor: pointer; - -} /* end tabs */ /* start framework */ diff --git a/static/css/dialog.css b/static/css/dialog.css index 6115b51..97575de 100644 --- a/static/css/dialog.css +++ b/static/css/dialog.css @@ -43,16 +43,9 @@ } .dialog-close-icon { - background-position: -15px 0; - cursor: pointer; float: right; - height: 18px; - margin: 5px 3px 0 0; - width: 18px; -} - -.dialog-close-icon:hover { - background-position: -15px -18px; + margin: 3px; + text-decoration: none; } .dialog-main { @@ -71,7 +64,8 @@ } #dialogRemoveConfirm, -.dialog-prompt { +.dialog-prompt, +#dialogAlert { padding: 10px 20px 0; overflow: hidden; } diff --git a/static/js/dialog.js b/static/js/dialog.js index 1a675de..10a8183 100644 --- a/static/js/dialog.js +++ b/static/js/dialog.js @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -(function($) { +(function ($) { $.fn.extend({ dialog: { version: "0.0.1.7", @@ -24,7 +24,7 @@ var dpuuid = new Date().getTime(); var PROP_NAME = 'dialog'; - var Dialog = function() { + var Dialog = function () { this._defaults = { "styleClass": { "background": "dialog-background", @@ -41,7 +41,7 @@ }; $.extend(Dialog.prototype, { - _attach: function(target, settings) { + _attach: function (target, settings) { if (!target.id) { this.uuid++; target.id = 'dp' + this.uuid; @@ -53,21 +53,21 @@ this._init(target); }, /* Create a new instance object. */ - _newInst: function(target) { + _newInst: function (target) { // escape jQuery meta chars var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); return { id: id }; }, - _getInst: function(target) { + _getInst: function (target) { try { return $.data(target, PROP_NAME); } catch (err) { throw 'Missing instance data for this dialog'; } }, - _destroyDialog: function(target) { + _destroyDialog: function (target) { var inst = $.dialog._getInst(target); var id = inst.id; $.removeData(target, PROP_NAME); @@ -79,7 +79,7 @@ $("." + styleClass.background).remove(); $("#" + id + "Dialog").remove(); }, - _init: function(target) { + _init: function (target) { var inst = this._getInst(target); var id = inst.id, settings = inst.settings; @@ -99,13 +99,16 @@ headerHTML = "
" - + settings.title + "
"; // Sets footerHTML. if (!settings.hideFooter) { - footerHTML = ""; + } + footerHTML += ""; } @@ -147,16 +150,16 @@ }); // Bind event. - $("#" + id + "Dialog ." + styleClass.closeIcon).bind("click", function() { + $("#" + id + "Dialog ." + styleClass.closeIcon).bind("click", function () { $.dialog._close(id, settings); }); var $buttons = $("#" + id + "Dialog ." + styleClass.footer + " button"); - $($buttons.get(1)).bind("click", function() { + $($buttons.get(1)).bind("click", function () { $.dialog._close(id, settings); }); - $($buttons.get(0)).bind("click", function() { + $($buttons.get(0)).bind("click", function () { if (settings.ok === undefined || settings.ok()) { $.dialog._close(id, settings); } @@ -165,14 +168,14 @@ this._bindMove(id, styleClass.headerBg, dialogH, dialogW); // esc exit - $(window).keyup(function(event) { + $(window).keyup(function (event) { if (event.keyCode === 27) { $.dialog._close(id, settings); } }); }, - _bindMove: function(id, className) { - $("#" + id + "Dialog ." + className).mousedown(function(event) { + _bindMove: function (id, className) { + $("#" + id + "Dialog ." + className).mousedown(function (event) { var _document = document; if (!event) { event = window.event; @@ -190,7 +193,7 @@ window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP); } - _document.onmousemove = function(event) { + _document.onmousemove = function (event) { if (!event) { event = window.event; } @@ -212,7 +215,7 @@ dialog.style.top = positionY + "px"; }; - _document.onmouseup = function() { + _document.onmouseup = function () { if (this.releaseCapture) { this.releaseCapture(); } else if (window.captureEvents) { @@ -226,7 +229,7 @@ } }); }, - _close: function(id, settings) { + _close: function (id, settings) { if ($("#" + id + "Dialog").css("display") === "none") { return; } @@ -238,13 +241,13 @@ } } }, - _closeDialog: function(target) { + _closeDialog: function (target) { var inst = this._getInst(target); var id = inst.id, settings = inst.settings; $.dialog._close(id, settings); }, - _openDialog: function(target) { + _openDialog: function (target, msg) { var inst = this._getInst(target); var id = inst.id, settings = inst.settings; @@ -257,12 +260,12 @@ } $("#" + id + "Dialog .dialog-footer button:eq(0)").focus(); - + if (typeof settings.afterOpen === "function") { - settings.afterOpen(); + settings.afterOpen(msg); } }, - _updateDialog: function(target, data) { + _updateDialog: function (target, data) { var inst = this._getInst(target); var id = inst.id, settings = inst.settings; @@ -273,7 +276,7 @@ $dialog.css({ "top": data.position.top, "left": data.position.left - }) + }); } if (data.width) { @@ -307,7 +310,7 @@ } }, - _getDefaults: function(defaults, settings, key) { + _getDefaults: function (defaults, settings, key) { if (key === "styleClass") { if (settings.theme === "default" || settings.theme === undefined) { return defaults.styleClass; @@ -331,14 +334,14 @@ } }); - $.fn.dialog = function(options) { + $.fn.dialog = function (options) { var otherArgs = Array.prototype.slice.call(arguments); if (typeof options === 'string') { otherArgs.shift(); return $.dialog['_' + options + 'Dialog'].apply($.dialog, [this[0]].concat(otherArgs)); } - return this.each(function() { + return this.each(function () { $.dialog._attach(this, options); }); }; diff --git a/static/js/editor.js b/static/js/editor.js index 5abe475..cc43e1b 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -123,7 +123,7 @@ var editors = { }; CodeMirror.commands.gotoLine = function (cm) { - $("#dialogGoLinePrompt").dialog("open"); + $("#dialogGoLinePrompt").dialog("open"); }; CodeMirror.commands.doNothing = function (cm) { @@ -161,7 +161,7 @@ var editors = { dataType: "json", success: function (data) { if (!data.succ) { - alert(data.msg); + $("#dialogAlert").dialog("open", data.msg); return false; } diff --git a/static/js/tree.js b/static/js/tree.js index e48ec39..9287fe7 100644 --- a/static/js/tree.js +++ b/static/js/tree.js @@ -161,7 +161,7 @@ var tree = { dataType: "json", success: function (data) { if (!data.succ) { - alert(data.msg); + $("#dialogAlert").dialog("open", data.msg); return false; } diff --git a/static/js/wide.js b/static/js/wide.js index d97a7d1..3dc71f7 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -67,6 +67,17 @@ var wide = { curEditor: undefined, bottomWindowTab: undefined, _initDialog: function() { + $("#dialogAlert").dialog({ + "height": 26, + "width": 260, + "title": config.label.tip, + "hiddenOk": true, + "cancelText": config.label.confirm, + "afterOpen": function(msg) { + $("#dialogAlert").html(msg); + } + }); + $("#dialogRemoveConfirm").dialog({ "height": 26, "width": 260, @@ -115,7 +126,6 @@ var wide = { } }); - $(".dialog-prompt > input").keydown(function(event) { $(".dialog-prompt > .tip").text(''); diff --git a/view/index.html b/view/index.html index 644fbd6..dd6e973 100644 --- a/view/index.html +++ b/view/index.html @@ -172,6 +172,7 @@
{{.i18n.isDelete}} ?
+
@@ -193,6 +194,8 @@ "create": "{{.i18n.create}}", "create_file": "{{.i18n.create_file}}", "create_dir": "{{.i18n.create_dir}}", + "tip": "{{.i18n.tip}}", + "confirm": "{{.i18n.confirm}}" }, "channel": { "editor": '{{.conf.EditorChannel}}', From c82a1f124a5acb1d2abe1b8203a13c870e351206 Mon Sep 17 00:00:00 2001 From: Van Date: Wed, 24 Sep 2014 11:40:56 +0800 Subject: [PATCH 4/4] alert --- conf/wide.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/wide.json b/conf/wide.json index e7b7e05..51afa6f 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -21,7 +21,6 @@ "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello", "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time", "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg", - "D:\\go\\src\\pkg", "D:\\go\\src\\pkg\\archive", "D:\\go\\src\\pkg\\archive\\tar", "D:\\go\\src\\pkg\\archive\\tar\\testdata" @@ -29,9 +28,10 @@ "files": [ "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\1123", "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\123\\q.exe", - "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\2.json" + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\2.json", + "D:\\go\\src\\pkg\\archive\\tar\\testdata\\small.txt" ], - "currentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\123\\q.exe" + "currentFile": "D:\\go\\src\\pkg\\archive\\tar\\testdata\\small.txt" } } ]