菜单起始页
This commit is contained in:
parent
d018b7d801
commit
1e4b5ab3b4
|
@ -17,11 +17,12 @@
|
||||||
"Workspace": "{pwd}/data/user_workspaces/admin",
|
"Workspace": "{pwd}/data/user_workspaces/admin",
|
||||||
"LatestSessionContent": {
|
"LatestSessionContent": {
|
||||||
"FileTree": [
|
"FileTree": [
|
||||||
"D:\\GoGoGo\\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",
|
||||||
"D:\\GoGoGo\\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\\hello"
|
||||||
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time"
|
],
|
||||||
|
"Files": [
|
||||||
|
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go"
|
||||||
],
|
],
|
||||||
"Files": [],
|
|
||||||
"CurrentFile": ""
|
"CurrentFile": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,15 +76,14 @@ var editors = {
|
||||||
});
|
});
|
||||||
|
|
||||||
this._initCodeMirrorHotKeys();
|
this._initCodeMirrorHotKeys();
|
||||||
this._initStartPage()
|
this.openStartPage()
|
||||||
},
|
},
|
||||||
_initStartPage: function () {
|
openStartPage: function () {
|
||||||
editors.tabs.add({
|
editors.tabs.add({
|
||||||
id: "startPage",
|
id: "startPage",
|
||||||
title: '<span title="' + config.label.initialise + '">' + config.label.initialise + '</span>',
|
title: '<span title="' + config.label.initialise + '">' + config.label.initialise + '</span>',
|
||||||
content: '<div id="startPage"></div>'
|
content: '<div id="startPage"></div>',
|
||||||
});
|
after: function () {
|
||||||
|
|
||||||
$("#startPage").load('/start');
|
$("#startPage").load('/start');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "http://symphony.b3log.org/apis/articles?tags=wide,golang&p=1&size=30",
|
url: "http://symphony.b3log.org/apis/articles?tags=wide,golang&p=1&size=30",
|
||||||
|
@ -120,6 +119,8 @@ var editors = {
|
||||||
$("#startPage .news").html(listHTML);
|
$("#startPage .news").html(listHTML);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getCurrentId: function () {
|
getCurrentId: function () {
|
||||||
var currentId = editors.tabs.getCurrentId();
|
var currentId = editors.tabs.getCurrentId();
|
||||||
|
|
|
@ -25,7 +25,25 @@ $.extend(Tabs.prototype, {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
_hasId: function (id) {
|
||||||
|
var $tabs = this.obj._$tabs;
|
||||||
|
if ($tabs.find("div[data-index=" + id + "]").length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
add: function (data) {
|
add: function (data) {
|
||||||
|
// 添加当前 tab
|
||||||
|
if (this.getCurrentId() === data.id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前 tab 已经存在
|
||||||
|
if (this._hasId(data.id)) {
|
||||||
|
this.setCurrent(data.id);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var $tabsPanel = this.obj._$tabsPanel,
|
var $tabsPanel = this.obj._$tabsPanel,
|
||||||
$tabs = this.obj._$tabs;
|
$tabs = this.obj._$tabs;
|
||||||
|
|
||||||
|
@ -38,6 +56,10 @@ $.extend(Tabs.prototype, {
|
||||||
+ data.title + '<span class="ico-close font-ico"></span></div>');
|
+ data.title + '<span class="ico-close font-ico"></span></div>');
|
||||||
$tabsPanel.append('<div data-index="' + data.id + '">' + data.content
|
$tabsPanel.append('<div data-index="' + data.id + '">' + data.content
|
||||||
+ '</div>');
|
+ '</div>');
|
||||||
|
|
||||||
|
if (typeof data.after === 'function') {
|
||||||
|
data.after();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
del: function (id) {
|
del: function (id) {
|
||||||
var $tabsPanel = this.obj._$tabsPanel,
|
var $tabsPanel = this.obj._$tabsPanel,
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
{{.i18n.report_issues}}
|
{{.i18n.report_issues}}
|
||||||
</li>
|
</li>
|
||||||
<li class="hr"></li>
|
<li class="hr"></li>
|
||||||
<li onclick="window.open('/doc/{{.locale}}/index.html')">
|
<li onclick="editors.openStartPage()">
|
||||||
<span>{{.i18n.start_page}}</span>
|
<span>{{.i18n.start_page}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li onclick="window.open('/doc/{{.locale}}/index.html')">
|
<li onclick="window.open('/doc/{{.locale}}/index.html')">
|
||||||
|
|
Loading…
Reference in New Issue