add eslint working conf

This commit is contained in:
2020-04-29 21:05:38 +02:00
parent ffe8c167cb
commit ebb1c58f90
33 changed files with 866 additions and 846 deletions

View File

@@ -8,19 +8,19 @@
</template>
<script>
export default {
name: "AlertBox",
props: {
type: {
type: String,
required: true,
default: 'success',
},
message: {
type: String,
required: true,
default: 'message',
},
}
export default {
name: 'AlertBox',
props: {
type: {
type: String,
required: true,
default: 'success',
},
message: {
type: String,
required: true,
default: 'message',
},
}
}
</script>

View File

@@ -11,30 +11,31 @@
</template>
<script>
import Nav from "./Nav";
import TopBar from "./TopBar";
import { mapGetters } from 'vuex'
import Nav from './Nav'
import TopBar from './TopBar'
import { mapGetters } from 'vuex'
export default {
name: "App",
components : {
Nav, TopBar
},
mounted() {
this.$store.dispatch('fetchAuthUser')
},
created() {
this.$store.dispatch('setPageTitle', this.$route.meta.title)
},
computed: {
...mapGetters({
authUser: 'authUser',
})
},
watch: {
$route(to, from) {
this.$store.dispatch('setPageTitle', to.meta.title)
}
export default {
name: 'App',
components : {
Nav, TopBar
},
mounted() {
this.$store.dispatch('fetchAuthUser')
},
created() {
this.$store.dispatch('setPageTitle', this.$route.meta.title)
},
computed: {
...mapGetters({
authUser: 'authUser',
})
},
watch: {
// eslint-disable-next-line no-unused-vars
$route(to, from) {
this.$store.dispatch('setPageTitle', to.meta.title)
}
}
}
</script>

View File

@@ -7,8 +7,8 @@
</template>
<script>
export default {
name: "Avatar",
props: ['avatar', 'alt', 'size']
}
export default {
name: 'Avatar',
props: ['avatar', 'alt', 'size']
}
</script>

View File

@@ -8,62 +8,62 @@
<script>
export default {
name: "InputField",
props: {
name: {
type: String,
required: true
},
type: {
type: String,
default: 'text'
},
label: String,
placeholder: String,
required: {
type: Boolean,
default: false
},
errors: Object,
data: String,
classes: String,
export default {
name: 'InputField',
props: {
name: {
type: String,
required: true
},
data: function () {
type: {
type: String,
default: 'text'
},
label: String,
placeholder: String,
required: {
type: Boolean,
default: false
},
errors: Object,
data: String,
classes: String,
},
data: function () {
return {
value: ''
}
},
computed: {
hasError: function () {
return this.required && this.errors && this.errors[this.name] && this.errors[this.name].length > 0
}
},
methods: {
updateField: function () {
this.clearErrors(this.name)
this.$emit('update:field', this.value)
},
errorMessage: function () {
if (this.hasError) {
return this.errors[this.name][0]
}
},
clearErrors: function () {
if (this.hasError) {
this.errors[this.name] = null
}
},
errorClassObject: function () {
return {
value: ''
}
},
computed: {
hasError: function () {
return this.required && this.errors && this.errors[this.name] && this.errors[this.name].length > 0
}
},
methods: {
updateField: function () {
this.clearErrors(this.name);
this.$emit('update:field', this.value)
},
errorMessage: function () {
if (this.hasError) {
return this.errors[this.name][0]
}
},
clearErrors: function () {
if (this.hasError) {
this.errors[this.name] = null
}
},
errorClassObject: function () {
return {
'error-field': this.hasError
}
}
},
watch: {
data: function (val) {
this.value = val
'error-field': this.hasError
}
}
},
watch: {
data: function (val) {
this.value = val
}
}
}
</script>

View File

@@ -5,15 +5,15 @@
</template>
<script>
export default {
name: "Loader",
data: function () {
return {
loading: false,
}
},
mounted() {
setTimeout(() => this.loading = true, 250)
export default {
name: 'Loader',
data: function () {
return {
loading: false,
}
},
mounted() {
setTimeout(() => this.loading = true, 250)
}
}
</script>

View File

@@ -25,22 +25,22 @@
</template>
<script>
export default {
name: "Nav",
data: function () {
return {
toggleNav: true,
}
},
mounted() {
let isTrueSet = (localStorage.getItem('navbar') === 'true');
(isTrueSet) ? this.toggleNav = true : this.toggleNav = false
},
methods: {
toggleNavBar() {
this.toggleNav = !this.toggleNav
localStorage.setItem('navbar', JSON.stringify(this.toggleNav));
}
export default {
name: 'Nav',
data: function () {
return {
toggleNav: true,
}
},
mounted() {
let isTrueSet = (localStorage.getItem('navbar') === 'true');
(isTrueSet) ? this.toggleNav = true : this.toggleNav = false
},
methods: {
toggleNavBar(){
this.toggleNav = !this.toggleNav
localStorage.setItem('navbar', JSON.stringify(this.toggleNav))
}
}
}
</script>

View File

@@ -1,67 +1,74 @@
<template>
<div class="relative mb-2">
<label v-if="label" :for="name" class="pb-1">{{ label }}</label>
<textarea :id="name" type="text" v-model="value" :placeholder="placeholder" @input="updateField()" :class="errorClassObject()" class="w-full h-64 rounded p-2">{{ data }}</textarea>
<textarea :id="name"
type="text"
v-model="value"
:placeholder="placeholder"
@input="updateField()"
:class="errorClassObject()"
class="w-full h-64 rounded p-2">
</textarea>
<p class="text-red-600 m-0" v-text="errorMessage()">Error Here</p>
</div>
</template>
<script>
export default {
name: "TextAreaField",
props: {
name: {
type: String,
required: true
},
type: {
type: String,
default: 'text'
},
label: String,
placeholder: String,
required: {
type: Boolean,
default: false
},
errors: Object,
data: String,
export default {
name: 'TextAreaField',
props: {
name: {
type: String,
required: true
},
data: function () {
type: {
type: String,
default: 'text'
},
label: String,
placeholder: String,
required: {
type: Boolean,
default: false
},
errors: Object,
data: String,
},
data: function () {
return {
value: ''
}
},
computed: {
hasError: function () {
return this.required && this.errors && this.errors[this.name] && this.errors[this.name].length > 0
}
},
methods: {
updateField: function () {
this.clearErrors(this.name)
this.$emit('update:field', this.value)
},
errorMessage: function () {
if (this.hasError) {
return this.errors[this.name][0]
}
},
clearErrors: function () {
if (this.hasError) {
this.errors[this.name] = null
}
},
errorClassObject: function () {
return {
value: ''
}
},
computed: {
hasError: function () {
return this.required && this.errors && this.errors[this.name] && this.errors[this.name].length > 0
}
},
methods: {
updateField: function () {
this.clearErrors(this.name);
this.$emit('update:field', this.value)
},
errorMessage: function () {
if (this.hasError) {
return this.errors[this.name][0]
}
},
clearErrors: function () {
if (this.hasError) {
this.errors[this.name] = null
}
},
errorClassObject: function () {
return {
'error-field': this.hasError
}
}
},
watch: {
data: function (val) {
this.value = val
'error-field': this.hasError
}
}
},
watch: {
data: function (val) {
this.value = val
}
}
}
</script>

View File

@@ -20,23 +20,23 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Avatar from "./Avatar";
import { mapGetters } from 'vuex'
import Avatar from './Avatar'
export default {
name: "TopBar",
components: {
Avatar
},
data: function () {
return {
search: false,
}
},
computed: {
...mapGetters({
authUser: 'authUser',
})
export default {
name: 'TopBar',
components: {
Avatar
},
data: function () {
return {
search: false,
}
},
computed: {
...mapGetters({
authUser: 'authUser',
})
}
}
</script>

View File

@@ -8,80 +8,80 @@
</template>
<script>
import Dropzone from 'dropzone'
import { mapGetters } from 'vuex'
import Dropzone from 'dropzone'
import { mapGetters } from 'vuex'
export default {
name: "UploadableImage",
props: {
imageWidth: {
type: Number,
required: true,
},
imageHeight: {
type: Number,
required: true,
},
location: {
type: String,
required: true
},
image: {
type: Object,
default: null,
},
author: {
type: Object,
required: true
},
id: {
type: Number,
required: true
},
model: {
type: String,
required: true
},
classes: String,
alt: String
export default {
name: 'UploadableImage',
props: {
imageWidth: {
type: Number,
required: true,
},
data: () => {
imageHeight: {
type: Number,
required: true,
},
location: {
type: String,
required: true
},
image: {
type: Object,
default: null,
},
author: {
type: Object,
required: true
},
id: {
type: Number,
required: true
},
model: {
type: String,
required: true
},
classes: String,
alt: String
},
data: () => {
return {
dropzone: null,
dropImage: null,
}
},
mounted() {
if(this.authUser.data.user_id === this.author.data.user_id) {
this.dropzone = new Dropzone(this.$refs.image, this.settings)
}
},
computed: {
...mapGetters({
authUser: 'authUser'
}),
settings() {
let url = '/api/images/' + this.model + '/' + this.id
return {
dropzone: null,
dropImage: null,
}
},
mounted() {
if(this.authUser.data.user_id === this.author.data.user_id) {
this.dropzone = new Dropzone(this.$refs.image, this.settings)
}
},
computed: {
...mapGetters({
authUser: 'authUser'
}),
settings() {
let url = '/api/images/' + this.model + '/' + this.id
return {
paramName: 'image',
url: url,
acceptedFiles: 'image/*',
params: {
'width': this.imageWidth,
'height': this.imageHeight,
'location': this.location,
},
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name=csrf-token]').content
},
success: (e, res) => {
this.dropImage = res
}
paramName: 'image',
url: url,
acceptedFiles: 'image/*',
params: {
'width': this.imageWidth,
'height': this.imageHeight,
'location': this.location,
},
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name=csrf-token]').content
},
success: (e, res) => {
this.dropImage = res
}
},
imageObject() {
return this.dropImage || this.image
}
},
imageObject() {
return this.dropImage || this.image
}
}
}
</script>