-
Notifications
You must be signed in to change notification settings - Fork 1
/
core.js
65 lines (48 loc) · 1.7 KB
/
core.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// ==========================================================================
// Project: Greenhouse
// Copyright: ©2010 Mike Ball
// ==========================================================================
/*globals Greenhouse */
//better default state name...
SC.DEFAULT_TREE = 'main';
/**
My cool new app. Describe your application.
@extends SC.Object
*/
Greenhouse = SC.Object.create(
/** @scope Greenhouse.prototype */ {
NAMESPACE: 'Greenhouse',
VERSION: '0.1.0',
/*
types fom json
*/
FILE: 'file',
DIR: 'dir',
store: SC.Store.create().from('Greenhouse.DataSource'),
//statechart options
monitorIsActive: YES,
loadIframeWithPage: function(firstTime){
var c = Greenhouse.fileController.get('content'), iframe = Greenhouse.get('iframe'), namespace, page;
var r = c.get('pageRegex'), mainPane;
namespace = r[1];
page = r[2];
if(namespace && page && iframe){
if(iframe[namespace] && !iframe[namespace][page]) iframe.eval(c.get('body'));
//just change main view for now...
namespace = iframe[namespace];
//setup the designer container
if(firstTime){
mainPane = iframe.SC.designPage.get('designMainPane');
mainPane.append();
}
//get the designs...
namespace[page].set('needsDesigner', YES);
this.pageController.set('content', namespace[page]);
iframe.SC.RunLoop.begin();
if(!firstTime) iframe.SC.designController.set('content', null);
iframe.SC.designsController.setDesigns(namespace[page],iframe);
iframe.SC.designPage.designMainPane.viewList.contentView.set('content', Greenhouse.iframe.SC.designsController.get('content'));
iframe.SC.RunLoop.end();
}
}
});