Skip to content

Commit ad8a535

Browse files
committed
Improve new file management and start improving lateral menu
1 parent 5ea97ac commit ad8a535

8 files changed

Lines changed: 80 additions & 57 deletions

File tree

client/core/files.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ define([
4040
handler.open = function(file) {
4141
var path = file.path();
4242
var manager = tabs.manager();
43-
var uniqueId = handler.id+":"+path;
43+
var uniqueId = handler.id+":"+file.syncEnvId();
4444

4545
var tab = manager.getActiveTabByType("directory");
4646
if (tab != null && !manager.checkTabExists(uniqueId) && !file.isNewfile()) {
@@ -122,6 +122,8 @@ define([
122122
// Open a new file
123123
var openNew = function(name) {
124124
name = name || "untitled";
125+
126+
// Create a temporary file
125127
var f = new File({
126128
'codebox': box
127129
}, {
@@ -132,7 +134,6 @@ define([
132134
'href': location.protocol+"//"+location.host+"/vfs/"+name,
133135
'exists': false
134136
});
135-
console.log(f, f.filename(), f.path());
136137
return openFile(f);
137138
};
138139

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
#codebox .layout-body {
2-
position: absolute;
3-
top: 0px;
4-
left: @codeboxLateralbarWidth+@codeboxMenubarWidth;
5-
right: 0px;
6-
bottom: 0px;
7-
background: #ddd;
1+
#codebox {
2+
.layout-body {
3+
position: absolute;
4+
top: 0px;
5+
left: @codeboxLateralbarWidth+@codeboxMenubarWidth;
6+
right: 0px;
7+
bottom: 0px;
8+
background: #ddd;
9+
.transition(left @lateralTransitionSpeed);
10+
}
11+
12+
&.mode-body-fullpage:not(.mode-search) {
13+
.layout-body {
14+
left: @codeboxMenubarWidth;
15+
}
16+
}
817
}
Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,58 @@
1-
#codebox .layout-lateralbar {
2-
@transitionSpeed: 600ms;
1+
#codebox {
2+
.layout-lateralbar {
3+
@transitionSpeed: 600ms;
34

4-
position: absolute;
5-
top: 0px;
6-
left: 0px;
7-
bottom: 0px;
8-
overflow: hidden;
9-
width: @codeboxMenubarWidth+@codeboxLateralbarWidth;
10-
background: @codeboxLateralbarBackground;
11-
box-shadow: inset -8px 0px 9px -9px #000000;
12-
color: @codeboxLateralbarColor;
13-
text-shadow: 0px 0px 2px rgba(0,0,0,0.6);
14-
15-
.lateral-menu {
165
position: absolute;
17-
left: 0px;
18-
width: @codeboxMenubarWidth;
196
top: 0px;
7+
left: 0px;
208
bottom: 0px;
21-
.transition(all @transitionSpeed);
9+
overflow: hidden;
10+
width: @codeboxMenubarWidth+@codeboxLateralbarWidth;
11+
background: @codeboxLateralbarBackground;
12+
box-shadow: inset -8px 0px 9px -9px #000000;
13+
color: @codeboxLateralbarColor;
14+
text-shadow: 0px 0px 2px rgba(0,0,0,0.6);
15+
.transition(width @lateralTransitionSpeed);
16+
17+
.lateral-menu {
18+
position: absolute;
19+
left: 0px;
20+
width: @codeboxMenubarWidth;
21+
top: 0px;
22+
bottom: 0px;
23+
.transition(all @transitionSpeed);
2224

23-
.menu-section {
24-
margin-bottom: 10px;
25+
.menu-section {
26+
margin-bottom: 10px;
2527

26-
&.menu-bottom {
27-
position: absolute;
28-
bottom: 0px;
29-
margin: 0px;
28+
&.menu-bottom {
29+
position: absolute;
30+
bottom: 0px;
31+
margin: 0px;
32+
}
3033
}
3134
}
32-
}
3335

34-
.lateral-body {
35-
position: absolute;
36-
top: 0px;
37-
left: @codeboxMenubarWidth;
38-
bottom: 0px;
39-
width: @codeboxLateralbarWidth;
40-
overflow-y: auto;
41-
overflow-x: hidden;
42-
.transition(all @transitionSpeed);
36+
.lateral-body {
37+
position: absolute;
38+
top: 0px;
39+
left: @codeboxMenubarWidth;
40+
bottom: 0px;
41+
width: @codeboxLateralbarWidth;
42+
overflow-y: auto;
43+
overflow-x: hidden;
44+
.transition(all @transitionSpeed);
4345

44-
>.files {
45-
margin: 4px 0px;
46-
font-size: 15px;
46+
>.files {
47+
margin: 4px 0px;
48+
font-size: 15px;
49+
}
4750
}
48-
}
4951

50-
.searchbar {
51-
left: @codeboxMenubarWidth+@codeboxLateralbarWidth;
52-
.transition(all @transitionSpeed);
52+
.searchbar {
53+
left: @codeboxMenubarWidth+@codeboxLateralbarWidth;
54+
.transition(all @transitionSpeed);
55+
}
5356
}
5457

5558
&.mode-search {
@@ -63,4 +66,10 @@
6366
left: -(@codeboxMenubarWidth+2*@codeboxLateralbarWidth);
6467
}
6568
}
69+
70+
&.mode-body-fullpage:not(.mode-search) {
71+
.layout-lateralbar {
72+
width: @codeboxMenubarWidth;
73+
}
74+
}
6675
}

client/resources/stylesheets/variables.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
@codeboxLateralbarWidth: 232px;
1818
@codeboxLateralbarBackground: #23252B;
1919
@codeboxLateralbarColor: #dadde0;
20+
@lateralTransitionSpeed: 600ms;
2021

2122
/* Body Tabs */
2223
@tabMarginTop: 6px;

client/resources/templates/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% if (session.box.isAuth()) { %>
2-
<div id="codebox">
2+
<div id="codebox" class="mode-body-fullpage">
33
<!-- Lateral bar -->
44
<%= view.component("layout.lateralbar", {}, "lateralbar") %>
55

client/utils/filesync.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ define([
318318
this.trigger("mode", this.file.mode());
319319
if (options.autoload) {
320320
this.on("file:path", function(path) {
321-
console.log("update file with path ", path);
322321
this.file.getByPath(path);
323322
}, this);
324323
}

client/views/layouts/lateralbar.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ define([
4545
args = _.defaults({}, args || {}, {
4646
'path': "/"
4747
});
48-
files.open(args.path).fail(function(err) {
49-
console.error(err);
50-
});
48+
files.open(args.path);
5149
});
5250

5351
commands.register("files.new", {
@@ -82,16 +80,22 @@ define([
8280

8381
// (action) Toggle search
8482
toggleSearch: function(st, query) {
85-
this.$el.toggleClass("mode-search", st);
83+
$("#codebox").toggleClass("mode-search", st);
8684

87-
st = this.$el.hasClass("mode-search");
85+
st = $("#codebox").hasClass("mode-search");
8886
if (!st) {
8987
query = "";
9088
this.components.search.clearResults();
9189
} else {
9290
this.components.search.focus();
9391
}
9492
if (query != null) this.$(".search-query").val(query);
93+
},
94+
95+
// (action) Toggle lateral bar
96+
toggleBar: function(st) {
97+
if (st != null) st = !st;
98+
$("#codebox").toggleClass("mode-body-fullpage", st);
9599
}
96100
});
97101

client/views/tabs/file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ define([
5959
adaptFile: function() {
6060
this.setTabTitle(this.model.get("name", "loading..."));
6161
this.setTabType(this.model.isDirectory() ? "directory" : "file");
62-
this.setTabId(this.model.path());
62+
this.setTabId(this.fileHandler.id+":"+this.model.syncEnvId());
6363
return this;
6464
}
6565
});

0 commit comments

Comments
 (0)