File tree Expand file tree Collapse file tree 7 files changed +58
-5
lines changed Expand file tree Collapse file tree 7 files changed +58
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ var Q = require("q");
5
5
var Application = require ( "hr.app" ) ;
6
6
var GridView = require ( "hr.gridview" ) ;
7
7
8
+ var workspace = require ( "./workspace" ) ;
9
+
8
10
// Define base application
9
11
var CodeboxApplication = Application . extend ( {
10
12
el : null ,
@@ -24,6 +26,7 @@ var CodeboxApplication = Application.extend({
24
26
} ,
25
27
26
28
render : function ( ) {
29
+ this . head . title ( workspace . get ( 'title' ) ) ;
27
30
return this . ready ( ) ;
28
31
} ,
29
32
Original file line number Diff line number Diff line change
1
+ var Workspace = require ( "../models/workspace" ) ;
2
+
3
+ module . exports = new Workspace ( ) ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var app = require("./core/application");
12
12
var commands = require ( "./core/commands" ) ;
13
13
var packages = require ( "./core/packages" ) ;
14
14
var user = require ( "./core/user" ) ;
15
+ var workspace = require ( "./core/workspace" ) ;
15
16
var users = require ( "./core/users" ) ;
16
17
var settings = require ( "./core/settings" ) ;
17
18
var dialogs = require ( "./utils/dialogs" ) ;
@@ -27,6 +28,7 @@ window.codebox = {
27
28
require : codeboxRequire ,
28
29
app : app ,
29
30
user : user ,
31
+ workspace : workspace ,
30
32
root : new File ( ) ,
31
33
settings : settings
32
34
} ;
@@ -48,10 +50,15 @@ commands.register({
48
50
// Start running the applications
49
51
logger . log ( "start application" ) ;
50
52
Q . delay ( 500 )
51
- . then ( codebox . user . whoami . bind ( codebox . user ) )
52
- . then ( codebox . root . stat . bind ( codebox . root , "./" ) )
53
- . then ( settings . load . bind ( settings ) )
54
- . then ( users . listAll . bind ( users ) )
53
+ . then ( function ( ) {
54
+ return Q . all ( [
55
+ codebox . user . whoami ( ) ,
56
+ codebox . root . stat ( './' ) ,
57
+ codebox . workspace . about ( ) ,
58
+ settings . load ( ) ,
59
+ users . listAll ( )
60
+ ] ) ;
61
+ } )
55
62
. then ( function ( ) {
56
63
return packages . loadAll ( )
57
64
. fail ( function ( err ) {
Original file line number Diff line number Diff line change
1
+ var Q = require ( "q" ) ;
2
+ var _ = require ( "hr.utils" ) ;
3
+ var Model = require ( "hr.model" ) ;
4
+ var logger = require ( "hr.logger" ) ( "workspace" ) ;
5
+
6
+ var rpc = require ( "../core/rpc" ) ;
7
+
8
+ var Workspace = Model . extend ( {
9
+ defaults : {
10
+ id : "" ,
11
+ title : ""
12
+ } ,
13
+
14
+ // Identify the workspace
15
+ about : function ( ) {
16
+ var that = this ;
17
+
18
+ return rpc . execute ( "codebox/about" )
19
+ . then ( function ( data ) {
20
+ return that . set ( data ) ;
21
+ } )
22
+ . thenResolve ( that ) ;
23
+ } ,
24
+ } ) ;
25
+
26
+ module . exports = Workspace ;
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ module.exports = function(options) {
14
14
// Root folder
15
15
'root' : process . cwd ( ) ,
16
16
17
+ // Workspace title
18
+ 'title' : "Codebox" ,
19
+
17
20
// Workspace id
18
21
'id' : null ,
19
22
Original file line number Diff line number Diff line change @@ -2,9 +2,13 @@ var fs = require("fs");
2
2
var path = require ( "path" ) ;
3
3
var pkg = require ( "../../package.json" ) ;
4
4
5
+ var workspace = require ( '../workspace' ) ;
6
+
5
7
// About this current version
6
8
var about = function ( args ) {
7
9
return {
10
+ 'id' : workspace . config ( 'id' ) ,
11
+ 'title' : workspace . config ( 'title' ) ,
8
12
'version' : pkg . version
9
13
} ;
10
14
} ;
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ var events = require('./events');
6
6
var logger = require ( './utils/logger' ) ( "workspace" ) ;
7
7
8
8
var root = null ;
9
+ var _config = { } ;
9
10
10
11
// Init the workspace
11
12
var init = function ( config ) {
13
+ _config = config ;
12
14
root = path . resolve ( config . root ) ;
13
15
14
16
logger . log ( "Working on " , root ) ;
@@ -38,5 +40,10 @@ module.exports = {
38
40
init : init ,
39
41
path : getPath ,
40
42
relative : relativePath ,
41
- root : function ( ) { return root ; }
43
+ root : function ( ) { return root ; } ,
44
+ config : function ( str ) {
45
+ return str . split ( '.' ) . reduce ( function ( obj , i ) {
46
+ return obj [ i ] ;
47
+ } , _config ) ;
48
+ }
42
49
} ;
You can’t perform that action at this time.
0 commit comments