<commit_before>import * as angular from "angular";
import "angular-animate";
import "angular-route";
import "angular-ui-bootstrap";

import { mainControllerName, MainController } from "./controllers/mainController";
import { navControllerName, NavController } from "./controllers/navController";
import { nunCarouselControllerName, NunCarouselController } from "./controllers/nunCarouselController";
import { prayerRequestControllerName, PrayerRequestController } from "./controllers/prayerRequestController";
import { prayerRequestServiceName, PrayerRequestService } from "./services/prayerRequestService";
import { siteSectionServiceName, SiteSectionService } from "./services/siteSectionService";

// Declare controllers / services modules
export const controllersModuleName = "poorClaresAppControllers";
export const servicesModuleName = "poorClaresAppServices";
export const appName = "poorClaresApp";

export function registerAndStartApp() {
    angular.module(controllersModuleName, [])
        .controller(mainControllerName, MainController)
        .controller(navControllerName, NavController)
        .controller(nunCarouselControllerName, NunCarouselController)
        .controller(prayerRequestControllerName, PrayerRequestController);

    angular.module(servicesModuleName, [])
        .service(prayerRequestServiceName, PrayerRequestService)
        .service(siteSectionServiceName, SiteSectionService);

    // Declare app
    angular.module(appName, [
        "ngRoute",
        "ngAnimate",
        "ui.bootstrap",
        controllersModuleName,
        servicesModuleName
    ])
        .config(["$routeProvider", "$locationProvider",
            function ($routeProvider: ng.route.IRouteProvider, $locationProvider: ng.ILocationProvider) {

                const cacheBuster = "?v=" + new Date().getTime();

                function getTheConventTemplateUrl(params: any) {
                    const view = params.view || "home";
                    return "templates/theConvent/" + view + ".html" + cacheBuster;
                }

                function getMainTemplateUrl(params: any) {
                    const view = params.view || "home";
                    return "templates/main/" + view + ".html" + cacheBuster;
                }

                $routeProvider.
                    when("/", {
                        templateUrl: "templates/home.html" + cacheBuster,
                        controller: mainControllerName
                    }).
                    when("/theConvent/:view", {
                        templateUrl: getTheConventTemplateUrl,
                        controller: mainControllerName,
                        caseInsensitiveMatch: true
                    }).
                    when("/:view", {
                        templateUrl: getMainTemplateUrl,
                        controller: mainControllerName,
                        caseInsensitiveMatch: true
                    }).
                    otherwise({
                        redirectTo: "/"
                    });

                $locationProvider.html5Mode(true);
            }]);

    return appName;
}
<commit_msg>ui router switch<commit_after>import * as angular from "angular";
import "angular-animate";
import "angular-ui-bootstrap";
import "angular-ui-router";

import { mainControllerName, MainController } from "./controllers/mainController";
import { navControllerName, NavController } from "./controllers/navController";
import { nunCarouselControllerName, NunCarouselController } from "./controllers/nunCarouselController";
import { prayerRequestControllerName, PrayerRequestController } from "./controllers/prayerRequestController";
import { prayerRequestServiceName, PrayerRequestService } from "./services/prayerRequestService";
import { siteSectionServiceName, SiteSectionService } from "./services/siteSectionService";

// Declare controllers / services modules
export const controllersModuleName = "poorClaresAppControllers";
export const servicesModuleName = "poorClaresAppServices";
export const appName = "poorClaresApp";

export function registerAndStartApp() {
    angular.module(controllersModuleName, [])
        .controller(mainControllerName, MainController)
        .controller(navControllerName, NavController)
        .controller(nunCarouselControllerName, NunCarouselController)
        .controller(prayerRequestControllerName, PrayerRequestController);

    angular.module(servicesModuleName, [])
        .service(prayerRequestServiceName, PrayerRequestService)
        .service(siteSectionServiceName, SiteSectionService);

    // Declare app
    const app = angular.module(appName, [
        "ngAnimate",
        "ui.router",
        "ui.bootstrap",
        controllersModuleName,
        servicesModuleName
    ]);
    
    configureRoutes(app); 

    return app.name;
}

function configureRoutes(app: ng.IModule) {
    app.config(["$stateProvider", "$urlRouterProvider", "$locationProvider", configure]);
    function configure(
            $stateProvider: angular.ui.IStateProvider, 
            $urlRouterProvider: angular.ui.IUrlRouterProvider, 
            $locationProvider: ng.ILocationProvider) {

        const cacheBuster = "?v=" + new Date().getTime();

        function getTheConventTemplateUrl(params: any) {
            const view = params.view || "home";
            return "templates/theConvent/" + view + ".html" + cacheBuster;
        }

        function getMainTemplateUrl(params: any) {
            const view = params.view || "home";
            return "templates/main/" + view + ".html" + cacheBuster;
        }
        
        $urlRouterProvider.otherwise("home");

        $stateProvider.
            state("home", {
                url: "/",
                templateUrl: "templates/home.html" + cacheBuster,
                controller: mainControllerName
            }).
            state("the-convent", {
                url: "/theConvent/:view",
                templateUrl: getTheConventTemplateUrl,
                controller: mainControllerName
            }).
            state("main", {
                url: "/:view",
                templateUrl: getMainTemplateUrl,
                controller: mainControllerName
            });

        $locationProvider.html5Mode(true);
    }
}
{'fraction_non_alphanumeric': 0.10001592610288262, 'fraction_numerical': 0.00031852205765249244, 'mean_word_length': 2.5261089275687816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '897000', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1474, 'n_words': 301}