Skip to content

Commit 8564355

Browse files
committed
Linting fixes second pass
1 parent cf3a6b8 commit 8564355

38 files changed

+903
-951
lines changed

assets/src/modules/sm/App/controllers/AppController.js

Lines changed: 147 additions & 160 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
angular.module('sm').directive("courseCart", function () {
1+
angular.module('sm').directive('courseCart', function () {
22
return {
33
restrict: 'A',
44
templateUrl: '/<%=modulePath%>App/templates/cart.min.html'
5-
};
6-
});
5+
}
6+
})
Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
angular.module('sm').directive('courseDetailPopover', function ($http, $filter) {
2-
var RMPUrl = $filter('RMPUrl'),
3-
parseTimes = $filter('parseSectionTimes'),
4-
formatTime = $filter('formatTime');
2+
var RMPUrl = $filter('RMPUrl')
3+
var parseTimes = $filter('parseSectionTimes')
4+
var formatTime = $filter('formatTime')
55

6-
function getTimesHTML(times) {
6+
function getTimesHTML (times) {
77
if (!times) {
8-
return '';
8+
return ''
99
}
10-
var parsedTimes = parseTimes(times, true);
11-
var HTML = '<div style="font-size: small">';
10+
var parsedTimes = parseTimes(times, true)
11+
var HTML = '<div style="font-size: small">'
1212
for (var timeIndex = 0; timeIndex < parsedTimes.length; timeIndex++) {
13-
var time = parsedTimes[timeIndex];
14-
HTML += time.days + ' <span style="white-space: nowrap">' + formatTime(time.start) + '-' + formatTime(time.end) + '</span> <span style="font-style: italic; white-space: nowrap">Location: ' + time.location + '</span>';
13+
var time = parsedTimes[timeIndex]
14+
HTML += time.days + ' <span style="white-space: nowrap">' + formatTime(time.start) + '-' + formatTime(time.end) + '</span> <span style="font-style: italic; white-space: nowrap">Location: ' + time.location + '</span>'
1515
if (timeIndex < parsedTimes.length - 1) {
16-
HTML += '<br>';
16+
HTML += '<br>'
1717
}
1818
}
19-
HTML += '</div>';
19+
HTML += '</div>'
2020

21-
return HTML;
21+
return HTML
2222
}
2323

2424
return {
@@ -27,27 +27,26 @@ angular.module('sm').directive('courseDetailPopover', function ($http, $filter)
2727
sectionId: '=courseDetailPopover'
2828
},
2929
link: function (scope, elm) {
30-
if (scope.sectionId != '') {
31-
var loaded = false,
32-
opened = false,
33-
$body = $("body");
30+
if (scope.sectionId !== '') {
31+
var loaded = false
32+
var opened = false
33+
var $body = $('body')
3434

35-
function hidePopoverOnBodyClick() {
35+
function hidePopoverOnBodyClick () {
3636
setTimeout(function () {
37-
38-
$body.off('click.hidepopovers');
37+
$body.off('click.hidepopovers')
3938
$body.on('click.hidepopovers', function () {
40-
elm.popover('destroy');
41-
loaded = false;
42-
$body.off('click.hidepopovers');
43-
opened = false;
44-
});
45-
}, 100);
39+
elm.popover('destroy')
40+
loaded = false
41+
$body.off('click.hidepopovers')
42+
opened = false
43+
})
44+
}, 100)
4645
}
4746

4847
elm.on('click', function () {
4948
if (!loaded) {
50-
loaded = true;
49+
loaded = true
5150
$http.post('/entity/courseForSection',
5251
$.param({
5352
id: scope.sectionId
@@ -60,22 +59,22 @@ angular.module('sm').directive('courseDetailPopover', function ($http, $filter)
6059
title: data.courseNum,
6160
content: '<div class="well-sm pull-right" style=" background-color: #ddd;" title="Other students enrolled as of 6AM today">' + data.curenroll + '/' + data.maxenroll + ' <i class="fa fa-user"></i></div><p>' + data.title + ' - ' + data.credits + ' credits<br><span class="label label-default popover-white">' + RMPUrl(data.instructor) + '</span></p><p>' + getTimesHTML(data.times) + '</p><p>' + data.description + '</p>',
6261
container: '#container'
63-
});
64-
elm.popover('show');
65-
opened = true;
66-
hidePopoverOnBodyClick();
62+
})
63+
elm.popover('show')
64+
opened = true
65+
hidePopoverOnBodyClick()
6766
}).error(function () {
68-
loaded = false;
69-
});
67+
loaded = false
68+
})
7069
} else {
71-
//elm.popover('toggle');
72-
opened = !opened;
70+
// elm.popover('toggle');
71+
opened = !opened
7372
if (opened) {
74-
//hidePopoverOnBodyClick();
73+
// hidePopoverOnBodyClick();
7574
}
7675
}
77-
});
76+
})
7877
}
7978
}
80-
};
81-
});
79+
}
80+
})
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angular.module('sm').directive("dowSelectFields", function (uiDayFactory) {
1+
angular.module('sm').directive('dowSelectFields', function (uiDayFactory) {
22
return {
33
restrict: 'A',
44
scope: {
@@ -7,19 +7,19 @@ angular.module('sm').directive("dowSelectFields", function (uiDayFactory) {
77
template: '<div class="btn-group btn-group-dow"><button type="button" ng-repeat="day in days" ng-click="toggle(day)" class="btn btn-default btn-dow" ng-class="{\'btn-success\':isSelected(day)}" ng-bind="day.substring(0 ,2)"></button></div>',
88
link: {
99
pre: function (scope) {
10-
scope.days = uiDayFactory();
10+
scope.days = uiDayFactory()
1111
scope.isSelected = function (day) {
12-
return scope.select.indexOf(day) != -1;
13-
};
12+
return scope.select.indexOf(day) !== -1
13+
}
1414
scope.toggle = function (day) {
15-
var index = scope.select.indexOf(day);
16-
if (index == -1) {
17-
scope.select.push(day);
15+
var index = scope.select.indexOf(day)
16+
if (index === -1) {
17+
scope.select.push(day)
1818
} else {
19-
scope.select.splice(index, 1);
19+
scope.select.splice(index, 1)
2020
}
21-
};
21+
}
2222
}
2323
}
24-
};
25-
});
24+
}
25+
})
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
angular.module('sm').directive("loadingButton", function (uiDayFactory) {
2-
3-
var template = '<i class="fa fa-spin fa-refresh" ></i> ';
1+
angular.module('sm').directive('loadingButton', function (uiDayFactory) {
2+
var template = '<i class="fa fa-spin fa-refresh" ></i> '
43

54
return {
65
restrict: 'A',
@@ -9,18 +8,18 @@ angular.module('sm').directive("loadingButton", function (uiDayFactory) {
98
text: '@loadingText'
109
},
1110
link: function (scope, elm) {
12-
var prevHTML = elm.html();
11+
var prevHTML = elm.html()
1312
scope.$watch('status', function (newLoading, prevLoading) {
14-
if (newLoading != prevLoading) {
15-
if (newLoading == 'L') {
16-
elm.html(template + scope.text);
17-
elm.attr("disabled", true);
13+
if (newLoading !== prevLoading) {
14+
if (newLoading === 'L') {
15+
elm.html(template + scope.text)
16+
elm.attr('disabled', true)
1817
} else {
19-
elm.html(prevHTML);
20-
elm.attr("disabled", false);
18+
elm.html(prevHTML)
19+
elm.attr('disabled', false)
2120
}
2221
}
23-
});
22+
})
2423
}
25-
};
26-
});
24+
}
25+
})
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
angular.module('sm').directive("navCloseOnMobile", function () {
1+
angular.module('sm').directive('navCloseOnMobile', function () {
22
return {
33
restrict: 'A',
44
link: function (scope, elm) {
5-
var nav = $(elm);
5+
var nav = $(elm)
66
$(elm).find('li').click(function () {
7-
$('.navbar-collapse.in').collapse('hide');
8-
});
7+
$('.navbar-collapse.in').collapse('hide')
8+
})
99
}
10-
};
11-
});
10+
}
11+
})
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
angular.module('sm').directive('paginationControls', function () {
2-
return {
3-
restrict: 'A',
4-
scope: {
5-
displayOptions: '=paginationControls',
6-
totalLength: '=paginationLength',
7-
paginationCallback: '&'
8-
},
9-
template: '<button title="Shortcut: Ctrl + Left" class="btn btn-default" ng-disabled="displayOptions.currentPage == 0" ng-click="displayOptions.currentPage=displayOptions.currentPage-1">Previous</button>' +
2+
return {
3+
restrict: 'A',
4+
scope: {
5+
displayOptions: '=paginationControls',
6+
totalLength: '=paginationLength',
7+
paginationCallback: '&'
8+
},
9+
template: '<button title="Shortcut: Ctrl + Left" class="btn btn-default" ng-disabled="displayOptions.currentPage == 0" ng-click="displayOptions.currentPage=displayOptions.currentPage-1">Previous</button>' +
1010
' {{displayOptions.currentPage+1}}/{{numberOfPages()}} ' +
1111
'<button title="Shortcut: Ctrl + Right" class="btn btn-default" ng-disabled="displayOptions.currentPage >= totalLength/displayOptions.pageSize - 1" ng-click="displayOptions.currentPage=displayOptions.currentPage+1">Next</button>',
12-
link: {
13-
pre: function (scope) {
14-
scope.numberOfPages = function () {
15-
var numPages = Math.ceil(scope.totalLength / scope.displayOptions.pageSize);
16-
if (scope.displayOptions.currentPage == numPages) {
17-
scope.displayOptions.currentPage = numPages - 1;
18-
}
19-
return numPages;
20-
};
21-
},
22-
post: function (scope, elm, attrs) {
23-
if (scope.paginationCallback) {
24-
elm.find('button').click(function () {
25-
scope.paginationCallback();
26-
});
27-
}
28-
}
12+
link: {
13+
pre: function (scope) {
14+
scope.numberOfPages = function () {
15+
var numPages = Math.ceil(scope.totalLength / scope.displayOptions.pageSize)
16+
if (scope.displayOptions.currentPage === numPages) {
17+
scope.displayOptions.currentPage = numPages - 1
18+
}
19+
return numPages
2920
}
30-
};
31-
});
21+
},
22+
post: function (scope, elm, attrs) {
23+
if (scope.paginationCallback) {
24+
elm.find('button').click(function () {
25+
scope.paginationCallback()
26+
})
27+
}
28+
}
29+
}
30+
}
31+
})
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
angular.module('sm').directive('pinned', function () {
2-
return {
3-
restrict: 'A',
4-
link: function (scope, elm, attrs) {
2+
return {
3+
restrict: 'A',
4+
link: function (scope, elm, attrs) {
5+
var $window = $(window)
6+
var sizer = elm.parent().parent().find('.pinned-sizer')
7+
var $footer = $('footer.main')
8+
var fO; var sO
9+
var updateHeight = function () {
10+
fO = $window.height() - $footer.offset().top - $footer.outerHeight()
11+
sO = sizer.height()
12+
elm.css('height', (fO > 0) ? (sO - fO) : (sO))
13+
}
14+
setTimeout(function () {
15+
updateHeight()
16+
$(window).on('resize', updateHeight)
17+
}, 100)
518

6-
var $window = $(window),
7-
sizer = elm.parent().parent().find(".pinned-sizer"),
8-
$footer = $("footer.main"),
9-
fO, sO;
10-
var updateHeight = function () {
11-
fO = $window.height() - $footer.offset().top - $footer.outerHeight();
12-
sO = sizer.height();
13-
elm.css('height', (fO > 0) ? (sO - fO) : (sO));
14-
};
15-
setTimeout(function () {
16-
updateHeight();
17-
$(window).on("resize", updateHeight);
18-
}, 100);
19+
if (typeof scope.schools !== 'undefined') {
20+
scope.$watch('schools', function () {
21+
setTimeout(updateHeight, 200)
22+
})
23+
}
1924

20-
if (typeof scope.schools != "undefined") {
21-
scope.$watch('schools', function () {
22-
setTimeout(updateHeight, 200);
23-
});
24-
}
25-
26-
elm.addClass("pinned");
27-
}
28-
};
29-
});
25+
elm.addClass('pinned')
26+
}
27+
}
28+
})

0 commit comments

Comments
 (0)