digitaltom/photobooth

View on GitHub
app/assets/javascripts/application.js.erb

Summary

Maintainability
Test Coverage
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//

//= require_self
//= require_tree .
//= require_tree ../templates

var photoBoothApp = angular.module('photoBooth', ['ngRoute', 'ui.bootstrap']);

// make alerts available globally
photoBoothApp.run(['$rootScope', function ($rootScope) {
  $rootScope.alerts = [];

  $rootScope.closeAlert = function (index) {
    $rootScope.alerts.splice(index, 1);
  };

}]);


photoBoothApp.config(['$routeProvider',
  function ($routeProvider) {
    $routeProvider.
    when('/', {
      templateUrl: '<%= asset_path('picture_sets.html') %>',
      controller: 'MainCtrl'
    }).
    when('/picture_set/:pictureSetId', {
      templateUrl: '<%= asset_path('picture_set.html') %>',
      controller: 'PictureSetCtrl'
    }).
    when('/picture_set/:pictureSetId/gallery', {
        templateUrl: '<%= asset_path('picture_set_gallery.html') %>',
        controller: 'PictureSetCtrl'
    }).
    when('/picture_set/:pictureSetId/email', {
        templateUrl: '<%= asset_path('picture_set_email.html') %>',
        controller: 'PictureSetCtrl'
    }).
    when('/slideshow/:pictureSetId', {
        templateUrl: '<%= asset_path('slideshow.html') %>',
        controller: 'SlideshowCtrl'
    }).
    otherwise({
      redirectTo: '/'
    });
  }]);