// -*- coding: utf-8 -*-
//
// (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
//
// See LICENSE comming with the source of 'trex' for details.
//
'use strict';

var trexApp = angular.module('trex.app',
        ['ngRoute', 'ngCookies', 'ngTagsInput', 'angular-loading-bar',
         'trex.controllers', 'trex.filters',
         'trex.services', 'trex.directives']);

trexApp.config(['$routeProvider',
    function($routeProvider) {
        $routeProvider.
            when("/projects/", {
                templateUrl: 'static/html/projects.html',
                controller: 'ProjectListCtrl'
            }).
            when("/projects/:id", {
                templateUrl: 'static/html/project-detail.html',
                controller: 'ProjectDetailCtrl'
            }).
            when("/entries/:id", {
                templateUrl: 'static/html/entry-detail.html',
                controller: 'EntryDetailCtrl'
            }).
            otherwise({
                redirectTo: '/'
            });
    }]
);

trexApp.run(['$http', '$cookies',
    function($http, $cookies) {
        $http.defaults.headers.common['X-CSRFToken'] = $cookies.csrftoken;
    }]
);


// -*- coding: utf-8 -*-
//
// (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
//
// See LICENSE comming with the source of 'trex' for details.
//
'use strict';

var trexApp = angular.module('trex.app',
        ['ngRoute', 'ngCookies', 'ngTagsInput', 'ngResource',
         'angular-loading-bar',
         'trex.controllers', 'trex.filters',
         'trex.services', 'trex.directives']);

trexApp.config(['$routeProvider', '$resourceProvider',
    function($routeProvider, $resourceProvider) {
        // will be available with Angular JS 1.3
        // https://github.com/angular/angular.js/commit/3878be52f6d95fca4c386d4a5523f3c8fcb04270
        // $resourceProvider.defaults.stripTrailingSlashes = false;

        $routeProvider.
            when("/projects/", {
                templateUrl: 'static/html/projects.html',
                controller: 'ProjectListCtrl'
            }).
            when("/projects/:id/", {
                templateUrl: 'static/html/project-detail.html',
                controller: 'ProjectDetailCtrl'
            }).
            when("/entries/:id/", {
                templateUrl: 'static/html/entry-detail.html',
                controller: 'EntryDetailCtrl'
            }).
            otherwise({
                redirectTo: '/'
            });
    }]
);

trexApp.run(['$http', '$cookies',
    function($http, $cookies) {
        $http.defaults.headers.common['X-CSRFToken'] = $cookies.csrftoken;
    }]
);


Use trailing slashes for angular routing urls
Use trailing slashes for angular routing urls

Currently angular js still strips the trailing slashes from the url. With
angular 1.3 this cane be changed via a resourceProvider.
