-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 26dde2b
Showing
22 changed files
with
7,214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(function(App){ | ||
App.MockedStatisticService = function(){ | ||
var self = {}, | ||
defaultStatistic = { | ||
ToursTotal: 505, | ||
ToursRunning: 110, | ||
ToursCompleted: 115 | ||
}, | ||
currentStatistic = $.extend({}, defaultStatistic);; | ||
|
||
self.mockStatistic = function(statistics){ | ||
currentStatistic = $.extend({}, defaultStatistic, statistics); | ||
}; | ||
|
||
self.getStatistics = function(){ | ||
var asyncSubject = new Rx.AsyncSubject(); | ||
asyncSubject.OnNext(currentStatistic); | ||
asyncSubject.OnCompleted(); | ||
return asyncSubject.AsObservable(); | ||
}; | ||
|
||
return self; | ||
}; | ||
})(App) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
(function(App){ | ||
App.ViewModels.HomeScreenViewModel = function(service){ | ||
var self = {}, disposableServicePoller = Rx.Disposable.Empty; | ||
|
||
self.toursTotal = ko.observable(0); | ||
self.toursRunning = ko.observable(0); | ||
self.toursCompleted = ko.observable(0); | ||
self.toursAvailable = ko.dependentObservable(function(){ return this.toursTotal() > 0; }, self); | ||
self.showTourList = function(){ $.mobile.changePage('#tourlist', 'pop', false, true); }; | ||
self.startServicePolling = function(){ | ||
disposableServicePoller = Rx.Observable | ||
.Interval(10000) | ||
.Select(service.getStatistics) | ||
.Switch() | ||
.Subscribe(function(statistics){ | ||
self.toursTotal(statistics.ToursTotal); | ||
self.toursRunning(statistics.ToursRunning); | ||
self.toursCompleted(statistics.ToursCompleted); | ||
}); | ||
}; | ||
self.stopServicePolling = disposableServicePoller.Dispose; | ||
|
||
return self; | ||
}; | ||
})(App) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var App = window.App = {}; | ||
App.ViewModels = {}; | ||
|
||
$(document).bind('mobileinit', function(){ | ||
// while app is running use App.Service.mockStatistic({ToursCompleted: 45}); to fake backend data from the console | ||
var service = App.Service = new App.MockedStatisticService(); | ||
|
||
$('#home').live('pagecreate', function(event, ui){ | ||
var viewModel = new App.ViewModels.HomeScreenViewModel(service); | ||
ko.applyBindings(viewModel, this); | ||
viewModel.startServicePolling(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.image { | ||
float: left; | ||
width: 32px; | ||
height: 32px; | ||
overflow: hidden; | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.image.check { background-image: url(../images/check.png); } | ||
.image.cross { background-image: url(../images/cross.png); } | ||
|
||
.line-a{ | ||
position:relative; | ||
padding-top: 8px; | ||
padding-bottom: 8px; | ||
} | ||
|
||
.line-b{ | ||
position:relative; | ||
padding-left: 20px; | ||
padding-top: 8px; | ||
padding-bottom: 8px; | ||
} | ||
|
||
.absolute-right { | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
} | ||
|
||
.significant{ | ||
font-weight: bold; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Page Title</title> | ||
<link rel="stylesheet" href="libs/jquery-mobile/jquery.mobile-1.0a4.1.css" /> | ||
<link rel="stylesheet" href="app/base/css/base.css" /> | ||
<script src="libs/jquery/jquery-1.5.0.min.js"></script> | ||
<script src="libs/knockout/knockout-1.2.0.js"></script> | ||
<script src="libs/knockout/knockout-bindings-jqm.js" type="text/javascript"></script> | ||
<script src="libs/rx/rx.js" type="text/javascript"></script> | ||
<script src="app/App.js"></script> | ||
<script src="app/App.ViewModels.HomeScreenViewModel.js"></script> | ||
<script src="app/App.MockedStatisticsService.js"></script> | ||
<script src="libs/jquery-mobile/jquery.mobile-1.0a4.1.js"></script> | ||
</head> | ||
<body> | ||
|
||
<!-- Start of first page --> | ||
<div data-role="page" id="home"> | ||
|
||
<div data-role="header"> | ||
<h1>Demo App</h1> | ||
</div><!-- /header --> | ||
|
||
<div data-role="content"> | ||
|
||
<div class="ui-grid-a"> | ||
<div class="ui-block-a"> | ||
<div class="ui-bar" style="height:120px"> | ||
<h1>Tours today (please wait 10 seconds to see the effect)</h1> | ||
<p><span data-bind="text: toursTotal"></span> total</p> | ||
<p><span data-bind="text: toursRunning"></span> running</p> | ||
<p><span data-bind="text: toursCompleted"></span> completed</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<fieldset class="ui-grid-a"> | ||
<div class="ui-block-a"><button data-bind="click: showTourList, jqmButtonEnabled: toursAvailable" data-theme="a">Tour List</button></div> | ||
</fieldset> | ||
|
||
</div><!-- /content --> | ||
|
||
<div data-role="footer" data-position="fixed"> | ||
<h4>by Christoph Burgdorf</h4> | ||
</div><!-- /header --> | ||
</div><!-- /page --> | ||
|
||
<!-- tourlist page --> | ||
<div data-role="page" id="tourlist"> | ||
|
||
<div data-role="header"> | ||
<h1>Bar</h1> | ||
</div><!-- /header --> | ||
|
||
<div data-role="content"> | ||
<p><a href="#home">Back to home</a></p> | ||
</div><!-- /content --> | ||
|
||
<div data-role="footer" data-position="fixed"> | ||
<h4>by Christoph Burgdorf</h4> | ||
</div><!-- /header --> | ||
</div><!-- /page --> | ||
|
||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.