add export and import for menu

This commit is contained in:
Van 2014-12-18 16:46:38 +08:00
parent dc31495232
commit cee226e672
2 changed files with 26 additions and 9 deletions

View File

@ -105,7 +105,7 @@ var tree = {
if (wide.curNode.iconSkin.indexOf("ico-ztree-dir") === 0) {
return true;
}
return false;
},
newFile: function (it) {
@ -132,7 +132,7 @@ var tree = {
return false;
}
}
$("#dialogRemoveConfirm").dialog("open");
},
rename: function (it) {
@ -141,7 +141,7 @@ var tree = {
return false;
}
}
$("#dialogRenamePrompt").dialog("open");
},
export: function (it) {
@ -237,6 +237,8 @@ var tree = {
},
onRightClick: function (event, treeId, treeNode) {
if (treeNode) {
menu.undisabled(['import', 'export']);
wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode);
@ -252,6 +254,8 @@ var tree = {
"left": event.clientX + "px",
"display": "block"
}).show();
menu.disabled(['import']);
} else { // 右击了目录
if (wide.curNode.removable) {
$dirRMenu.find(".remove").removeClass("disabled");
@ -278,6 +282,12 @@ var tree = {
if (treeNode) {
wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode);
menu.undisabled(['import', 'export']);
if (!tree.isDir()) { // 如果右击了文件
menu.disabled(['import']);
}
$("#files").focus();
}
}

View File

@ -42,7 +42,7 @@
<span>{{.i18n.file}}</span>
<div class="frame">
<ul>
<li class="save-all disabled" onclick="menu.saveAllFiles()">
<li class="save-all disabled" onclick="if (!$(this).hasClass('disabled')){menu.saveAllFiles()}">
<span class="font-ico ico-save"></span>
<span>{{.i18n.save_all_files}}</span>
<span class="fn-right ft-small">Shift-Ctrl-S</span>
@ -52,6 +52,13 @@
<span>{{.i18n.close_all_files}}</span>
</li>
<li class="hr"></li>
<li class="disabled import" onclick="if (!$(this).hasClass('disabled')){$('#importFileupload').click();}">
<span class="ico-import font-ico"></span> {{.i18n.import}}
</li>
<li class="disabled export" onclick="if (!$(this).hasClass('disabled')){tree.export(this);}">
<span class="ico-export font-ico"></span> {{.i18n.export}}
</li>
<li class="hr"></li>
<li onclick="menu.exit()">
<span class="font-ico ico-signout"></span>
<span>{{.i18n.exit}}</span>
@ -259,27 +266,27 @@
<span>{{.i18n.run}}</span>
<div class="frame">
<ul>
<li class="build disabled" onclick="menu.build()">
<li class="build disabled" onclick="if (!$(this).hasClass('disabled')){menu.build()}">
<span class="font-ico ico-build"></span>
<span>{{.i18n.build}}</span>
<span class="fn-right ft-small">F5</span>
</li>
<li class="run disabled" onclick="menu.run()">
<li class="run disabled" onclick="if (!$(this).hasClass('disabled')){menu.run()}">
<span class="font-ico ico-buildrun"></span>
<span>{{.i18n.build_n_run}}</span>
<span class="fn-right ft-small">F6</span>
</li>
<li class="hr"></li>
<li class="go-test disabled" onclick="menu.test()">
<li class="go-test disabled" onclick="if (!$(this).hasClass('disabled')){menu.test()}">
<span class="space"></span>
<span>{{.i18n.test}}</span>
</li>
<li class="hr"></li>
<li class="go-get disabled" onclick="menu.goget()">
<li class="go-get disabled" onclick="if (!$(this).hasClass('disabled')){menu.goget()}">
<span class="space"></span>
<span>{{.i18n.goget}}</span>
</li>
<li class="go-install disabled" onclick="menu.goinstall()">
<li class="go-install disabled" onclick="if (!$(this).hasClass('disabled')){menu.goinstall()}">
<span class="space"></span>
<span>{{.i18n.goinstall}}</span>
</li>