Changeset 260 for Dev/branches/rest-dojo-ui/client/rft/content.js
- Timestamp:
- 02/14/12 18:22:25 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/content.js
r257 r260 1 define(['dojo/_base/declare','dojo/_base/connect','dojo/_base/xhr','dojo/_base/lang','dojo/_base/Deferred','dojo/hash','dojo/io-query','dijit/registry','dijit','rft/util','rft/ui/Page'], 2 function(declare,connect,xhr,lang,Deferred,hash,uriQuery,registry,dijit,util,Page){ 1 define(['dojo/_base/declare','dojo/_base/connect','dojo/_base/xhr','dojo/dom-construct', 2 'dojo/dom-attr','dojo/_base/lang','dojo/_base/Deferred','dojo/hash', 3 'dojo/io-query','dojo/_base/json','dijit','rft/util'], 4 function(declare,connect,xhr,domConstruct,attr,lang,Deferred,hash,uriQuery,json,dijit,util){ 3 5 return new (function() { 4 6 var self = this; … … 6 8 7 9 var HRI = declare(null,{ 8 constructor: function() {10 constructor: function() { 9 11 this._path = '/'; 10 12 this._args = {}; … … 61 63 hash(newHash,replace); 62 64 xhr.get({ 63 url: 'pages'+hri.path()+'.html' 65 url: 'pages'+hri.path()+'.html', 66 failOk: true 64 67 }) 65 68 .then(function(html){ 66 contentPane.set('content',html); 67 var widgets = registry.findWidgets(contentPane.containerNode); 68 for(var i in widgets) { 69 if ( widgets[i].isInstanceOf(Page) ) { 70 widgets[i].init(hri.args()); 71 break; 72 } 73 } 69 var root = domConstruct.toDom(html) 70 var props = json.toJson(hri.args()); 71 props = props.slice(1,props.length-2); 72 if ( props ) 73 attr.set(root,'data-rft-props',props); 74 contentPane.set('content',root); 74 75 d.resolve(); 75 76 },function(){ … … 82 83 self.initial = function(path,args) { 83 84 if ( current ) { 84 return; 85 var dfd = new Deferred(); 86 dfd.resolved(); 87 return dfd.promise; 85 88 } 86 89 if ( hash() ) { 87 90 var hri = new HRI(hash()); 88 _goTo(hri, true);91 return _goTo(hri, true); 89 92 } else { 90 _goTo(new HRI(path,args));93 return _goTo(new HRI(path,args)); 91 94 } 92 95 } 93 96 94 97 self.goTo = function(path,args) { 95 _goTo(new HRI(path,args));98 return _goTo(new HRI(path,args)); 96 99 } 97 100
Note: See TracChangeset
for help on using the changeset viewer.