forked from heroku/mobile-template1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented proper access control to Admin only functions
- Loading branch information
1 parent
7a68fca
commit 1d25b15
Showing
13 changed files
with
228 additions
and
117 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 |
---|---|---|
|
@@ -89,13 +89,69 @@ The components of the application are organized as follows: | |
| ..question list | server/load_question.js | | ||
| admin app | admin | | ||
|
||
# Accessing Force.com | ||
## Front-end app | ||
|
||
The front-end app is an AngularJS single page application. Thus all the HTML and Javascripted | ||
are loaded and run in a single WebView control on the phone. Different screens and navigation | ||
are all drawn in the browser DOM. | ||
|
||
Angular | ||
|
||
## Accessing Force.com | ||
|
||
As an option, the app can be configured so that each person who registers to play is | ||
recorded as a Lead record in Salesforce. This template shows how to access the | ||
Force.com API to exchange data with a Salesforce account. See [FORCE_README](FORCE_README.md) | ||
for full instructions. | ||
|
||
# Debugging | ||
|
||
Install `node-debug` to use the Chrome debugger with Node.js: | ||
|
||
$ npm install node-debug | ||
|
||
And to use, just run with `node-debugger`. After the Chrome debugger opens, make sure to click `Run` | ||
so the server starts: | ||
|
||
$ node-debug server.js | ||
|
||
|
||
# Building a native app | ||
|
||
To bundle your client app as a native mobile app, you can use the Cordova tool. Note that to build | ||
a native app you will need the corresponding native build tools. So for iOS apps you will need | ||
Xcode installed, and for Android apps you will need to have the Android SDK installed. | ||
|
||
Install Cordova: | ||
|
||
$ sudo npm install -g cordova | ||
|
||
Install an application simulator: | ||
|
||
$ sudo npm install -g ios-sim | ||
|
||
Initialize the wrapper: | ||
|
||
$ mkdir wrapper | ||
$ cd wrapper | ||
$ cordova create . QuizLive | ||
$ rm -rf www | ||
$ ln -s ../client www | ||
|
||
Now add one or more platform targets: | ||
|
||
$ cordova platform add ios | ||
$ cordova platform add android | ||
|
||
Now build the native app: | ||
|
||
$ cordova compile ios | ||
|
||
And run in the emulator: | ||
|
||
$ cordova run --emulator | ||
|
||
|
||
# Contact | ||
|
||
Scott Persinger <[email protected]> | ||
|
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 |
---|---|---|
@@ -1,108 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html ng-app="admin"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>QuizLive Admin</title> | ||
<link rel="stylesheet" href="css/bootstrap.css"> | ||
</head> | ||
|
||
<body ng-controller="AdminCtrl"> | ||
<div class="container"> | ||
|
||
<div class="page-header"> | ||
<h1>Quiz Live Admin</h1> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-8"> | ||
|
||
<h4> | ||
Current Question <small ng-show="currentQuestion.question">{{currentQuestion.question_index + 1}} of {{currentQuestion.question_total}}</small> | ||
</h4> | ||
<p><strong>{{currentQuestion.question}}</strong> | ||
</p> | ||
<div ng-show="answers && answers.length"> | ||
<h5>Answers:</h5> | ||
<ul class="list-group"> | ||
<li ng-repeat="answer in answers" ng-class='{"list-group-item list-group-item-success": answer.correct, "list-group-item list-group-item-danger": !answer.correct}'>{{answer.user.name}}</li> | ||
</ul> | ||
</div> | ||
<p> | ||
<button class="btn btn-primary" ng-click="nextQuestion()">Next Question</button> | ||
</p> | ||
|
||
<hr> | ||
|
||
<h4> | ||
Leaderboard | ||
</h4> | ||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Score</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="user in leaders"> | ||
<th>{{user.name}}</th> | ||
<td>{{user.points}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<p> | ||
<button class="btn btn-danger" ng-click="clearLeaders()">Restart Quiz</button> | ||
</p> | ||
</div> | ||
|
||
<div class="col-md-4"> | ||
<h3> | ||
Add Question | ||
</h3> | ||
<form> | ||
<div class="form-group"> | ||
<label for="form-question">Question</label> | ||
<p class="alert alert-danger" ng-show="!questionErrors.question"> | ||
<strong>Error!</strong> Please supply a question. | ||
</p> | ||
<input type="text" class="form-control" id="form-question" ng-model="question.question" placeholder="Enter question..."> | ||
</div> | ||
|
||
<label>Answers</label> | ||
<p>Select the radio next to the correct answer.</p> | ||
<p class="alert alert-danger" ng-show="!questionErrors.answers"> | ||
<strong>Error!</strong> Please supply at least one correct answer. | ||
</p> | ||
|
||
<div class="form-group" ng-repeat="item in questionAnswers"> | ||
<div class="input-group"> | ||
<span class="input-group-addon"> | ||
<input type="radio" ng-model="question.answer_index" ng-value="$index"> | ||
</span> | ||
<input type="text" class="form-control" ng-model="questionAnswers[$index].text" placeholder="Enter answer..."> | ||
</div> | ||
</div> | ||
|
||
<button class="btn btn-default" ng-click="addAnswer()">Add Answer</button> | ||
<button class="btn btn-primary" ng-click="saveQuestion()">Save</button> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<!-- ionic/angularjs js --> | ||
<body ng-controller="AdminBootCtrl"> | ||
<script src="lib/ionic/js/ionic.bundle.js"></script> | ||
<script src="lib/ionic/js/angular/angular-resource.js"></script> | ||
|
||
<!-- your app's js --> | ||
<script src="/socket.io/socket.io.js"></script> | ||
<script src="js/admin_app.js"></script> | ||
<script src="js/admin_app.js"></script> | ||
<script src="js/services.js"></script> | ||
|
||
</body> | ||
</html> | ||
|
||
</html> |
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,108 @@ | ||
<!DOCTYPE html> | ||
<html ng-app="admin"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>QuizLive Admin</title> | ||
<link rel="stylesheet" href="css/bootstrap.css"> | ||
</head> | ||
|
||
<body ng-controller="AdminCtrl"> | ||
<div class="container"> | ||
|
||
<div class="page-header"> | ||
<h1>Quiz Live Admin</h1> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-8"> | ||
|
||
<h4> | ||
Current Question <small ng-show="currentQuestion.question">{{currentQuestion.question_index + 1}} of {{currentQuestion.question_total}}</small> | ||
</h4> | ||
<p><strong>{{currentQuestion.question}}</strong> | ||
</p> | ||
<div ng-show="answers && answers.length"> | ||
<h5>Answers:</h5> | ||
<ul class="list-group"> | ||
<li ng-repeat="answer in answers" ng-class='{"list-group-item list-group-item-success": answer.correct, "list-group-item list-group-item-danger": !answer.correct}'>{{answer.user.name}}</li> | ||
</ul> | ||
</div> | ||
<p> | ||
<button class="btn btn-primary" ng-click="nextQuestion()">Next Question</button> | ||
</p> | ||
|
||
<hr> | ||
|
||
<h4> | ||
Leaderboard | ||
</h4> | ||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Score</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="user in leaders"> | ||
<th>{{user.name}}</th> | ||
<td>{{user.points}}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<p> | ||
<button class="btn btn-danger" ng-click="clearLeaders()">Restart Quiz</button> | ||
</p> | ||
</div> | ||
|
||
<div class="col-md-4"> | ||
<h3> | ||
Add Question | ||
</h3> | ||
<form> | ||
<div class="form-group"> | ||
<label for="form-question">Question</label> | ||
<p class="alert alert-danger" ng-show="!questionErrors.question"> | ||
<strong>Error!</strong> Please supply a question. | ||
</p> | ||
<input type="text" class="form-control" id="form-question" ng-model="question.question" placeholder="Enter question..."> | ||
</div> | ||
|
||
<label>Answers</label> | ||
<p>Select the radio next to the correct answer.</p> | ||
<p class="alert alert-danger" ng-show="!questionErrors.answers"> | ||
<strong>Error!</strong> Please supply at least one correct answer. | ||
</p> | ||
|
||
<div class="form-group" ng-repeat="item in questionAnswers"> | ||
<div class="input-group"> | ||
<span class="input-group-addon"> | ||
<input type="radio" ng-model="question.answer_index" ng-value="$index"> | ||
</span> | ||
<input type="text" class="form-control" ng-model="questionAnswers[$index].text" placeholder="Enter answer..."> | ||
</div> | ||
</div> | ||
|
||
<button class="btn btn-default" ng-click="addAnswer()">Add Answer</button> | ||
<button class="btn btn-primary" ng-click="saveQuestion()">Save</button> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<!-- ionic/angularjs js --> | ||
<script src="lib/ionic/js/ionic.bundle.js"></script> | ||
<script src="lib/ionic/js/angular/angular-resource.js"></script> | ||
|
||
<!-- your app's js --> | ||
<script src="/socket.io/socket.io.js"></script> | ||
<script src="js/admin_app.js"></script> | ||
<script src="js/services.js"></script> | ||
|
||
</body> | ||
|
||
</html> |
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
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
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
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
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
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
Oops, something went wrong.