5 $.wiki.Perspective = function(document, callback) {
9 $.wiki.Perspective.toString = function() {
10 return this.perspective_id;
13 $.wiki.Perspective.prototype.onEnter = function () {
14 // called when perspective in initialized
15 document.location.hash = '#' + this.perspective_id;
16 console.log(document.location.hash);
19 $.wiki.Perspective.prototype.onExit = function () {
20 // called when user switches to another perspective
23 $.wiki.Perspective.prototype.freezeState = function () {
24 // free UI state (don't store data here)
27 $.wiki.Perspective.prototype.unfreezeState = function (frozenState) {
31 $.wiki.renderStub = function($container, $stub, data)
33 var $elem = $stub.clone();
34 $elem.removeClass('row-stub');
35 $container.append($elem);
37 $('*[data-stub-value]', $elem).each(function() {
39 var field = $this.attr('data-stub-value');
40 var value = data[field];
42 if(value === null || value === undefined) return;
44 if(!$this.attr('data-stub-target')) {
48 $this.attr($this.attr('data-stub-target'), value);
49 $this.removeAttr('data-stub-target');
50 $this.removeAttr('data-stub-value');