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 if (this.perspective_id) {
16 document.location.hash = '#' + this.perspective_id;
19 console.log(document.location.hash);
22 $.wiki.Perspective.prototype.onExit = function () {
23 // called when user switches to another perspective
26 $.wiki.Perspective.prototype.freezeState = function () {
27 // free UI state (don't store data here)
30 $.wiki.Perspective.prototype.unfreezeState = function (frozenState) {
34 $.wiki.renderStub = function($container, $stub, data)
36 var $elem = $stub.clone();
37 $elem.removeClass('row-stub');
38 $container.append($elem);
40 $('*[data-stub-value]', $elem).each(function() {
42 var field = $this.attr('data-stub-value');
43 var value = data[field];
45 if(value === null || value === undefined) return;
47 if(!$this.attr('data-stub-target')) {
51 $this.attr($this.attr('data-stub-target'), value);
52 $this.removeAttr('data-stub-target');
53 $this.removeAttr('data-stub-value');