Last active
August 29, 2015 13:57
-
-
Save amcdnl/9573466 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['angular', | |
'angularCookies', | |
'angularRoute', | |
'angularui', | |
'angularAnimate', | |
'angularTouch', | |
'ngMousetrap', | |
'angularSanitize', | |
'lib/angular-growl/angular-growl', | |
'lib/angular-moment/angular-moment', | |
'lib/polyfill/array.find', | |
'lib/polyfill/array.generics', | |
'less!app/app'], function (angular) { | |
var app = angular.module('phx', | |
['ui.bootstrap', 'ngCookies', 'ngRoute', 'angular-growl', 'ngAnimate', | |
'ngSanitize', 'angularMoment', 'mgo-mousetrap']); | |
app.config(function ($routeProvider, $locationProvider) { | |
$routeProvider.otherwise({ redirectTo: 'apps' }); | |
$locationProvider.html5Mode(true); | |
}); | |
app.run(function ($rootScope, $location, $route, Auth, SignalR) { | |
// setup toolbar array | |
$rootScope.toolbar = []; | |
// de-register the start event after login to prevent further calls | |
var deregister = $rootScope.$on("$routeChangeStart", function () { | |
Auth.authorize().then(function (xhr) { | |
if (xhr) { | |
$rootScope.authed = true; | |
$rootScope.profile = xhr.data; | |
deregister(); | |
} | |
},function(){ | |
$location.path('login'); | |
}); | |
}); | |
$rootScope.$on('$routeChangeSuccess', function() { | |
if ($route.current && $route.current.$$route && $route.current.$$route.controller){ | |
$rootScope.controller = $route.current.$$route.controller; | |
$rootScope.page_title = $route.current.$$route.title; | |
} | |
}); | |
// init notifications | |
SignalR.initialize().done(function(){ | |
SignalR.sendRequest(); | |
}); | |
}); | |
app.config(function(growlProvider) { | |
growlProvider.globalTimeToLive(2000); | |
growlProvider.globalEnableHtml(true); | |
}); | |
return app; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.loadNpmTasks('grunt-html2js'); | |
grunt.loadNpmTasks('grunt-contrib-requirejs'); | |
grunt.loadNpmTasks('grunt-wrap'); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
requirejs: { | |
compile: { | |
options: { | |
name: 'main', | |
out: 'app.min.js', | |
insertRequire: ['main'], | |
wrap: true, | |
separateCSS: true, | |
mainConfigFile: 'main.js', | |
preserveLicenseComments: false, | |
optimize: 'uglify2', | |
uglify2:{ | |
mangle: false | |
}, | |
include: ['lib/require/require'], | |
//deps: ['templates'], | |
onBuildRead: function (moduleName, path, contents) { | |
return require('ngmin').annotate(contents); | |
}, | |
pragmas: { | |
production: true | |
}, | |
compile: { | |
options: { | |
paths: { | |
'templates':'empty:', | |
} | |
} | |
} | |
} | |
} | |
}, | |
html2js: { | |
main: { | |
options: { | |
htmlmin: { | |
collapseBooleanAttributes: true, | |
collapseWhitespace: true, | |
removeAttributeQuotes: true, | |
removeComments: true, | |
removeEmptyAttributes: true, | |
removeRedundantAttributes: true, | |
removeScriptTypeAttributes: true, | |
removeStyleLinkTypeAttributes: true | |
}, | |
base: './' | |
}, | |
src: ['app/**/*.html', 'common/**/*.html'], | |
dest: 'templates.js' | |
} | |
}, | |
wrap: { | |
basic: { | |
src: ['templates.js'], | |
dest: 'templates.js', | |
options: { | |
wrapper: ['define(["app/app"], function (app) {\n', | |
'\n app.requires.push("templates-main"); });'] | |
} | |
} | |
} | |
}); | |
grunt.registerTask('default', ['html2js', 'wrap', 'requirejs']); | |
return grunt; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bootstrap fix for Windows 8 Devices | |
// http://getbootstrap.com/getting-started/ | |
if (navigator.userAgent.match(/IEMobile\/10\.0/)) { | |
var msViewportStyle=document.createElement("style"); | |
msViewportStyle.appendChild( | |
document.createTextNode("@-ms-viewport{width:auto!important}") | |
); | |
document.getElementsByTagName("head")[0].appendChild(msViewportStyle); | |
} | |
require.config({ | |
paths: { | |
angular: 'lib/angular/angular', | |
jquery: 'lib/jquery/jquery-2.1.0', | |
angularui: "lib/angularui/ui-bootstrap-tpls-0.10.0", | |
angularCookies: "lib/angular/angular-cookies", | |
angularRoute: "lib/angular/angular-route", | |
angularAnimate: "lib/angular/angular-animate", | |
angularTouch: "lib/angular/angular-touch", | |
angularSanitize: "lib/angular/angular-sanitize", | |
ngtable: "lib/ngtable/ng-table", | |
jqueryUI: "lib/jquery-ui/jquery-ui", | |
signalr: "lib/signalr/signalr", | |
signalrHub: "lib/signalr/signalr.hub", | |
moment: "lib/moment/moment", | |
uiUtils: 'lib/ui-utils/ui-utils', | |
numericInput: 'lib/numeric-input/numeric-input', | |
checklistModel: 'lib/checklist-model/checklist-model', | |
uiSortable: 'lib/ui-sortable/sortable', | |
textAngular: "lib/textangular/textAngular", | |
chartjs: 'lib/chartjs/dx.chartjs.debug', | |
globalize: 'lib/chartjs/globalize.min', | |
ngMousetrap: 'lib/mousetrap/ng-mousetrap', | |
gridster: 'lib/angular-gridster/gridster' | |
}, | |
map: { | |
'*': { | |
'less': 'lib/require/require-less/less', | |
} | |
}, | |
shim: { | |
jquery: { | |
exports: '$' | |
}, | |
angular: { | |
exports: 'angular', | |
deps: ['jquery'] | |
}, | |
jqueryUI: ['jquery'], | |
signalr: ['jquery'], | |
signalrHub: ['jquery', 'signalr'], | |
moment: ["jquery"], | |
angularui: ['angular'], | |
ngtable: ['angular', 'less!lib/ngtable/ng-table'], | |
angularAnimate: ['angular'], | |
angularCookies: ['angular'], | |
angularTouch: ['angular'], | |
angularRoute: ['angular'], | |
angularSanitize: ['angular'], | |
uiUtils: ['angular'], | |
numericInput: ['jquery'], | |
checklistModel: ['angular'], | |
uiSortable: ['angular', 'jqueryUI'], | |
ngMousetrap: ['angular', 'lib/mousetrap/mousetrap'], | |
textAngular: ['angular', | |
'angularSanitize', | |
'less!lib/textAngular/textAngular'], | |
chartjs: { | |
deps: ['jquery', 'globalize'], | |
exports: 'DevExpress' | |
}, | |
gridster: ['angular', | |
'less!lib/angular-gridster/gridster', | |
'less!lib/jquery-ui/resizable', | |
'less!lib/jquery-ui/draggable', | |
'jqueryUI'] | |
}, | |
waitSeconds: 60, | |
env: 'development' | |
}); | |
require(['angular', | |
'less!lib/bootstrap/bootstrap.less', | |
'app/app', | |
'templates', | |
'common/components/header/header', | |
'common/components/left-nav/left-nav', | |
'common/components/login/login', | |
'app/record/record', | |
'app/search/search', | |
'app/admin/apps', | |
'app/admin/builder/builder', | |
'app/admin/builder/report-config', | |
'app/admin/builder/workflow', | |
'app/admin/builder/nav', | |
'app/workspaces/workspaces', | |
'app/workspaces/workspace', | |
'app/admin/users/users', | |
'app/admin/users/user', | |
'app/admin/settings', | |
'common/services/signalr.service', | |
'common/components/anchor/anchor.directive'], function (angular) { | |
angular.bootstrap(document, ['phx']); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['app/app', | |
'app/admin/builder/app-modal', | |
'common/services/apps.service', | |
'common/services/workspaces.service', | |
'common/components/toolbar/toolbar.directive', | |
'common/services/security.service'], function (app, AppModal) { | |
app.config(["$routeProvider", function ($routeProvider) { | |
$routeProvider.when('/apps', { | |
templateUrl: 'app/admin/views/apps.html', | |
controller: 'AppsCtrl', | |
title: 'Applications', | |
resolve: { | |
apps: function(AppsModel) { | |
return AppsModel.findAll(); | |
} | |
} | |
}); | |
}]); | |
return app.controller('AppsCtrl', function ($rootScope, $scope, growl, $modal, apps, AppsModel, WorkspacesModel) { | |
$scope.apps = apps.data; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['app/app', 'app/admin/settings.service'], function (app) { | |
app.config(["$routeProvider", function ($routeProvider) { | |
$routeProvider.when('/settings', { | |
templateUrl: 'app/admin/views/settings.html', | |
controller: 'SettingsCtrl', | |
title: 'System Settings', | |
resolve: { | |
settings: function(SettingsModel) { | |
return SettingsModel.find(); | |
} | |
} | |
}); | |
}]); | |
return app.controller('SettingsCtrl', function($rootScope, $scope, settings, SettingsModel, $modal, growl) { | |
$scope.model = settings.data; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment