Skip to content

Commit eed08ed

Browse files
committed
First Pass Linting fixes
1 parent 1362a99 commit eed08ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2786
-2824
lines changed

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

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

6-
function getTimesHTML(times) {
7-
if(!times) {
8-
return '';
9-
}
10-
var parsedTimes = parseTimes(times, true);
11-
var HTML = '<div style="font-size: small">';
12-
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>';
15-
if(timeIndex < parsedTimes.length - 1) {
16-
HTML += '<br>';
17-
}
18-
}
19-
HTML += '</div>';
6+
function getTimesHTML(times) {
7+
if (!times) {
8+
return '';
9+
}
10+
var parsedTimes = parseTimes(times, true);
11+
var HTML = '<div style="font-size: small">';
12+
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>';
15+
if (timeIndex < parsedTimes.length - 1) {
16+
HTML += '<br>';
17+
}
18+
}
19+
HTML += '</div>';
2020

21-
return HTML;
22-
}
23-
return {
24-
restrict: 'A',
25-
scope: {
26-
sectionId: '=courseDetailPopover'
27-
},
28-
link: function(scope, elm) {
29-
if(scope.sectionId != '') {
30-
var loaded = false,
31-
opened = false,
32-
$body = $("body");
21+
return HTML;
22+
}
3323

34-
function hidePopoverOnBodyClick() {
35-
setTimeout(function() {
24+
return {
25+
restrict: 'A',
26+
scope: {
27+
sectionId: '=courseDetailPopover'
28+
},
29+
link: function (scope, elm) {
30+
if (scope.sectionId != '') {
31+
var loaded = false,
32+
opened = false,
33+
$body = $("body");
3634

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

47-
elm.on('click', function() {
48-
if(!loaded) {
49-
loaded = true;
50-
$http.post('/entity/courseForSection',
51-
$.param({
52-
id: scope.sectionId
53-
})
54-
).success(function(data) {
55-
elm.popover({
56-
html:true,
57-
trigger:'click',
38+
$body.off('click.hidepopovers');
39+
$body.on('click.hidepopovers', function () {
40+
elm.popover('destroy');
41+
loaded = false;
42+
$body.off('click.hidepopovers');
43+
opened = false;
44+
});
45+
}, 100);
46+
}
5847

59-
title: data.courseNum,
60-
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>',
61-
container: '#container'
62-
});
63-
elm.popover('show');
64-
opened = true;
65-
hidePopoverOnBodyClick();
66-
}).error(function() {
67-
loaded = false;
68-
});
69-
} else {
70-
//elm.popover('toggle');
71-
opened = !opened;
72-
if(opened) {
73-
//hidePopoverOnBodyClick();
74-
}
75-
}
76-
});
77-
}
78-
}
79-
};
80-
});
48+
elm.on('click', function () {
49+
if (!loaded) {
50+
loaded = true;
51+
$http.post('/entity/courseForSection',
52+
$.param({
53+
id: scope.sectionId
54+
})
55+
).success(function (data) {
56+
elm.popover({
57+
html: true,
58+
trigger: 'click',
59+
60+
title: data.courseNum,
61+
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>',
62+
container: '#container'
63+
});
64+
elm.popover('show');
65+
opened = true;
66+
hidePopoverOnBodyClick();
67+
}).error(function () {
68+
loaded = false;
69+
});
70+
} else {
71+
//elm.popover('toggle');
72+
opened = !opened;
73+
if (opened) {
74+
//hidePopoverOnBodyClick();
75+
}
76+
}
77+
});
78+
}
79+
}
80+
};
81+
});
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
angular.module('sm').directive("dowSelectFields", function(uiDayFactory) {
2-
return {
3-
restrict: 'A',
4-
scope: {
5-
select: '=dowSelectFields'
6-
},
7-
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>',
8-
link: {
9-
pre: function(scope) {
10-
scope.days = uiDayFactory();
11-
scope.isSelected = function(day) {
12-
return scope.select.indexOf(day) != -1;
13-
};
14-
scope.toggle = function(day) {
15-
var index = scope.select.indexOf(day);
16-
if(index == -1) {
17-
scope.select.push(day);
18-
} else {
19-
scope.select.splice(index, 1);
20-
}
21-
};
22-
}
23-
}
24-
};
1+
angular.module('sm').directive("dowSelectFields", function (uiDayFactory) {
2+
return {
3+
restrict: 'A',
4+
scope: {
5+
select: '=dowSelectFields'
6+
},
7+
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>',
8+
link: {
9+
pre: function (scope) {
10+
scope.days = uiDayFactory();
11+
scope.isSelected = function (day) {
12+
return scope.select.indexOf(day) != -1;
13+
};
14+
scope.toggle = function (day) {
15+
var index = scope.select.indexOf(day);
16+
if (index == -1) {
17+
scope.select.push(day);
18+
} else {
19+
scope.select.splice(index, 1);
20+
}
21+
};
22+
}
23+
}
24+
};
2525
});
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
angular.module('sm').directive("loadingButton", function(uiDayFactory) {
2-
3-
var template = '<i class="fa fa-spin fa-refresh" ></i> ';
4-
5-
return {
6-
restrict: 'A',
7-
scope: {
8-
status: '=loadingButton',
9-
text: '@loadingText'
10-
},
11-
link: function(scope, elm) {
12-
var prevHTML = elm.html();
13-
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);
18-
} else {
19-
elm.html(prevHTML);
20-
elm.attr("disabled", false);
21-
}
22-
}
23-
});
24-
}
25-
};
26-
});
1+
angular.module('sm').directive("loadingButton", function (uiDayFactory) {
2+
3+
var template = '<i class="fa fa-spin fa-refresh" ></i> ';
4+
5+
return {
6+
restrict: 'A',
7+
scope: {
8+
status: '=loadingButton',
9+
text: '@loadingText'
10+
},
11+
link: function (scope, elm) {
12+
var prevHTML = elm.html();
13+
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);
18+
} else {
19+
elm.html(prevHTML);
20+
elm.attr("disabled", false);
21+
}
22+
}
23+
});
24+
}
25+
};
26+
});
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
angular.module('sm').directive("navCloseOnMobile", function() {
2-
return {
3-
restrict: 'A',
4-
link: function(scope, elm) {
5-
var nav = $(elm);
6-
$(elm).find('li').click(function() {
7-
$('.navbar-collapse.in').collapse('hide');
8-
});
9-
}
10-
};
11-
});
1+
angular.module('sm').directive("navCloseOnMobile", function () {
2+
return {
3+
restrict: 'A',
4+
link: function (scope, elm) {
5+
var nav = $(elm);
6+
$(elm).find('li').click(function () {
7+
$('.navbar-collapse.in').collapse('hide');
8+
});
9+
}
10+
};
11+
});
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
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>' +
10-
' {{displayOptions.currentPage+1}}/{{numberOfPages()}} ' +
11-
'<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-
}
29-
}
30-
};
31-
});
1+
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>' +
10+
' {{displayOptions.currentPage+1}}/{{numberOfPages()}} ' +
11+
'<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+
}
29+
}
30+
};
31+
});

0 commit comments

Comments
 (0)