//= require_self
//= require_tree .

codepuppy = angular.module('codepuppy', ['ngRoute', 'ngCookies', 'ui.bootstrap',
  'angularFileUpload']);

codepuppy.config(function($routeProvider) {
  // TODO: use session information to determine role.  Should be one of 'student', 'leader'
  var role = 'student';
  var capRole = 'Student';

  // Student-specific routes:
  if(role === 'student') {
    $routeProvider.when('/:courseID/:assignmentID/submit', {
      templateUrl: '/assets/pages/fileUpload/' + role + '/upload.html',
      controller: 'FileUploadCtrl'
    });
  }

  $routeProvider
  .when('/', {
    templateUrl: '/assets/pages/home/' + role + '/' + role + 'Home.html',
    controller: capRole + 'HomeCtrl'
  })
  .when('/courses/:courseID', {
    templateUrl: '/assets/pages/course/' + role +'/' + role + 'Course.html',
    controller: capRole + 'CourseCtrl'
  })
  .when('/courses/:courseID/assignments/:assignmentID', {
    templateUrl: '/assets/pages/assignment/' + role + '/' + role + 'Assignment.html',
    controller: capRole + 'AssignmentCtrl'
  })
  .when('/courses/:courseID/assignments/:assignmentID/' +
        'submissions/:submissionID',
  {
    templateUrl: '/assets/pages/submission/' + role + '/' + role + 'Submission.html',
    controller: capRole + 'SubmissionCtrl'
  })
  .when('/sessions/verify', {
    templateUrl: '/assets/pages/sessions/verify/sessions-verify.html',
    controller: 'SessionsVerifyCtrl'
  })
  .otherwise({
    templateUrl: '/assets/errorPages/404/404.html',
    controller: '404Ctrl'
  });
}).run(['session', function(session) {
    session.checkAuthenticated(function() {
        // no-op, success, continue to site
    }, function() {
        session.authenticate();
    });
}]);

@@ -252,16 +252,21 @@
 e one of
+%0A  //
  'studen
@@ -278,16 +278,170 @@
 leader'%0A
+  var upperCaseFirst = function(str) %7B%0A    if (str.length === 0) %7B%0A        return str;%0A    %7D%0A    return str.charAt(0).toUpperCase() + str.slice(1);%0A  %7D;%0A%0A
   var ro
@@ -476,17 +476,28 @@
 e = 
-'Student'
+upperCaseFirst(role)
 ;%0A%0A 
@@ -529,16 +529,17 @@
 es:%0A  if
+ 
 (role ==
@@ -579,16 +579,24 @@
 .when('/
+courses/
 :courseI
@@ -597,16 +597,28 @@
 ourseID/
+assignments/
 :assignm
@@ -983,16 +983,17 @@
 + role +
+ 
 '/' + ro
@@ -992,24 +992,32 @@
 '/' + role +
+%0A       
  'Course.htm
@@ -1184,24 +1184,32 @@
 '/' + role +
+%0A       
  'Assignment
@@ -1425,24 +1425,32 @@
 '/' + role +
+%0A       
  'Submission
@@ -1509,151 +1509,8 @@
  %7D)%0A
-  .when('/sessions/verify', %7B%0A    templateUrl: '/assets/pages/sessions/verify/sessions-verify.html',%0A    controller: 'SessionsVerifyCtrl'%0A  %7D)%0A
   .o

remove route for session verify, fix route for submitting code, decomp capitalization (bandaid)