app/assets/javascripts/angular/scheduler.ctrl.js
// - showing landing page / active schedule
showing landing page / active schedule
showing landing page / active schedule
function SchedulerCtrl($scope, $http, Schedule) {
  $scope.schedule = Schedule;
  init(initData); 
  function init(data) {
    Schedule.setSchedule(data.schedule, data.hour_range);
    Schedule.setUserId(data.id);
    Schedule.enableModify(data.canModify);
  }
  $scope.showLandingPage = function() {
    return Schedule.isEmpty();
  }
  $scope.showActiveSchedule = function() {
    return !Schedule.isEmpty();
  }
  $scope.print_hour = function(hour) {
    return hour % 2 == 0 ? to12hr(hour) : "";
  }
  $scope.print_instructor = function(professor) {
    return professor ? professor : "TBD";
  };
  $scope.$on('endDrag', function() {
    $scope.$apply(function() {
      Schedule.hideHints();
    });
  });
  $scope.days = function() {
    return ['Mon', 'Tue', 'Wed', 'Thur', 'Fri'];
  }
  $scope.color = function(id) {
    return "color-" + $scope.colors.get(id);
  }
  function to12hr(hour) {
    return hour == 12 ? "12" : hour % 12;
  }
}
function SchedulerCtrl ( $scope , $http , Schedule ) { $scope . schedule = Schedule ; init ( initData ) ; function init ( data ) { Schedule . setSchedule ( data . schedule , data . hour_range ) ; Schedule . setUserId ( data . id ) ; Schedule . enableModify ( data . canModify ) ; } $scope . showLandingPage = function ( ) { return Schedule . isEmpty ( ) ; } $scope . showActiveSchedule = function ( ) { return ! Schedule . isEmpty ( ) ; } $scope . print_hour = function ( hour ) { return hour % 2 == 0 ? to12hr ( hour ) : "" ; } $scope . print_instructor = function ( professor ) { return professor ? professor : "TBD" ; } ; $scope . $on ( 'endDrag' , function ( ) { $scope . $apply ( function ( ) { Schedule . hideHints ( ) ; } ) ; } ) ; $scope . days = function ( ) { return [ 'Mon' , 'Tue' , 'Wed' , 'Thur' , 'Fri' ] ; } $scope . color = function ( id ) { return "color-" + $scope . colors . get ( id ) ; } function to12hr ( hour ) { return hour == 12 ? "12" : hour % 12 ; } }
showing landing page / active schedule
showing landing page / active schedule
/****************************************
    initialization
  ****************************************/ // initData gets set as a global var through the html (show.haml/index.haml) /****************************************
    html template methods
  ****************************************/ /****************************************
    helper methods
  ****************************************/ /* Need this to turn off hints when a drag stops */