From 838714aac1410249565d576e1a32b0f6a831773e Mon Sep 17 00:00:00 2001 From: Willem Date: Fri, 15 Jan 2016 00:36:10 +0100 Subject: [PATCH] Fixed example --- .gitignore | 3 +-- es5-ff-spa-loader.js | 22 +++++++++++++++-- example/example.js | 7 +++--- example/package.json | 3 ++- example/www_static/css/boot.css | 25 ++------------------ example/www_static/css/style.css | 15 ++++++++++++ example/www_static/js/controller/page-foo.js | 16 +++++++++++-- example/www_static/js/example-app.js | 21 +++++++++------- example/www_views/thtml/header.ejs | 6 ++--- 9 files changed, 73 insertions(+), 45 deletions(-) diff --git a/.gitignore b/.gitignore index 2a241e7..60bd316 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,7 @@ test/data # Ignore example data example/node_modules example/npm-debug.log -example/www_static/css/lib -example/www_static/js/lib +example/mobile_app # Ignore binary files *.o diff --git a/es5-ff-spa-loader.js b/es5-ff-spa-loader.js index 0cf8eaa..4de14d5 100644 --- a/es5-ff-spa-loader.js +++ b/es5-ff-spa-loader.js @@ -173,7 +173,7 @@ var FFSpaLoader = (/** @lends module:FFSpaLoader */function () { var query = 'CREATE TABLE cache_store(id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT NOT NULL, value TEXT NOT NULL)'; utilDebug('websql.init query: '+query); tx.executeSql(query, [], function(tx,res) { - var query = 'CREATE UNIQUE INDEX cache_store__key__udx ON TABLE cache_store'; + var query = 'CREATE UNIQUE INDEX cache_store__key__udx ON cache_store (key)'; utilDebug('websql.init query: '+query); tx.executeSql(query, [], function(tx,res) {}, sqlErrorHandler(options.errorHandler)); // FIXli>ul>li>a:hover { color: #fff; } - -.huge { - font-size: 40px; -} diff --git a/example/www_static/css/style.css b/example/www_static/css/style.css index 745a426..5c16ebc 100644 --- a/example/www_static/css/style.css +++ b/example/www_static/css/style.css @@ -42,3 +42,18 @@ background-color: #C110D8; } +@media only screen and (-webkit-min-device-pixel-ratio: 1.3), + only screen and (-o-min-device-pixel-ratio: 13/10), + only screen and (min-resolution: 120dpi) { + + body { + font-size:1.8em !important; + } + + @media screen and (min-width: 1440px) { + body { + font-size:2em !important; + } + } +} + diff --git a/example/www_static/js/controller/page-foo.js b/example/www_static/js/controller/page-foo.js index 971b27e..600d0ac 100644 --- a/example/www_static/js/controller/page-foo.js +++ b/example/www_static/js/controller/page-foo.js @@ -1,10 +1,22 @@ +var tpl = '

Foo

Welcome to the foo.

'; +tpl += ''; +tpl += ''; + pageRouteInit.push(function ($routeProvider, $locationProvider) { $routeProvider.when('/example-ui/foo', { - template: '

Foo

Welcome to the foo.

', + template: tpl, controller: PageFoo }); }); -function PageFoo($scope, $http) { +function PageFoo($scope) { + $scope.doReboot = function ( path ) { + window.location.reload(true); + }; + + $scope.doClearServer = function ( path ) { + FFSpaLoader.clearServer(); + window.location.reload(true); + }; } diff --git a/example/www_static/js/example-app.js b/example/www_static/js/example-app.js index 649eb9c..8367b79 100644 --- a/example/www_static/js/example-app.js +++ b/example/www_static/js/example-app.js @@ -5,18 +5,23 @@ var serverUrl = window.FFServerUrl; console.log('FF provided serverUrl: '+serverUrl); $(document.createElement('div')).attr('id', 'wrapper').appendTo($('body')); -$(document.createElement('div')).attr('ng-include', '\''+serverUrl+'/example-ui/thtml/header\'').appendTo($('#wrapper')); +$(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include', '\''+serverUrl+'/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')); var pageRouteInit = []; -angular.module('exampleUI', ['ngRoute']).config( - ['$routeProvider', '$locationProvider', function - ($routeProvider, $locationProvider) { - - pageRouteInit.forEach(function(init) { init($routeProvider, $locationProvider); }); - $routeProvider.otherwise({ redirectTo: '/example-ui' }); - $locationProvider.html5Mode({enabled: true, requireBase: false}); +var exampleUI = angular.module('exampleUI', ['ngRoute']).config( + ['$routeProvider','$locationProvider','$sceDelegateProvider', function + ($routeProvider , $locationProvider , $sceDelegateProvider) { + pageRouteInit.forEach(function(init) { init($routeProvider, $locationProvider); }); + $sceDelegateProvider.resourceUrlWhitelist(['self',serverUrl+'/**']); + $routeProvider.otherwise({ redirectTo: '/example-ui' }); + $locationProvider.html5Mode({requireBase: false}); }]); +exampleUI.controller('ApplicationController',function($scope,$http,$location) { + $scope.goLink = function ( path ) { + $location.path( path ); + }; +}); diff --git a/example/www_views/thtml/header.ejs b/example/www_views/thtml/header.ejs index 109a1c9..dfccf11 100644 --- a/example/www_views/thtml/header.ejs +++ b/example/www_views/thtml/header.ejs @@ -6,8 +6,8 @@ - Home - Foo - Bar + Home + Foo + Bar