Skip to content

Commit 1dc6b45

Browse files
committed
RMP: Handle no results case
1 parent c610617 commit 1dc6b45

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

assets/src/modules/sm/App/directives/professorLookupDirective.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ angular.module('sm').directive('professorLookup', function ($http) {
2525
.success(function (data, status, headers, config) {
2626
const results = data.data.search.teachers.edges
2727
if (!results[0]) {
28-
elm.popover('toggle')
28+
elm.popover({
29+
html: true,
30+
trigger: 'manual',
31+
placement: 'auto left',
32+
title: scope.professorLookup,
33+
content: '<a target="_blank" href="https://www.ratemyprofessors.com/search/professors/807?q=' +
34+
scope.professorLookup +
35+
'">No results on RateMyProfessors.com!</a>'
36+
})
37+
elm.popover('show')
38+
scope.stats = null
2939
return
3040
}
3141
const teacher = results[0].node
@@ -74,7 +84,7 @@ angular.module('sm').directive('professorLookup', function ($http) {
7484
'</h2>Level of Difficulty</div></div><div style="text-align:center">Based on ' +
7585
scope.stats.numRatings +
7686
' ratings<br><a target="_blank" href="https://www.ratemyprofessors.com/search/professors/807?q=' +
77-
scope.professorLookup +
87+
encodeURIComponent(scope.professorLookup) +
7888
`">Not the right professor?</a><br><small>&copy; ${yearNumber} <a target="_blank" href="http://www.ratemyprofessors.com">RateMyProfessors.com</a></small></div>`
7989
})
8090
elm.popover('show')

0 commit comments

Comments
 (0)