[O] Inline assignment entry ts script
This commit is contained in:
@@ -1,31 +0,0 @@
|
|||||||
import {Component, Prop, Vue} from 'vue-property-decorator';
|
|
||||||
import {Assignment} from '@/components/app/app';
|
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
})
|
|
||||||
export default class AssignmentEntry extends Vue
|
|
||||||
{
|
|
||||||
@Prop({required: true}) assignment: Assignment;
|
|
||||||
|
|
||||||
@Prop({default: false}) unread: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format a date to the displayed format
|
|
||||||
*
|
|
||||||
* @param date Date
|
|
||||||
*/
|
|
||||||
getMoment(date: string)
|
|
||||||
{
|
|
||||||
return moment(new Date(date));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark this unread assignment as read
|
|
||||||
*/
|
|
||||||
markAsRead()
|
|
||||||
{
|
|
||||||
// Call custom event
|
|
||||||
this.$emit('mark-as-read', this.assignment)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,5 +27,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script src="./assignment-entry.ts" lang="ts"></script>
|
<script lang="ts">
|
||||||
|
import {Component, Prop, Vue} from 'vue-property-decorator';
|
||||||
|
import {Assignment} from '@/components/app/app';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export default class AssignmentEntry extends Vue
|
||||||
|
{
|
||||||
|
@Prop({required: true}) assignment: Assignment;
|
||||||
|
|
||||||
|
@Prop({default: false}) unread: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a date to the displayed format
|
||||||
|
*
|
||||||
|
* @param date Date
|
||||||
|
*/
|
||||||
|
getMoment(date: string)
|
||||||
|
{
|
||||||
|
return moment(new Date(date));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark this unread assignment as read
|
||||||
|
*/
|
||||||
|
markAsRead()
|
||||||
|
{
|
||||||
|
// Call custom event
|
||||||
|
this.$emit('mark-as-read', this.assignment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<style src="./assignment-entry.scss" lang="scss" scoped></style>
|
<style src="./assignment-entry.scss" lang="scss" scoped></style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {Component, Prop, Vue} from 'vue-property-decorator';
|
import {Component, Prop, Vue} from 'vue-property-decorator';
|
||||||
import App, {Assignment, Course} from '@/components/app/app';
|
import App, {Assignment, Course} from '@/components/app/app';
|
||||||
import AssignmentEntry from '@/pages/overall/overall-course/assignment-entry/assignment-entry';
|
import AssignmentEntry from '@/pages/overall/overall-course/assignment-entry/assignment-entry.vue';
|
||||||
import CourseHead from '@/pages/overall/overall-course/course-head/course-head.vue';
|
import CourseHead from '@/pages/overall/overall-course/course-head/course-head.vue';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
Reference in New Issue
Block a user