Fixed example offline use, and prepare for 0.3.0
This commit is contained in:
parent
7b94313f90
commit
78d1baa89a
|
@ -236,6 +236,7 @@ Add unit tests for any new or changed functionality. Lint and test your code.
|
|||
* Added options.boot.error.[enable|title].
|
||||
* start(cb) function callback now includes error.
|
||||
* Moved options.debug.* to options.boot.debug.*.
|
||||
* Fixed example offline use. (safe page as(html only))
|
||||
|
||||
### 0.2.1
|
||||
* Fixed clearCache method to added json header.
|
||||
|
|
|
@ -70,23 +70,12 @@ var createClientResourceFetchList = function() {
|
|||
return fetchList;
|
||||
};
|
||||
|
||||
function renderTemplatePath(viewPath) {
|
||||
return function (req, res) {
|
||||
res.locals.query = req.query;
|
||||
var qi = req.url.indexOf('?');
|
||||
if (qi === -1) {
|
||||
qi = req.url.length;
|
||||
}
|
||||
res.render(viewPath + req.url.substring(req.route.path.length-1, qi));
|
||||
};
|
||||
}
|
||||
|
||||
function renderIndex() {
|
||||
return function (req, res) {
|
||||
var inlineScript = UglifyJS.minify(__dirname+'/../../es5-ff-spa-loader.js');
|
||||
minify(__dirname+'/../../es5-ff-spa-loader.css', {}, function(err, data) {
|
||||
res.render('index', {
|
||||
inlineScript: 'console.log(\'test\');'+inlineScript.code,
|
||||
inlineScript: inlineScript.code,
|
||||
inlineStyle: data
|
||||
});
|
||||
});
|
||||
|
@ -122,7 +111,6 @@ server.use(appPath+'/static/module/angular-route', express.static(path.join(__di
|
|||
server.get(appPath+'/static/spa-client-resources', function (req,res) {res.json({data: {resources: clientResourcesWeb}});});
|
||||
server.get(appPath+'/static/spa-loader.css', function (req,res) {res.sendFile('es5-ff-spa-loader.css', { root: path.join(__dirname, '/../../') });});
|
||||
server.get(appPath+'/', function (req, res) {res.redirect(appPath+'/example-ui');});
|
||||
server.get(appPath+'/example-ui/thtml/*', renderTemplatePath('thtml/'));
|
||||
server.get(appPath+'/example-ui', renderIndex());
|
||||
server.get('/', function (req, res) {res.redirect(appPath);});
|
||||
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
|
||||
pageRouteInit.push(function ($routeProvider, $locationProvider) {
|
||||
var tpl = '<div><h2>Bar</h2><p>Welcome to the bar.</p><div class="table-responsive">';
|
||||
tpl += '<table class="table table-bordered table-hover table-striped"><tbody>';
|
||||
tpl += '<tr><th>Chair</th><th>Person</th><th>Drinking</th></tr></tbody><tbody>';
|
||||
tpl += '<tr><td>seat 1</td><td>empty</td><td>none</td></tr>';
|
||||
tpl += '<tr><td>seat 2</td><td>you</td><td>coffee</td></tr>';
|
||||
tpl += '<tr><td>seat 3</td><td>cat</td><td>water</td></tr>';
|
||||
tpl += '</tbody></table></div></div>';
|
||||
$routeProvider.when('/example-ui/bar', {
|
||||
templateUrl: window.serverUrl+'/example-ui/thtml/bar',
|
||||
template: tpl,
|
||||
controller: PageFoo
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
pageRouteInit.push(function ($routeProvider, $locationProvider) {
|
||||
var tpl = '<div><h2>Foo</h2><p>Welcome to the foo.</p></div>';
|
||||
tpl += '<input type=\"button\" class=\"btn btn-default\" ng-click=\"doReload()\" value=\"Reload\"></input>';
|
||||
tpl += '<input type=\"button\" class=\"btn btn-default\" ng-click=\"doClearServerUrl()\" value=\"Clear Server Url\"></input>';
|
||||
tpl += '<input type=\"button\" class=\"btn btn-default\" ng-click=\"doClearCache()\" value=\"Clear Cache\"></input>';
|
||||
tpl += '<p>{{message}}</p>';
|
||||
|
||||
pageRouteInit.push(function ($routeProvider, $locationProvider) {
|
||||
$routeProvider.when('/example-ui/foo', {
|
||||
template: tpl,
|
||||
controller: PageFoo
|
||||
|
|
|
@ -12,14 +12,35 @@ console.log('FFExample provided serverUrl \"'+serverUrl+'\"');
|
|||
// });
|
||||
//});
|
||||
|
||||
|
||||
var moduleTpl = angular.module('app-tpl', []);
|
||||
moduleTpl.run(["$templateCache", function($templateCache) {
|
||||
var tpl = '';
|
||||
tpl += '<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">\n';
|
||||
tpl += ' <div class="navbar-header">\n';
|
||||
tpl += ' <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">\n';
|
||||
tpl += ' <span class="sr-only">Toggle navigation</span>\n';
|
||||
tpl += ' <span class="icon-bar"></span>\n';
|
||||
tpl += ' <span class="icon-bar"></span>\n';
|
||||
tpl += ' <span class="icon-bar"></span>\n';
|
||||
tpl += ' </button>\n';
|
||||
tpl += ' <a class="navbar-brand" ng-click="goLink(\'/example-ui/\')">Home</a>\n';
|
||||
tpl += ' <a class="navbar-brand" ng-click="goLink(\'/example-ui/foo\')">Foo</a>\n';
|
||||
tpl += ' <a class="navbar-brand" ng-click="goLink(\'/example-ui/bar\')">Bar</a>\n';
|
||||
tpl += ' </div>\n';
|
||||
tpl += '</nav>\n';
|
||||
$templateCache.put('/example-ui/thtml/header', tpl);
|
||||
$templateCache.put('/example-ui/thtml/footer', '<nav class="navbar">\n<div class="navbar-footer">\nExample footer\n</div>\n</nav>\n');
|
||||
}]);
|
||||
|
||||
$(document.createElement('div')).attr('id', 'wrapper').appendTo($('body'));
|
||||
$(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include', '\''+serverUrl+'/example-ui/thtml/header\'').appendTo($('#wrapper'));
|
||||
$(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include', '\'/example-ui/thtml/header\'').appendTo($('#wrapper'));
|
||||
$(document.createElement('div')).attr('id', 'page-wrapper').appendTo($('#wrapper'));
|
||||
$(document.createElement('div')).attr('id', 'container-fluid').attr('ng-view', '').appendTo($('#page-wrapper'));
|
||||
$(document.createElement('div')).attr('ng-include', '\''+serverUrl+'/example-ui/thtml/footer\'').appendTo($('body'));
|
||||
$(document.createElement('div')).attr('ng-include', '\'/example-ui/thtml/footer\'').appendTo($('body'));
|
||||
|
||||
var pageRouteInit = [];
|
||||
var exampleUI = angular.module('exampleUI', ['ngRoute']).config(
|
||||
var exampleUI = angular.module('exampleUI', ['app-tpl','ngRoute']).config(
|
||||
['$routeProvider','$locationProvider','$sceDelegateProvider', function
|
||||
($routeProvider , $locationProvider , $sceDelegateProvider) {
|
||||
pageRouteInit.forEach(function(init) { init($routeProvider, $locationProvider); });
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<div><h2>Bar</h2><p>Welcome to the bar.</p><div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-striped"><tbody>
|
||||
<tr><th>Chair</th><th>Person</th><th>Drinking</th></tr></tbody><tbody>
|
||||
<tr><td>seat 1</td><td>empty</td><td>none</td></tr>
|
||||
<tr><td>seat 2</td><td>you</td><td>coffee</td></tr>
|
||||
<tr><td>seat 3</td><td>cat</td><td>water</td></tr>
|
||||
</tbody></table></div></div>
|
|
@ -1,5 +0,0 @@
|
|||
<nav class="navbar">
|
||||
<div class="navbar-footer">
|
||||
Example footer
|
||||
</div>
|
||||
</nav>
|
|
@ -1,13 +0,0 @@
|
|||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" ng-click="goLink('/example-ui/')">Home</a>
|
||||
<a class="navbar-brand" ng-click="goLink('/example-ui/foo')">Foo</a>
|
||||
<a class="navbar-brand" ng-click="goLink('/example-ui/bar')">Bar</a>
|
||||
</div>
|
||||
</nav>
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "es5-ff-spa-loader",
|
||||
"version": "0.2.1",
|
||||
"version": "0.3.0",
|
||||
"description": "Javascript Single Page Application Loader",
|
||||
"main": "es5-ff-spa-loader.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue