Last active
August 5, 2016 04:11
-
-
Save mcabreradev/1b0708f636244dd08c888d8995ef26fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 'use strict'; | |
| var cehubClientApp = angular.module('cehubClientApp', [ | |
| 'ngSanitize', | |
| 'ngRoute', | |
| 'restangular', | |
| 'ui.bootstrap', | |
| 'ngTagsInput' | |
| ]); | |
| cehubClientApp.config(function($httpProvider) { | |
| var logsOutUserOn401 = function($location, $q) { | |
| var success = function(response) { | |
| return response; | |
| }; | |
| var error = function(response) { | |
| if (response.status === 401) { | |
| delete window.localStorage.auth_token; | |
| window.location = '/'; | |
| } | |
| return $q.reject(response); | |
| }; | |
| return function(promise) { | |
| return promise.then(success, error); | |
| }; | |
| }; | |
| $httpProvider.responseInterceptors.push(logsOutUserOn401); | |
| }); | |
| cehubClientApp.config(function(RestangularProvider){ | |
| console.log('CURRENT LOCATION',window.location.host); | |
| if (window.location.host === '127.0.0.1:9000' || window.location.host === 'local.host:9000' || window.location.host === '0.0.0.0:9000') { | |
| RestangularProvider.setBaseUrl('http://0.0.0.0:3000/'); | |
| } else { | |
| RestangularProvider.setBaseUrl('http://67.207.156.199:3000/'); | |
| } | |
| RestangularProvider.setDefaultHeaders({'Content-Type': 'application/json'}); | |
| }); | |
| cehubClientApp.config(function ($routeProvider) { | |
| $routeProvider | |
| .when('/', { | |
| templateUrl: 'views/home/home.html' | |
| , controller: 'MainCtrl' | |
| }) | |
| .when('/forgot_password', { | |
| templateUrl: 'views/home/home.html' | |
| , controller: 'forgotPasswordCtrl' | |
| , modal: 'views/modals/forgot_password1.html' | |
| }) | |
| .when('/reset_password/:reset_token', { | |
| templateUrl: 'views/home/home.html' | |
| , controller: 'resetPasswordCtrl' | |
| , modal: 'views/modals/reset_password1.html' | |
| }) | |
| .when('/terms-conditions', { | |
| templateUrl: 'views/home/home.html' | |
| , controller: 'forgotPasswordCtrl' | |
| , modal: 'views/modals/forgot_password1.html' | |
| }) | |
| .when('/registration/step2', { | |
| templateUrl: 'views/registration/step2.html' | |
| }) | |
| .when('/registration/step3', { | |
| templateUrl: 'views/registration/step3.html' | |
| , controller: 'registrationStep3' | |
| }) | |
| .when('/registration/step3/wizard', { | |
| templateUrl: 'views/registration/step3.html' | |
| , controller: 'registrationStep3' | |
| }) | |
| .when('/access_token=:fb_token', { | |
| templateUrl: 'views/registration/step2.html' | |
| , controller: 'syncWithFacebook2Ctrl' | |
| }) | |
| .when('/dashboard', { | |
| templateUrl: 'views/dashboard/dashboard.html' | |
| , controller: 'dashboardCtrl2' | |
| }) | |
| .when('/account', { | |
| templateUrl: 'views/dashboard/account.html' | |
| , controller: 'accountSettings' | |
| }) | |
| .when('/activity', { | |
| templateUrl: 'views/activity/activity.html' | |
| }) | |
| .when('/students', { | |
| templateUrl: 'views/students/students.html' | |
| }) | |
| .when('/students/recommended', { | |
| templateUrl: 'views/students/recommended.html' | |
| }) | |
| .when('/students/search', { | |
| templateUrl: 'views/students/search.html' | |
| }) | |
| .when('/students/search/class', { | |
| templateUrl: 'views/students/search-class.html' | |
| }) | |
| .when('/students/group/:group', { | |
| templateUrl: 'views/students/group.html' | |
| }) | |
| .when('/students/class/:course', { | |
| templateUrl: 'views/students/class.html' | |
| }) | |
| .when('/profile/view/:user_id', { | |
| templateUrl: 'views/profile/about-me.html' | |
| }) | |
| .when('/profile/edit', { | |
| templateUrl: 'views/profile/edit.html' | |
| , controller: 'editProfileController' | |
| }) | |
| .when('/connections', { | |
| templateUrl: 'views/students/connections.html' | |
| }) | |
| .when('/channels', { | |
| templateUrl: 'views/channels/channels.html' | |
| }) | |
| .when('/channels/animation-nation-video-details', { | |
| templateUrl: 'views/channels/animation-nation-video-details.html' | |
| }) | |
| .when('/channels/animation-nation', { | |
| templateUrl: 'views/channels/animation-nation.html' | |
| }) | |
| .when('/channels/art-battles-u', { | |
| templateUrl: 'views/channels/art-battles-u.html' | |
| }) | |
| .when('/channels/art-battles-u-video-details', { | |
| templateUrl: 'views/channels/art-battles-u-video-details.html' | |
| }) | |
| .when('/channels/music', { | |
| templateUrl: 'views/channels/student-rant.html' | |
| }) | |
| .when('/channels/featured', { | |
| templateUrl: 'views/channels/student-rant.html' | |
| }) | |
| .when('/channels/3-minutes-of-funny', { | |
| templateUrl: 'views/channels/3-minutes-of-funny.html' | |
| }) | |
| .when('/channels/3-minutes-of-funny-video-details', { | |
| templateUrl: 'views/channels/3-minutes-of-funny-video-details.html' | |
| }) | |
| .when('/channels/student-news-network', { | |
| templateUrl: 'views/channels/student-news-network.html' | |
| }) | |
| .when('/channels/student-news-network-video-details', { | |
| templateUrl: 'views/channels/student-news-network-video-details.html' | |
| }) | |
| .when('/channels/student-films', { | |
| templateUrl: 'views/channels/student-films.html' | |
| }) | |
| .when('/channels/student-films-video-details', { | |
| templateUrl: 'views/channels/student-films-video-details.html' | |
| }) | |
| .when('/channels/student-rant', { | |
| templateUrl: 'views/channels/student-rant.html' | |
| }) | |
| .when('/channels/student-rant-video-details', { | |
| templateUrl: 'views/channels/student-rant-video-details.html' | |
| }) | |
| .when('/channels/music', { | |
| templateUrl: 'views/channels/music.html' | |
| }) | |
| .when('/channels/music-video-details', { | |
| templateUrl: 'views/channels/music-video-details.html' | |
| }) | |
| .when('/channels/featured', { | |
| templateUrl: 'views/channels/featured.html' | |
| }) | |
| .when('/channels/featured-video-details', { | |
| templateUrl: 'views/channels/featured-video-details.html' | |
| }) | |
| .when('/channels/commerical-spoofs', { | |
| templateUrl: 'views/channels/commerical-spoofs.html' | |
| }) | |
| .when('/channels/commerical-spoofs-video-details', { | |
| templateUrl: 'views/channels/commerical-spoofs-video-details.html' | |
| }) | |
| .when('/channels/tag-goes-here', { | |
| templateUrl: 'views/channels/tag-goes-here.html' | |
| }) | |
| .when('/channels/tag', { | |
| templateUrl: 'views/channels/tag.html' | |
| }) | |
| .when('/dailydose', { | |
| templateUrl: 'views/dailydose/dailydose.html' | |
| }) | |
| .when('/dailydose/blog', { | |
| templateUrl: 'views/dailydose/dailydose-blog.html' | |
| }) | |
| .when('/calendar', { | |
| templateUrl: 'views/calendar/calendar.html' | |
| }) | |
| .when('/events', { | |
| templateUrl: 'views/events/rsvp.html' | |
| }) | |
| .when('/events/my', { | |
| templateUrl: 'views/events/my-events.html' | |
| }) | |
| .when('/events/pending', { | |
| templateUrl: 'views/events/pending-invites.html' | |
| }) | |
| .when('/events/around', { | |
| templateUrl: 'views/events/around.html' | |
| }) | |
| .when('/events/__example__', { | |
| templateUrl: 'views/events/__example__.html' | |
| }) | |
| .when('/events/__example__/invited', { | |
| templateUrl: 'views/events/__example-invited__.html' | |
| }) | |
| .when('/radar', { | |
| templateUrl: 'views/radar/radar.html' | |
| }) | |
| .when('/radar/share', { | |
| templateUrl: 'views/radar/radar.html' | |
| , modal: 'views/modals/share.html' | |
| }) | |
| .when('/stacks', { | |
| templateUrl: 'views/stacks/mystacks.html' | |
| }) | |
| .when('/stacks/details', { | |
| templateUrl: 'views/stacks/details.html' | |
| }) | |
| .when('/stacks/explore', { | |
| templateUrl: 'views/stacks/explore.html' | |
| }) | |
| .when('/stacks/subscribed', { | |
| templateUrl: 'views/stacks/subscribed.html' | |
| }) | |
| .when('/photos', { | |
| templateUrl: 'views/photos/all.html' | |
| }) | |
| .when('/photos/photos-of-me', { | |
| templateUrl: 'views/photos/photos-of-me.html' | |
| }) | |
| .when('/photos/videos-of-me', { | |
| templateUrl: 'views/photos/video-of-me.html' | |
| }) | |
| .when('/photos/my-albums', { | |
| templateUrl: 'views/photos/my-albums.html' | |
| }) | |
| .when('/photos/pending-upload', { | |
| templateUrl: 'views/photos/pending-upload.html' | |
| }) | |
| .when('/messages', { | |
| templateUrl: 'views/messages/main.html', | |
| controller: 'messagesCtrl' | |
| }) | |
| .when('/messages/create', { | |
| templateUrl: 'views/messages/main.html', | |
| controller: 'messagesCtrl' | |
| }) | |
| .when('/messages/view/:messageId', { | |
| templateUrl: 'views/messages/main.html', | |
| controller: 'messagesCtrl' | |
| }) | |
| .when('/about-us',{ | |
| templateUrl: 'views/dashboard/about-us.html' | |
| }) | |
| .when('/terms-conditions',{ | |
| templateUrl: 'views/dashboard/terms-conditions.html' | |
| }) | |
| .when('/logout',{ | |
| templateUrl: 'views/home/home.html' | |
| , controller: 'logoutController' | |
| }) | |
| .otherwise({ | |
| redirectTo: '/' | |
| }); | |
| }); | |
| // runs when all the dependencies are met | |
| cehubClientApp.run( function($rootScope, $location, $http, $window, Restangular) { | |
| // CORS setup | |
| $http.defaults.useXDomain = true; | |
| delete $http.defaults.headers.common['X-Requested-With']; | |
| // locationChange handler | |
| $rootScope.$watch(function() { | |
| return $location.path(); | |
| },function(){ | |
| if (typeof window.localStorage.auth_token !== 'undefined') { | |
| console.debug('Token found',window.localStorage.auth_token); | |
| $window.scrollTo(0,0); | |
| $http.defaults.headers.common.Bearer = window.localStorage.auth_token; | |
| if ($location.path() !== '/logout' && $location.path() !== '' && $location.path() !== '/') { | |
| Restangular.all('user/location').post({location:$location.path()}).then(function() {}); | |
| } | |
| } else { console.debug('Token wasn\'t found!'); } | |
| angular.element(document.getElementsByClassName('removeme')).remove(); | |
| }); | |
| }); | |
| // This MUST be moved to a proper service or factory | |
| window.utils = {}; | |
| utils.api_url = 'http://0.0.0.0:3000/'; | |
| utils.parse_error = function(data) { | |
| // if not successful, show error message | |
| if (data.error.data) { | |
| var error_msg = ''; | |
| for (var i in data.error.data) { | |
| error_msg += data.error.data[i]+'\n'; | |
| } | |
| console.log('An error occurred while sending your data \n\n'+error_msg); | |
| return; | |
| } | |
| console.log('An error occurred: '+data.error.description); | |
| }; | |
| utils.parseErrors = function(errors, ctrlModel) { | |
| if (errors.length === 0) { return; } | |
| console.warn(errors.length + ' validation errors have been found',errors); | |
| ctrlModel.$errors = {}; | |
| for (var name in errors) { | |
| if (typeof(errors[name]) === 'object') { | |
| ctrlModel[name].$errors = {}; | |
| for (var item in errors[name]) { | |
| ctrlModel[name].$errors[item] = errors[name][item]; | |
| } | |
| } | |
| else { | |
| ctrlModel.$errors[name] = errors[name]; | |
| } | |
| } | |
| }; | |
| utils.redirect_if_not_logged_in = function($location,where) { | |
| if (typeof window.localStorage.auth_token === 'undefined') { | |
| var final_location = '/'; | |
| if (where) { final_location = where; } | |
| $location.path(final_location); | |
| return; | |
| } | |
| }; |
This file contains hidden or 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
| <!doctype html> | |
| <!--[if lt IE 7]> | |
| <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
| <!--[if IE 7]> | |
| <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
| <!--[if IE 8]> | |
| <html class="no-js lt-ie9"> <![endif]--> | |
| <!--[if gt IE 8]><!--> | |
| <html class="no-js"> <!--<![endif]--> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <link href="/images/favicon.ico" rel="shortcut icon" type="image/x-icon"/> | |
| <title>CE Hub</title> | |
| <meta name="description" content=""> | |
| <meta name="viewport" content="width=device-width"> | |
| <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> | |
| <!-- build:css styles/vendor.css --> | |
| <!-- bower:css --> | |
| <!-- endbower --> | |
| <!-- endbuild --> | |
| <!-- build:css({.tmp,app}) styles/main.css --> | |
| <link rel="stylesheet" media="all" href="styles/fullcalendar.css"> | |
| <link rel="stylesheet" media="all" href="styles/bootstrap.css"> | |
| <link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.css' rel='stylesheet'/> | |
| <link rel="stylesheet" media="all" href="styles/main.css"> | |
| <link rel="stylesheet" media="all" href="extras/ngTagsInput/ng-tags-input.min.css"> | |
| <!--[if lt IE 9]> | |
| <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
| <![endif]--> | |
| <!-- endbuild --> | |
| </head> | |
| <body ng-app="cehubClientApp"> | |
| <!-- Add your site or application content here --> | |
| <div id="angular-view-container" ng-view=""></div> | |
| <!-- / body --> | |
| <!-- Google Analytics: change UA-XXXXX-X to be your site's ID --> | |
| <script> | |
| (function (i, s, o, g, r, a, m) { | |
| i['GoogleAnalyticsObject'] = r; | |
| i[r] = i[r] || function () { | |
| (i[r].q = i[r].q || []).push(arguments) | |
| }, i[r].l = 1 * new Date(); | |
| a = s.createElement(o), | |
| m = s.getElementsByTagName(o)[0]; | |
| a.async = 1; | |
| a.src = g; | |
| m.parentNode.insertBefore(a, m) | |
| })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); | |
| ga('create', 'UA-XXXXX-X'); | |
| ga('send', 'pageview'); | |
| </script> | |
| <script src="public_js/jquery-1.10.2.min.js"></script> | |
| <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script> | |
| <!--[if lt IE 9]> | |
| <script src="bower_components/es5-shim/es5-shim.js"></script> | |
| <script src="bower_components/json3/lib/json3.min.js"></script> | |
| <![endif]--> | |
| <!-- build:js scripts/vendor.js --> | |
| <!-- bower:js --> | |
| <script src="bower_components/angular/angular.js"></script> | |
| <script src="bower_components/angular-animate/angular-animate.js"></script> | |
| <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> | |
| <script src="bower_components/angular-route/angular-route.js"></script> | |
| <script src="bower_components/lodash/dist/lodash.compat.js"></script> | |
| <script src="bower_components/restangular/dist/restangular.js"></script> | |
| <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script> | |
| <script src="bower_components/momentjs/moment.js"></script> | |
| <!-- endbower --> | |
| <!-- endbuild --> | |
| <!-- <script src="public_js/jquery-1.10.2.min.js"></script> --> | |
| <!-- <script src="public_js/fullcalendar.js"></script> --> | |
| <!-- <script src="public_js/main.js"></script> --> | |
| <!-- <script src="public_js/plugins.js"></script> --> | |
| <!-- build:js({.tmp,app}) scripts/scripts.js --> | |
| <script> | |
| var vendor = {} | |
| </script> | |
| <script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.js'></script> | |
| <script src="extras/uploadufy/jquery.uploadify-3.1.min.js"></script> | |
| <script src="public_js/uploadify.js"></script> | |
| <script src="public_js/plugins.js"></script> | |
| <script src="public_js/vendor.js"></script> | |
| <script src="public_js/fullcalendar.js"></script> | |
| <script src="extras/ngTagsInput/ng-tags-input.min.js"></script> | |
| <script src="scripts/app.js"></script> | |
| <script src="scripts/directives/main.js"></script> | |
| <script src="scripts/directives/vendor.js"></script> | |
| <script src="scripts/filters/main.js"></script> | |
| <script src="scripts/models/users.js"></script> | |
| <script src="scripts/models/awards.js"></script> | |
| <script src="scripts/models/skills.js"></script> | |
| <script src="scripts/models/organizations.js"></script> | |
| <script src="scripts/models/education.js"></script> | |
| <script src="scripts/models/interests.js"></script> | |
| <script src="scripts/models/dashboard.js"></script> | |
| <script src="scripts/models/works.js"></script> | |
| <script src="scripts/models/work_tags.js"></script> | |
| <script src="scripts/models/privacy.js"></script> | |
| <script src="scripts/models/activities.js"></script> | |
| <script src="scripts/models/activities_missed_connections.js"></script> | |
| <script src="scripts/models/locations.js"></script> | |
| <script src="scripts/models/photosAndVideos.js"></script> | |
| <script src="scripts/models/venues.js"></script> | |
| <script src="scripts/models/activities_comments.js"></script> | |
| <script src="scripts/models/messages.js"></script> | |
| <script src="scripts/models/activities_checkins.js"></script> | |
| <script src="scripts/models/activities_links.js"></script> | |
| <script src="scripts/models/activities_likes.js"></script> | |
| <script src="scripts/models/connections.js"></script> | |
| <script src="scripts/models/channels.js"></script> | |
| <script src="scripts/models/universities.js"></script> | |
| <script src="scripts/models/students.js"></script> | |
| <script src="scripts/controllers/main.js"></script> | |
| <script src="scripts/controllers/registration.js"></script> | |
| <script src="scripts/controllers/dashboard.js"></script> | |
| <script src="scripts/controllers/account.js"></script> | |
| <script src="scripts/controllers/activity.js"></script> | |
| <script src="scripts/controllers/calendar.js"></script> | |
| <script src="scripts/controllers/events.js"></script> | |
| <script src="scripts/controllers/channels.js"></script> | |
| <script src="scripts/controllers/dailydose.js"></script> | |
| <script src="scripts/controllers/students.js"></script> | |
| <script src="scripts/controllers/stacks.js"></script> | |
| <script src="scripts/controllers/photosAndVideos.js"></script> | |
| <script src="scripts/controllers/radar.js"></script> | |
| <script src="scripts/controllers/messages.js"></script> | |
| <script src="scripts/controllers/more.js"></script> | |
| <script src="scripts/controllers/profile.js"></script> | |
| <!-- endbuild --> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment