2
Fork 0

Added mobile example app

This commit is contained in:
Willem 2016-01-24 21:38:21 +01:00
parent 4fbf705ae5
commit cf364fc418
26 changed files with 187 additions and 61 deletions

View file

@ -0,0 +1,10 @@
pageRouteInit.push(function ($routeProvider, $locationProvider) {
$routeProvider.when('/example-ui/bar', {
templateUrl: window.serverUrl+'/example-ui/thtml/bar',
controller: PageFoo
});
});
function PageFoo($scope, $http) {
}

View file

@ -0,0 +1,42 @@
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
});
});
function PageFoo($scope) {
$scope.message = '';
$scope.doReload = function () {
window.location.reload(true);
};
$scope.doClearServerUrl = function () {
FFSpaLoader.clearServerUrl(function(err) {
if (err) {
$scope.message = 'Error: '+err;
} else {
$scope.message = 'Cleared server url';
}
$scope.$apply();
});
};
$scope.doClearCache = function () {
FFSpaLoader.clearCache(function(err) {
if (err) {
$scope.message = 'Error: '+err;
} else {
$scope.message = 'Cleared cache';
}
$scope.$apply();
});
};
}

View file

@ -0,0 +1,10 @@
pageRouteInit.push(function ($routeProvider, $locationProvider) {
$routeProvider.when('/example-ui', {
template: '<div><h2>Example UI Index</h2><p>Welcome make yourself at home.</p></div>',
controller: PageIndex
});
});
function PageIndex($scope, $http) {
}

View file

@ -0,0 +1,27 @@
'use strict';
document.title = 'FFSpaLoader Example';
var serverUrl = window.FFServerUrl;
console.log('FFExample provided serverUrl \"'+serverUrl+'\"');
$(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('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 = [];
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 );
};
});