Skip to content

Commit

Permalink
Some register and README refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
scottpersinger committed Oct 8, 2014
1 parent 1d25b15 commit 03ab8a4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 36 deletions.
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ user registration, data storage, and event broadcast.
|
[Postgres DB]

## Deployment
# Deployment

The app can be deployed to Heroku, and distributed to the mobile device either through
the mobile web browser, or by compiling the AngularJS application into a native app
using an Apach Cordova container.

## Installation and setup
# Installation and setup

Clone this repo to your local machine and install the requirements:

Expand All @@ -68,10 +68,27 @@ and open the client app:

http://localhost:5000

## Deploy to Heroku
From the home screen click "Register". Enter your name and email and click `Register`. The first user
is automatically marked as the adminstrator. Click the _Open Admin Page_ link on the quiz page.

On the admin page, use the following controls

`Next Question` - queue up the next quiz question
`Restart Quiz` - erase all current scores and start over

As you click `Next Question` a new question will appear automatically for anyone running
the app. Additional users can register for the app and play at the same time. Users accumulate
points by answering questions correctly, with a bonus awarded to the person who answers
correctly first.


# Deploy to Heroku

When you are ready to share the app, just create a new Heroku app, provision a Postgres
database addon for your app, and then deploy the code.
database addon for your app, and then deploy the code. After you deploy you should
bootstrap the database:

$ heroku run ./bootstrap.sh

# Understanding the code

Expand Down Expand Up @@ -115,7 +132,7 @@ 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
Expand Down
17 changes: 0 additions & 17 deletions client/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
</ion-nav-back-button>
</ion-nav-bar>

<ion-nav-buttons side="left">
<button class="button button-clear">Player: {{user.name}}</button>
</ion-nav-buttons>

<ion-nav-buttons side="right">
<button class="button button-clear" ng-click="logout()">Logout</button>
</ion-nav-buttons>
Expand Down
4 changes: 2 additions & 2 deletions client/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', '
};

if ($rootScope.user.is_admin) {
AuthenticationService.is_admin = true;
AuthenticationService.isAdmin = true;
}

$rootScope.$on("$stateChangeStart", function(event, toState) {
//redirect only if both isAuthenticated is false and no token is set

Expand Down
8 changes: 2 additions & 6 deletions client/templates/register.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ion-view title="Register">
<ion-view title="Sign Up">

<!--<ion-nav-buttons side="right">-->
<!--<a class="button button-clear" href="#/app/signup">Signup</a>-->
Expand All @@ -25,15 +25,11 @@
</label>

<button class="button button-block button-stable" ng-click="register()">
Register
Sign Up
</button>

<div style="text-align: center; margin: 25px 0;">or</div>

<button class="button button-block button-positive" style="background: #3b5998" ng-click="facebookLogin()">
Login with Facebook
</button>

<a class="button button-block button-stable button-light-border" ui-sref="login">
Already registered?&nbsp;&nbsp;Log In&nbsp;<i class="icon-arrow-right"></i>
</a>
Expand Down
4 changes: 2 additions & 2 deletions server/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ module.exports = function(bookshelf) {
}

function next_question(req, res, next) {
var idWhere = '(select min(id) from questions where show = false and id > (select max(id) from questions where show = true))';
var idWhere = '(select min(id) from questions where (show = false or show is null) and id > (select max(id) from questions where show = true))';
return bookshelf.knex('questions').update({
'show': bookshelf.knex.raw('(id = ' + idWhere + ')')
})
.then(function() {
res.send('OK');
});
}).catch(next);
}

function leaders(req, res, next) {
Expand Down

0 comments on commit 03ab8a4

Please sign in to comment.