文件树添加 tab

This commit is contained in:
Van 2014-09-25 11:04:17 +08:00
parent 728e1f4919
commit 05477a298b
7 changed files with 80 additions and 61 deletions

View File

@ -15,9 +15,19 @@
"Password": "admin", "Password": "admin",
"Workspace": "{pwd}/data/user_workspaces/admin", "Workspace": "{pwd}/data/user_workspaces/admin",
"LatestSessionContent": { "LatestSessionContent": {
"FileTree": [], "FileTree": [
"Files": [], "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest",
"CurrentFile": "" "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"
],
"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\\time\\main.go",
"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\\1123"
} }
} }
] ]

View File

@ -37,5 +37,8 @@
"input_no_empty": "输入不能为空", "input_no_empty": "输入不能为空",
"tip": "提示", "tip": "提示",
"confirm": "确定", "confirm": "确定",
"stop": "停止" "stop": "停止",
"output": "输出",
"search": "搜索",
"notification": "通知"
} }

View File

@ -136,19 +136,24 @@ ul {
height: 20px; height: 20px;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
background-color: #E6E6E6;
border-top: 1px solid #A4A4A4;
border-bottom: 1px solid #9D9D9D;
} }
.tabs > div { .tabs > div {
background-color: #d1d1d1;
border-right: 1px solid #9b9b9b;
color: #333;
float: left; float: left;
line-height: 19px; line-height: 19px;
padding: 0 5px padding: 0 5px;
cursor: pointer;
background-color: #DDD;
color: #8B8B8B;
border-right: 1px solid #ADADAD;
} }
.tabs > div.current { .tabs > div.current {
background-color: #F7F7F7; background-color: #9F9F9F;
color: #FFF;
} }
/* end tabs */ /* end tabs */
@ -174,8 +179,7 @@ ul {
/* start menu */ /* start menu */
.menu { .menu {
background-color: #F0F0F0; background-color: #F0F0F0;
border-bottom: 1px solid #A5A5A5; height: 24px;
height: 25px;
} }
.menu > ul > li { .menu > ul > li {
@ -214,6 +218,17 @@ ul {
height: 70%; height: 70%;
} }
.edit-panel .tabs > div {
background-color: #d1d1d1;
border-right-color: #9b9b9b;
color: #333;
cursor: auto;
}
.edit-panel .tabs > div.current {
background-color: #F7F7F7;
}
.edit-header .ico { .edit-header .ico {
background-image: url("../images/ico-file.png"); background-image: url("../images/ico-file.png");
float: left; float: left;
@ -248,24 +263,6 @@ ul {
z-index: 1000; z-index: 1000;
} }
.bottom-window-group .tabs {
background-color: #E6E6E6;
border-top: 1px solid #A4A4A4;
border-bottom: 1px solid #9D9D9D;
}
.bottom-window-group .tabs > div {
cursor: pointer;
background-color: #DDD;
color: #8B8B8B;
border-right-color: #ADADAD;
}
.bottom-window-group .tabs > div.current {
background-color: #9F9F9F;
color: #FFF;
}
.bottom-window-group textarea.output { .bottom-window-group textarea.output {
border-width: 0; border-width: 0;
background-color: #FFF; background-color: #FFF;

View File

@ -1,7 +1,11 @@
/* start side */
.side .tabs-panel {
overflow: auto;
}
/* start side */
/* start tree */ /* start tree */
.ztree { .ztree {
position: absolute;
overflow: auto;
width: 100%; width: 100%;
padding: 0; padding: 0;
} }

View File

@ -1,4 +1,5 @@
var tree = { var tree = {
fileTree: undefined,
// 递归获取当前节点展开中的最后一个节点 // 递归获取当前节点展开中的最后一个节点
getCurrentNodeLastNode: function (node) { getCurrentNodeLastNode: function (node) {
var returnNode = node.children[node.children.length - 1]; var returnNode = node.children[node.children.length - 1];
@ -60,7 +61,6 @@ var tree = {
return paths; return paths;
}, },
fileTree: undefined,
_isParents: function (tId, parentTId) { _isParents: function (tId, parentTId) {
var node = tree.fileTree.getNodeByTId(tId); var node = tree.fileTree.getNodeByTId(tId);
if (!node || !node.parentTId) { if (!node || !node.parentTId) {

View File

@ -212,9 +212,10 @@ var wide = {
_initLayout: function () { _initLayout: function () {
var mainH = $(window).height() - $(".menu").height() - $(".footer").height() - 2, var mainH = $(window).height() - $(".menu").height() - $(".footer").height() - 2,
bottomH = Math.floor(mainH * 0.3); bottomH = Math.floor(mainH * 0.3);
$(".content, .ztree").height(mainH); $(".content").height(mainH);
$(".side .tabs-panel").height(mainH - 20);
$(".bottom-window-group .output, notification").height(bottomH - 23); $(".bottom-window-group .output, notification").height(bottomH - 24);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20); $(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20);
}, },
_initBottomWindowGroup: function () { _initBottomWindowGroup: function () {
@ -304,19 +305,19 @@ var wide = {
var bottomH = $(".bottom-window-group").height(); var bottomH = $(".bottom-window-group").height();
$(".bottom-window-group .output, notification").height(bottomH - 23); $(".bottom-window-group .output, notification").height(bottomH - 24);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20); $(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20);
} else { } else {
var bottomH = $(".content, .ztree").height(); var bottomH = $(".content, .ztree").height();
$(".bottom-window-group .output, notification").height(bottomH - 22); $(".bottom-window-group .output, notification").height(bottomH - 23);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 19); $(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 19);
$(".bottom-window-group").addClass("bottom-window-group-fullscreen"); $(".bottom-window-group").addClass("bottom-window-group-fullscreen");
} }
}); });
$(".side").dblclick(function () { $(".side .tabs").dblclick(function () {
var $it = $(this); var $it = $(".side");
if ($it.hasClass("side-fullscreen")) { if ($it.hasClass("side-fullscreen")) {
$it.removeClass("side-fullscreen"); $it.removeClass("side-fullscreen");
} else { } else {

View File

@ -105,26 +105,30 @@
<div class="content"> <div class="content">
<div class="side"> <div class="side">
<div class="side-1"> <div class="tabs">
<ul id="files" tabindex="-1" class="ztree"></ul> <div class="current" data-index="filreTree">
<span title="{{.i18n.file}}">{{.i18n.file}}</span>
<!-- 目录右键菜单 -->
<div id="dirRMenu" class="frame">
<ul>
<li onclick="tree.newFile();">{{.i18n.create_file}}</li>
<li onclick="tree.newDir();">{{.i18n.create_dir}}</li>
<li onclick="tree.removeIt();">{{.i18n.delete}}</li>
</ul>
</div>
<!-- 文件右键菜单 -->
<div id="fileRMenu" class="frame">
<ul>
<li onclick="tree.removeIt();">{{.i18n.delete}}</li>
</ul>
</div> </div>
</div> </div>
<div class="side-2"> <div class="tabs-panel">
<div data-index="filreTree">
<ul id="files" tabindex="-1" class="ztree"></ul>
<!-- 目录右键菜单 -->
<div id="dirRMenu" class="frame">
<ul>
<li onclick="tree.newFile();">{{.i18n.create_file}}</li>
<li onclick="tree.newDir();">{{.i18n.create_dir}}</li>
<li onclick="tree.removeIt();">{{.i18n.delete}}</li>
</ul>
</div>
<!-- 文件右键菜单 -->
<div id="fileRMenu" class="frame">
<ul>
<li onclick="tree.removeIt();">{{.i18n.delete}}</li>
</ul>
</div>
</div>
</div> </div>
</div> </div>
@ -138,13 +142,13 @@
<div class="bottom-window-group"> <div class="bottom-window-group">
<div class="tabs"> <div class="tabs">
<div class="current" data-index="output"> <div class="current" data-index="output">
<span title="Output">Output</span> <span title="{{.i18n.output}}">{{.i18n.output}}</span>
</div> </div>
<div data-index="search"> <div data-index="search">
<span title="Search">Search</span> <span title="{{.i18n.search}}">{{.i18n.search}}</span>
</div> </div>
<div data-index="notification"> <div data-index="notification">
<span title="Notification">Notification</span> <span title="{{.i18n.notification}}">{{.i18n.notification}}</span>
</div> </div>
</div> </div>
<div class="tabs-panel"> <div class="tabs-panel">
@ -164,7 +168,7 @@
<div class="footer"> <div class="footer">
<span>|</span> <span>|</span>
<span id="footer-cursor" style="float: right;"></span> <span id="footer-cursor" style="float: right;"></span>
<span class="notification-count" title="{{.i18n.unread_notification}}">Notification!</span> <span class="notification-count" title="{{.i18n.unread_notification}}">{{.i18n.notification}}!</span>
</div> </div>
<div id="dialogRemoveConfirm"> <div id="dialogRemoveConfirm">