Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added basic version of cell and container
- Loading branch information
Stanislas Polu
committed
Apr 18, 2012
1 parent
9087582
commit 8e8e5a1
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/************************************/ | ||
/* BASIC CELL */ | ||
/************************************/ | ||
|
||
var basic_c = function(spec, my) { | ||
var _super = {}; | ||
var my = my || {}; | ||
|
||
// public | ||
var build; /* build(); */ | ||
var refresh; /* refresh(); */ | ||
|
||
// private | ||
|
||
var that = CELL.cell(spec, my); | ||
|
||
/** | ||
* builds the cell static content | ||
*/ | ||
build = function() { | ||
// ... | ||
}; | ||
|
||
/** | ||
* refreshes the cell content with received data | ||
* @expected { ... } | ||
*/ | ||
refresh = function(json) { | ||
// ... | ||
_super.refresh(json); | ||
}; | ||
|
||
|
||
CELL.method(that, 'build', build, _super); | ||
CELL.method(that, 'refresh', refresh, _super); | ||
|
||
return that; | ||
}; | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/************************************/ | ||
/* BASIC CONTAINER */ | ||
/************************************/ | ||
/** | ||
* @param sepc {} | ||
*/ | ||
var basic_t = function(spec, my) { | ||
var _super = {}; | ||
var my = my || {}; | ||
|
||
// public | ||
var load; /* load(); */ | ||
var refresh; /* refresh(); */ | ||
|
||
// private | ||
|
||
var that = CELL.container({ name: 'basic' }, my); | ||
|
||
/** | ||
* loads children cells within the DOM | ||
*/ | ||
load = function() { | ||
var elem = $('#some_id'); | ||
|
||
// Construction | ||
my.children['basic'] = basic_c({ path: my.path + '/basic', container: that }); | ||
elem.append(my.children['menu'].build()); | ||
|
||
// Handlers | ||
my.children['basic'].on('some_event', function() { | ||
// ... | ||
}); | ||
|
||
// Start Updates | ||
}; | ||
|
||
/** | ||
* refreshes the UI with new version of data | ||
*/ | ||
refresh = function() { | ||
// ... | ||
_super.refresh(); | ||
}; | ||
|
||
|
||
CELL.method(that, 'load', load, _super); | ||
CELL.method(that, 'refresh', refresh, _super); | ||
|
||
return that; | ||
}; |