Clean up code

This commit is contained in:
Ramon Wenger 2022-01-26 20:49:31 +01:00
parent 7da98d9ae7
commit 457c59cbc4
35 changed files with 40 additions and 40 deletions

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div class="assignment-with-submissions">
<p class="assignment-with-submissions__text">
{{ assignment.assignment }}

View File

@ -25,7 +25,7 @@
const Tick = () => import(/* webpackChunkName: "icons" */'@/components/icons/Tick');
export default {
props: ['selected-color'],
props: ['selectedColor'],
components: {
Tick

View File

@ -35,7 +35,6 @@
import openSidebar from '@/mixins/open-sidebar';
import me from '@/mixins/me';
const Logo = () => import(/* webpackChunkName: "icons" */'@/components/icons/Logo');
const Hamburger = () => import(/* webpackChunkName: "icons" */'@/components/icons/Hamburger');
export default {
@ -44,7 +43,6 @@
components: {
ContentNavigation,
UserWidget,
Logo,
CurrentClass,
Hamburger,
},

View File

@ -41,7 +41,7 @@
<script>
export default {
props: ['title', 'subtitle', 'route', 'link-text'],
props: ['title', 'subtitle', 'route', 'linkText'],
methods: {
navigate() {
if (this.route) {

View File

@ -45,7 +45,7 @@
topics: {
query: ALL_TOPICS_QUERY,
manual: true,
result({data, loading, networkStatus}) {
result({data, loading}) {
if (!loading) {
this.topics = this.$getRidOfEdges(data).topics;
}

View File

@ -40,7 +40,7 @@
},
watch: {
$route(to, from) {
$route() {
this.show = false;
}
},

View File

@ -120,7 +120,7 @@
},
methods: {
setContentBlockType(checked, localContentBlock) {
setContentBlockType(checked) {
this.localContentBlock.isAssignment = checked;
},
update(index, element) {

View File

@ -93,13 +93,12 @@ export default {
methods: {
addNote(id) {
if (!this.parent.hasOwnProperty('__typename')) {
this.parent.__typename = 'ContentBlockNode';
}
const type = Object.prototype.hasOwnProperty.call(this.parent, '__typename')
? this.parent.__typename : 'ContentBlockNode';
this.$store.dispatch('addNote', {
content: id,
type: this.parent.__typename,
type,
block: this.root
});
},

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div class="instrument-widget">
<div
class="instrument-widget__description"

View File

@ -18,7 +18,7 @@
export default {
props: {
value: Object,
'no-margin': {
noMargin: {
default: false
}
},

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<h4
class="section-title"
v-html="value.text"

View File

@ -6,6 +6,7 @@
</template>
<script>
//todo: esacpe value.text
export default {
props: ['value']
};

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div class="task">
<div
class="task__text"

View File

@ -6,6 +6,7 @@
</template>
<script>
// todo: escape text maybe
export default {
props: ['value']
};

View File

@ -112,6 +112,7 @@
return this.assignment.id ? this.assignment.id.replace(/=/g, '') : '';
},
feedbackText() {
// todo: should we maybe clean up this feedback text?
let feedback = this.assignment.submission.submissionFeedback;
return `<span class="inline-title">Feedback von ${feedback.teacher.firstName} ${feedback.teacher.lastName}:</span> ${feedback.text}`;
},

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<p
class="spellcheck"
v-if="corrections"

View File

@ -52,7 +52,6 @@
const FinalSubmission = () => import('@/components/content-blocks/assignment/FinalSubmission');
const FileUpload = () => import('@/components/ui/file-upload/FileUpload');
const DocumentBlock = () => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/DocumentBlock');
export default {
props: {
@ -81,7 +80,6 @@
FileUpload,
SubmissionInput,
FinalSubmission,
DocumentBlock,
},
computed: {

View File

@ -48,7 +48,7 @@
this.mountUploadcare();
},
methods: {
error(e) {
error() {
this.hadError = true;
delete this.value.url;
@ -84,8 +84,7 @@
</script>
<style scoped lang="scss">
@import "@/styles/_variables.scss";
@import "@/styles/_mixins.scss";
@import "~styles/helpers";
.image-form {
&__error {

View File

@ -17,7 +17,7 @@
type: Object,
default: null,
validator(value) {
return value.hasOwnProperty('text');
return Object.prototype.hasOwnProperty.call(value, 'text');
}
},
index: {

View File

@ -31,7 +31,6 @@
<script>
import {INTERDISCIPLINARY, LANGUAGE_COMMUNICATION, SOCIETY} from '@/consts/instrument.consts';
import Checkbox from '@/components/ui/Checkbox';
import FilterGroup from '@/components/instruments/FilterGroup';
import INSTRUMENT_TYPES_QUERY from 'gql/queries/instrumentTypesQuery';
@ -40,7 +39,6 @@
components: {
FilterGroup,
Checkbox,
},
data() {
return {

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div
class="module"
v-if="module.id"

View File

@ -73,7 +73,6 @@
import BackLink from '@/components/BackLink';
import {moduleQuery} from '@/graphql/queries';
import SubNavigationItem from '@/components/book-navigation/SubNavigationItem';
import ToggleEditing from '@/components/toggle-menu/ToggleEditing';
import me from '@/mixins/me';
import SnapshotMenu from '@/components/modules/SnapshotMenu';
@ -88,7 +87,6 @@
components: {
SnapshotMenu,
BackLink,
SubNavigationItem,
ToggleEditing,
},

View File

@ -1,4 +1,5 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div class="snapshot-list-item">
<router-link
:to="snapshotRoute"

View File

@ -2,8 +2,7 @@
<div class="objective-groups">
<objective-group
:group="group"
v-for="group in objectiveGroups"
v-if="!group.hidden"
v-for="group in filteredObjectiveGroups"
:key="group.id"
/>
</div>
@ -39,6 +38,9 @@
},
computed: {
filteredObjectiveGroups() {
return this.objectiveGroups.filter(g => !g.hidden);
},
objectiveGroups() {
/*
a teacher should get multiple blocks, so he can manage the visibility for his students.

View File

@ -14,7 +14,6 @@
<script>
const SimpleFileUploadHiddenInput = () => import('@/components/ui/file-upload/SimpleFileUploadHiddenInput');
const ButtonWithIconAndText = () => import('@/components/ui/ButtonWithIconAndText');
const DocumentIcon = () => import(/* webpackChunkName: "icons" */'@/components/icons/DocumentIcon');
export default {
props: ['value'],
@ -22,7 +21,6 @@
components: {
ButtonWithIconAndText,
SimpleFileUploadHiddenInput,
DocumentIcon,
},
methods: {

View File

@ -1,5 +1,5 @@
import dayjs from 'dayjs';
require('dayjs/locale/de');
import 'dayjs/locale/de';
dayjs.locale('de');

View File

@ -1 +1 @@
export const withoutOwnerFirst = (a, b) => a.owner ? 1 : -1;
export const withoutOwnerFirst = (a) => a.owner ? 1 : -1;

View File

@ -2,6 +2,7 @@ export default (contents) => {
if (contents && contents.length) {
let first = contents.find(content => content.type !== 'image_url_block');
if (first && first.type) {
let parts;
switch (first.type) {
case 'text_block':
return first.value.text.replace(/<p>/g, '').replace(/<\/p>/g, '<br>').slice(0, 75) + '...';
@ -9,7 +10,7 @@ export default (contents) => {
case 'link_block':
return first.value.url;
case 'document_block':
const parts = first.value.url.split('/');
parts = first.value.url.split('/');
return parts[parts.length - 1];
default:
return '';

View File

@ -67,7 +67,7 @@ export const constructContentComponentBookmarkMutation = (uuid, bookmarked, pare
bookmarked
}
},
update: (store, response) => {
update: (store) => {
const query = CONTENT_BLOCK_QUERY;
const variables = {id: root};
const data = store.readQuery({

View File

@ -68,14 +68,14 @@ function getCookieValue(cookieName) {
function loginRequired(to) {
// public pages have the meta.public property set to true
return !to.hasOwnProperty('meta') || !to.meta.hasOwnProperty('public') || !to.meta.public;
return !Object.prototype.hasOwnProperty.call(to, 'meta') || !Object.prototype.hasOwnProperty.call(to.meta ,'public') || !to.meta.public;
}
function unauthorizedAccess(to) {
return loginRequired(to) && getCookieValue('loginStatus') !== 'true';
}
function redirectUsersWithoutValidLicense(to) {
function redirectUsersWithoutValidLicense() {
return privateApolloClient.query({
query: ME_QUERY,
}).then(({data}) => data.me.expiryDate == null);
@ -87,7 +87,7 @@ function redirectStudentsWithoutClass() {
}).then(({data}) => data.me.schoolClasses.edges.length === 0 && !data.me.isTeacher);
}
function redirectUsersToOnboarding(to) {
function redirectUsersToOnboarding() {
return privateApolloClient.query({
query: ME_QUERY,
}).then(({data}) => !data.me.onboardingVisited);

View File

@ -15,7 +15,7 @@ export default {
id: selectedClass.id
}
},
update(store, data) {
update(store) {
let meData = store.readQuery({query: ME_QUERY});
meData.me.selectedClass = selectedClass;

View File

@ -92,7 +92,6 @@
import NEW_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/addContentBlock.gql';
import {setUserBlockType} from '@/helpers/content-block';
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
import {MODULE_PAGE} from '@/router/module.names';
export default Vue.extend({
props: {

View File

@ -41,7 +41,7 @@
query: ALL_MODULES,
// prefetch: true,
manual: true,
result({data, loading, networkStatus}) {
result({data, loading}) {
if (!loading) {
this.modules = this.$getRidOfEdges(data).modules;
}

View File

@ -2,7 +2,7 @@ const getRidOfEdges = (collection) => {
if (typeof collection === 'object' && collection && !Array.isArray(collection)) {
let newObj = {};
for (const k in collection) {
if (collection.hasOwnProperty(k)) {
if (Object.prototype.hasOwnProperty.call(collection, k)) {
if (k === 'edges') {
return collection.edges.map(edge => getRidOfEdges(edge.node));
} else {
@ -20,7 +20,7 @@ const getRidOfEdges = (collection) => {
};
const EdgesPlugin = {
install(Vue, options) {
install(Vue) {
Vue.prototype.$getRidOfEdges = getRidOfEdges;
}
};

View File

@ -3,7 +3,7 @@
import Vue from 'vue';
class ModalStore {
constructor(data = {}) {
constructor() {
this.vm = new Vue({
data: () => ({
component: '',
@ -18,7 +18,7 @@ class ModalStore {
}
const ModalPlugin = {
install(Vue, options) {
install(Vue) {
const store = new ModalStore({});
const reset = () => {