Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linked Course Names #407

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/web/src/components/ScheduleEvent.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template functional>
<div class="schedule-event" :style="data.style" data-cy="schedule-event">
<div class="event-text">
<span data-cy="title"> <a v-bind:href= "'/explore/' + props.name.split(' ')[0] + '/' + props.name.split(' ')[0] + '-' + props.name.split(' ')[1]"> {{props.title}}</a> </span>
<span data-cy="title"> <a v-bind:href= $options.getExploreCourseLink(props.name)> {{props.title}}</a> </span>
<br />
<span data-cy="name">{{ props.name }}</span>
&nbsp;-&nbsp;
Expand All @@ -15,6 +15,15 @@
</div>
</div>
</template>
<script>
export default {
getExploreCourseLink(courseName) {
var subject = courseName.split(' ')[0];
var courseNumber = courseName.split(' ')[1];
return "/explore/" + subject + "/" + subject + "-" + courseNumber;
Copy link
Contributor

@jshom jshom Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more nit :)
Let use template strings (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) to generate the url, makes the template a tad easier to read.

Something like

return `/explore/${subject}/${subject}-${courseNumber}`

Besides that lgtm!

},
};
</script>
<style lang="scss">
.schedule-event {
display: block;
Expand All @@ -41,3 +50,4 @@
}
}
</style>