Skip to content

Commit d780f02

Browse files
committed
Various spa improvements and fixes
1 parent 4319fb4 commit d780f02

File tree

7 files changed

+41
-37
lines changed

7 files changed

+41
-37
lines changed

.htaccess

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
1-
RewriteEngine On
2-
3-
#Legacy Rewrites
4-
RewriteCond %{QUERY_STRING} ^id=(.*)$ [NC]
5-
RewriteRule ^schedule.php$ /schedule/%1? [NC,L,R=301]
6-
7-
#RewriteRule ^index.php$ / [L,R=301]
8-
#RewriteRule ^generate.php$ /generate [L,R=301]
9-
#RewriteRule ^browse.php$ /browse [L,R=301]
10-
#RewriteRule ^roulette.php$ /search [L,R=301]
11-
12-
13-
# Let old ScheduleMaker handle Resig's schedules for now
14-
RewriteCond %{QUERY_STRING} ^mode=old&id=(.*)$ [NC]
15-
RewriteRule ^schedule.php$ http://schedule-old.csh.rit.edu/schedule.php [NC,L,R=301]
16-
17-
RewriteCond %{REQUEST_FILENAME} !-d
18-
RewriteCond %{REQUEST_FILENAME}\.php -f
19-
RewriteRule ^api/([^/]*)(?:/([^/]*))*$ api/$1.php [L]
20-
21-
# Don't rewrite files or directories
22-
RewriteCond %{REQUEST_FILENAME} -f [OR]
23-
RewriteCond %{REQUEST_FILENAME} -d
24-
RewriteRule ^ - [L]
25-
26-
# Rewrite everything else to index.html to allow html5 state links
27-
RewriteRule ^ index.php [L]
1+
RewriteEngine On
2+
3+
#Legacy Rewrites
4+
RewriteCond %{QUERY_STRING} ^id=(.*)$ [NC]
5+
RewriteRule ^schedule.php$ /schedule/%1? [NC,L,R=302]
6+
7+
8+
# Let old ScheduleMaker handle Resig's schedules for now
9+
#RewriteCond %{QUERY_STRING} ^mode=old&id=(.*)$ [NC]
10+
RewriteRule ^schedule.php$ http://schedule-old.csh.rit.edu/schedule.php [NC,L,R=302]
11+
12+
#RewriteCond %{REQUEST_FILENAME} !-d
13+
RewriteCond %{REQUEST_FILENAME}\.php -f
14+
RewriteRule ^api/([^/]*)(?:/([^/]*))*$ api/$1.php [L]
15+
16+
17+
# Don't rewrite files or directories
18+
RewriteCond %{REQUEST_FILENAME} -f [OR]
19+
RewriteCond %{REQUEST_FILENAME} -d
20+
RewriteRule ^ - [L]
21+
22+
23+
# Rewrite everything else to index.html to allow html5 state links
24+
RewriteRule ^ index.php [L]

assets/src/templates/404.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="container">
2+
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> 404 Error. The page you were looking for was not found. <a ui-sref="index">Go back to the homepage.</a></div>
3+
</div>

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ gulp.task('templates', function() {
2222
return gulp.src(paths.templates.src)
2323
.pipe(htmlmin({
2424
collapseWhitespace: true,
25-
caseSensitive: true
25+
caseSensitive: true,
26+
keepClosingSlash: true
2627
}))
2728
.pipe(gulp.dest(paths.templates.dest));
2829
});

js/app.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ app.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
1616

1717
$locationProvider.html5Mode(true);
1818

19-
$urlRouterProvider.otherwise("/?status=404");
19+
$urlRouterProvider.otherwise("/404");
2020

2121
$stateProvider
2222
.state('index', {
2323
url: '/',
2424
templateUrl: '/assets/build/templates/index.html'
2525
})
26+
.state('404', {
27+
url: '/404',
28+
templateUrl: '/assets/build/templates/404.html'
29+
})
2630
.state('generate', {
2731
url: '/generate',
2832
templateUrl: '/assets/build/templates/generate.html',
@@ -503,7 +507,7 @@ app.controller("AppCtrl", function($scope, localStorage, $window, $filter, $stat
503507
return course.sections.reduce(
504508
function(total, section) {
505509
return total && section.selected;
506-
});
510+
}, true);
507511
},
508512

509513
/**
@@ -1351,7 +1355,7 @@ app.factory('uiDayFactory', function() {
13511355
app.directive("courseCart", function() {
13521356
return {
13531357
restrict: 'A',
1354-
templateUrl: '/js/templates/cart.html'
1358+
templateUrl: '/assets/build/templates/cart.html'
13551359
};
13561360
});
13571361
app.directive("dowSelectFields", function(uiDayFactory) {
@@ -1410,7 +1414,7 @@ app.directive("loadingButton", function(uiDayFactory) {
14101414
app.directive("scheduleCourse", function(){
14111415
return {
14121416
restrict: "C",
1413-
templateUrl: './js/templates/courseselect.html',
1417+
templateUrl: '/assets/build/templates/courseselect.html',
14141418
};
14151419
});
14161420
app.directive("dynamicItems", function($compile,$timeout, globalKbdShortcuts){
@@ -1595,7 +1599,7 @@ app.directive('pinned', function() {
15951599

15961600
var $window = $(window),
15971601
sizer = elm.parent().parent().find(".pinned-sizer"),
1598-
$footer = $("#footer"),
1602+
$footer = $("footer.main"),
15991603
fO, sO;
16001604
var updateHeight = function() {
16011605
fO = $window.height() - $footer.offset().top - $footer.outerHeight();
@@ -2030,7 +2034,7 @@ app.directive('schedule', function($timeout, $filter) {
20302034

20312035
return {
20322036
restrict: 'A',
2033-
templateUrl: '/js/templates/schedule.html',
2037+
templateUrl: '/assets/build/templates/scheduleitem.html',
20342038
link: {
20352039
pre: function(scope, elm, attrs) {
20362040
scope.scheduleController = new Schedule(scope);
@@ -2156,10 +2160,9 @@ app.controller("ScheduleCtrl", function($scope, parsedSchedule) {
21562160
});
21572161

21582162

2159-
app.controller("ScheduleViewCtrl", function($scope, $location) {
2163+
app.controller("ScheduleViewCtrl", function($scope, $location, $stateParams) {
21602164

2161-
var id = window.location.pathname.split('/');
2162-
id = id[id.length - 1];
2165+
id = $stateParams.id;
21632166
$scope.saveInfo = {
21642167
url: $location.absUrl(),
21652168
id: id

0 commit comments

Comments
 (0)