Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scottpersinger committed Sep 27, 2014
0 parents commit 5b3ccf8
Show file tree
Hide file tree
Showing 89 changed files with 109,924 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Heroku template mobile app `Muchado`

This sample application implements a basic To Do list mobile application. The mobile
app itself is a hybrid Angular JS app composed from HTML, CSS and Javascript. The
server side is composed of a Node.js application running on top of a Postgres database.

This application should serve as a good base for creating mobile apps to deploy on
Heroku.

## The app

Our sample app is pretty simple. It supports a simple email / password registration
and login system. Then users can create, mark off, and delete To Do items in the
app.

A user can invite another user to view shared to do items. When they create a To Do
item they can elect to create a 'Shared' to do, in which case the item will appear
on the 'Shared To Dos' list of both users.

## Architecture

The app has two major pieces: An AngularJS based client app which comprises the front-end
which runs on the phone, and a Node.js backend which provides an API to
the client app for user authentication and data storage.

## Authentication

6 changes: 6 additions & 0 deletions client/CLIENT_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Template structure:

index.html
-> templates/tabs-container.html
-> templates/tabs-todos.html
-> templates/tabs-
17 changes: 17 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Heroku sample mobile app, client portion

This directory contains the code for the Ionic framework+Angular app which constitutes the
client side of our mobile app.

The client app is a single-page web app served by the root 'index.html'. The Javascript
in the `js/` directory contains the Angular application which creates the app using
the html templates in `templates/'. Those templates use the Ionic framework to create the
basic mobile-ready UI components.


Template structure:

index.html
-> templates/tabs-container.html
-> templates/tabs-todos.html
-> templates/tabs-
1 change: 1 addition & 0 deletions client/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Empty. Add your own CSS if you like */
Binary file added client/img/ionic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="/socket.io/socket.io.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>
84 changes: 84 additions & 0 deletions client/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Heroku Muchado App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])

.run(function($ionicPlatform, $rootScope) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})

.config(function($stateProvider, $urlRouterProvider) {

// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
$stateProvider

// setup an abstract state for the tabs directive
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "templates/tabs-container.html"
})

// Each tab has its own nav history stack:

.state('tab.todos', {
url: '/todos',
views: {
'tab-todos': {
templateUrl: 'templates/tab-todos.html',
controller: 'MyTodosCtrl'
}
}
})

.state('tab.friends', {
url: '/friends',
views: {
'tab-friends': {
templateUrl: 'templates/tab-friends.html',
controller: 'FriendsCtrl'
}
}
})
.state('tab.friend-detail', {
url: '/friend/:friendId',
views: {
'tab-friends': {
templateUrl: 'templates/friend-detail.html',
controller: 'FriendDetailCtrl'
}
}
})

.state('tab.account', {
url: '/account',
views: {
'tab-account': {
templateUrl: 'templates/tab-account.html',
controller: 'AccountCtrl'
}
}
});

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/todos');

});

21 changes: 21 additions & 0 deletions client/js/controllers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
angular.module('starter.controllers', [])

.controller('MyTodosCtrl', function($scope, SocketIO) {
$scope.questions = [{question:"Are you experienced man?"}];
SocketIO.on('questions', function(msg){
$scope.questions.push(JSON.parse(msg));
console.log($scope.questions);
$scope.$apply();
});
})

.controller('FriendsCtrl', function($scope, Friends) {
$scope.friends = Friends.all();
})

.controller('FriendDetailCtrl', function($scope, $stateParams, Friends) {
$scope.friend = Friends.get($stateParams.friendId);
})

.controller('AccountCtrl', function($scope) {
});
30 changes: 30 additions & 0 deletions client/js/services.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
angular.module('starter.services', [])

.factory('SocketIO', function() {
return io()
})

/**
* A simple example service that returns some data.
*/
.factory('Friends', function() {
// Might use a resource here that returns a JSON array

// Some fake testing data
var friends = [
{ id: 0, name: 'Scruff McGruff' },
{ id: 1, name: 'G.I. Joe' },
{ id: 2, name: 'Miss Frizzle' },
{ id: 3, name: 'Ash Ketchum' }
];

return {
all: function() {
return friends;
},
get: function(friendId) {
// Simple index lookup
return friends[friendId];
}
}
});
7,813 changes: 7,813 additions & 0 deletions client/lib/ionic/css/ionic.css

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions client/lib/ionic/css/ionic.min.css

Large diffs are not rendered by default.

Binary file added client/lib/ionic/fonts/ionicons.eot
Binary file not shown.
Loading

0 comments on commit 5b3ccf8

Please sign in to comment.