|
@@ -85,18 +85,32 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else if(navState.example !== prevNavState.example) {
|
|
else if(navState.example !== prevNavState.example) {
|
|
|
- rp.get('/parts/' + navState.repo + '/' + navState.example, 'json')
|
|
|
|
|
- .then(function(parts) {
|
|
|
|
|
- console.log('nav: example changed', parts);
|
|
|
|
|
- _ws.example = parts.example;
|
|
|
|
|
- _ws.files = parts.files;
|
|
|
|
|
- console.log(_ws.ui);
|
|
|
|
|
- // renderDetailsExample(parts);
|
|
|
|
|
- _ws.ui.detailsExample.render(parts);
|
|
|
|
|
- _ws.ui.editor.render(parts);
|
|
|
|
|
- _ws.ui.tabs.render(parts);
|
|
|
|
|
- _ws.ui.sandboxIframe.render(navState);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if(navState.example !== '') {
|
|
|
|
|
+ rp.get('/parts/' + navState.repo + '/' + navState.example, 'json')
|
|
|
|
|
+ .then(function(parts) {
|
|
|
|
|
+ console.log('nav: example changed', parts);
|
|
|
|
|
+ _ws.example = parts.example;
|
|
|
|
|
+ _ws.files = parts.files;
|
|
|
|
|
+ console.log(_ws.ui);
|
|
|
|
|
+ // renderDetailsExample(parts);
|
|
|
|
|
+ $('#editor-wrapper').show();
|
|
|
|
|
+ _ws.ui.shortcutExample.hide();
|
|
|
|
|
+ _ws.ui.detailsExample.render(parts);
|
|
|
|
|
+ _ws.ui.editor.render(parts);
|
|
|
|
|
+ _ws.ui.tabs.render(parts);
|
|
|
|
|
+ _ws.ui.addFile.show();
|
|
|
|
|
+ console.log('#### render iframe with navState', navState);
|
|
|
|
|
+ _ws.ui.sandboxIframe.render('/examples/' + navState.repo + '/' + navState.example);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ $('#editor-wrapper').hide();
|
|
|
|
|
+ _ws.ui.shortcutExample.show();
|
|
|
|
|
+ _ws.ui.editor.hide();
|
|
|
|
|
+ _ws.ui.tabs.hide();
|
|
|
|
|
+ _ws.ui.addFile.hide();
|
|
|
|
|
+ _ws.ui.sandboxIframe.render('/html/start-iframe.html');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -131,12 +145,30 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Initialize menu-repo view
|
|
|
|
|
+ */
|
|
|
|
|
+ _ws.makeView('menu-repo', {
|
|
|
|
|
+ events: {
|
|
|
|
|
+ 'click a': menuItemClicked
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Initialize shortcut-repo view
|
|
|
|
|
+ */
|
|
|
_ws.makeView('shortcut-repo', {
|
|
_ws.makeView('shortcut-repo', {
|
|
|
events: {
|
|
events: {
|
|
|
'click a': shortcutItemClicked
|
|
'click a': shortcutItemClicked
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Initialize shortcut-example view
|
|
|
|
|
+ */
|
|
|
_ws.makeView('shortcut-example', {
|
|
_ws.makeView('shortcut-example', {
|
|
|
events: {
|
|
events: {
|
|
|
'click a': shortcutItemClicked
|
|
'click a': shortcutItemClicked
|
|
@@ -146,18 +178,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Initialize menu-example view
|
|
|
|
|
- */
|
|
|
|
|
- // _ws.makeView('menu-repo', {
|
|
|
|
|
- // events: {
|
|
|
|
|
- // 'click a': menuItemClicked
|
|
|
|
|
- // }
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
* Handle click on links outside #menu-example
|
|
* Handle click on links outside #menu-example
|
|
|
*/
|
|
*/
|
|
|
- $('#menu-repo a').click(menuItemClicked);
|
|
|
|
|
|
|
+ // $('#menu-repo a').click(menuItemClicked);
|
|
|
$('#nav-back-home').click(function(e) {
|
|
$('#nav-back-home').click(function(e) {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
$mainMenu.removeClass('in');
|
|
$mainMenu.removeClass('in');
|