refactoring with vuetify

This commit is contained in:
les 2020-07-31 01:03:19 +02:00
parent 24a99d0eb0
commit 3f49c915ab
25 changed files with 686 additions and 1071 deletions

View file

@ -4,7 +4,6 @@
title-position='left'
:is-dark="settings['theme.is_dark']"
@update:from-page='updatePage'
:columns="$screens({ default: 1, lg: 2 })"
:locale='$i18n.locale'
:attributes='attributes'
transition='fade'
@ -84,7 +83,6 @@ export default {
</script>
<style>
.vc-opacity-0 {
opacity: 0.3 !important;
}

View file

@ -108,7 +108,7 @@ export default {
</script>
<style lang="less" scoped>
.event {
width: 300px;
width: 330px;
max-width: 450px;
flex-grow: 1;
margin: .2em;

View file

@ -3,7 +3,7 @@
p(v-html="$t('event.follow_me_description', { title: settings.title, account: `@${settings.instance_name}@${domain}`})")
v-text-field(v-model='instance_hostname' ref='instance')
a(slot='append' :href='link' target='_blank')
v-btn(:disabled='(!couldGo || !proceed)' plain type="primary" icon='el-icon-document') {{$t("common.follow")}}
v-btn(:disabled='(!couldGo || !proceed)' plain type="primary") {{$t("common.follow")}}
p.mt-2 <img class='instance_thumb' :src="instance.thumbnail"/> {{instance.title}}
</template>
<script>

View file

@ -2,7 +2,7 @@
v-container#home(fluid)
Announcement(v-for='announcement in announcements' :key='`a_${announcement.id}`' :announcement='announcement')
#calbar.row.mt-2.mb-2
.col-xl-7.col-lg-7.col-sm-6.col-xs-12
.col-xl-5.col-lg-5.col-sm-5.col-xs-12
client-only
Calendar
@ -50,16 +50,11 @@ export default {
}
</script>
<style lang='less'>
// #calbar {
// max-width: 1000px;
// // margin: 0 auto;
// }
// #home {
// max-width: 1600px;
// }
#home {
max-width: 1400px;
}
#events {
max-width: 1600px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;

View file

@ -51,23 +51,4 @@ export default {
#list {
max-width: 500px;
margin: 0 auto;
.el-timeline {
padding-left: 5px;
hr {
margin-top: 4px;
margin-bottom: 4px;
}
}
.el-timeline-item {
padding-bottom: 1px;
}
.el-timeline-item__timestamp {
margin: 0px;
padding: 0px;
}
}
</style>

View file

@ -68,54 +68,6 @@
v-btn(icon v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
v-icon(color='orange') mdi-rss
//- el-menu-item(type='text' v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
//- v-icon(color='orange' name='rss')
//- el-header#header
//- img(src='/favicon.ico')
//- span.ml-1.hidden-xs-only {{settings.title}}
//- small.hidden-sm-only {{settings.description}}
//- el-menu#menu(mode='horizontal' router )
//- el-menu-item(v-if='could_add' index='/add')
//- i.el-icon-plus
//- span.hidden-xs-only {{$t('common.add_event')}}
//- //- nuxt-link(to='/export')
//- el-menu-item(index='/export')
//- i.el-icon-share
//- span.hidden-xs-only {{$t('common.share')}}
//- el-submenu(v-if='settings.enable_trusted_instances && settings.trusted_instances && settings.trusted_instances.length' index=4)
//- template(slot='title')
//- i.el-icon-guide
//- span.hidden-xs-only {{$t('common.places')}}
//- el-menu-item(v-for='instance in settings.trusted_instances' :key='instance.name')
//- a(:href='instance.url' target='_link')
//- img.mr-1(:src='`${instance.url}/favicon.ico`' style='height: 25px;')
//- span.ml-1 {{instance.label || instance.name}}
//- el-menu-item(v-if='!$auth.loggedIn' index='/login')
//- i.el-icon-user
//- span.hidden-xs-only {{$t('common.login')}}
//- el-submenu(v-if='$auth.loggedIn' index=3)
//- template(slot='title')
//- i.el-icon-user
//- span.hidden-xs-only {{$t('common.user')}}
//- el-menu-item(divided index='/settings')
//- i.el-icon-s-tools
//- span {{$t('common.settings')}}
//- el-menu-item(v-if='$auth.user.is_admin' index='/admin')
//- i.el-icon-s-operation
//- span {{$t('common.admin')}}
//- el-menu-item(@click='logout')
//- i.el-icon-switch-button
//- span {{$t('common.logout')}}
//- el-menu-item(type='text' v-clipboard:copy='feedLink' v-clipboard:success='copyLink')
//- v-icon(color='orange' name='rss')
</template>
<script>
import { mapState } from 'vuex'
@ -146,12 +98,12 @@ export default {
},
methods: {
copyLink () {
this.$root.$emit('message', {
this.$root.$message({
message: this.$t('common.feed_url_copied')
})
},
logout () {
this.$root.$emit('message', {
this.$root.$message({
message: this.$t('common.logout_ok')
})
this.$auth.logout()
@ -172,8 +124,7 @@ export default {
this.setSetting({ key: 'trusted_instances', value: this.settings.trusted_instances.concat(trusted_instance) })
} catch (e) {
console.error(e)
Message({
showClose: true,
this.$root.$message({
type: 'error',
message: e
})
@ -182,34 +133,3 @@ export default {
}
}
</script>
<style lang='less'>
// #header {
// display: inline;
// #logo {
// img {
// max-height: 60px;
// }
// float: left;
// line-height: 60px;
// color: white;
// font-size: 1.5em;
// font-weight: 600;
// text-decoration: none;
// small {
// font-size: 0.5em;
// }
// }
// #menu {
// position: absolute;
// right: 10px;
// top: 0px;
// border-bottom: none;
// .el-menu-item {
// padding: 0px 15px;
// }
// }
// }
</style>

View file

@ -11,19 +11,38 @@
:label="$t('event.show_past')"
v-model='showPast')
v-autocomplete#searchInput.mt-0(:placeholder='$t("common.filter")'
v-model='search' :debounce='200'
:fetch-suggestions='querySearch' clearable
@select='addFilter')
template(slot-scope='{ item }')
span.float-left {{ item.label }}
i.float-right.el-icon-place(v-if='item.type==="place"')
i.float-right.el-icon-collection-tag(v-if='item.type==="tag"')
#filters
v-vtn.mr-1.bg-dark(type='text' round plain v-for='t in filters.tags' size='mini'
:key='t' @click='removeTag(t)') {{t}}
v-btn.mr-1.bg-dark.text-warning(type='text' round plain v-for='p in selectedPlaces' size='mini'
:key='p.id' @click='removePlace(p.id)') {{p.name}}
p {{filter}}
v-autocomplete.mt-0(
:label='$t("common.filter")'
:items='keywords'
v-model='filter'
:search-input.sync='search'
item-text='label'
chips
multiple
)
template(v-slot:selection="data")
v-chip(v-bind="data.attrs"
:input-value="data.selected"
close
@click="data.select"
@click:close="remove(data.item)")
v-avatar(left)
v-icon
//- <v-img :src="data.item.avatar"></v-img>
//- </v-avatar>
span {{ data.item.name }}
template(v-slot:item='{ item }')
v-list-item-content
v-list-item-title(v-text='item.label')
//- span.float-left {{ item.label }}
//- i.float-right.el-icon-place(v-if='item.type==="place"')
//- i.float-right.el-icon-collection-tag(v-if='item.type==="tag"')
//- #filters
//- v-vtn.mr-1.bg-dark(type='text' round plain v-for='t in filters.tags' size='mini'
//- :key='t' @click='removeTag(t)') {{t}}
//- v-btn.mr-1.bg-dark.text-warning(type='text' round plain v-for='p in selectedPlaces' size='mini'
//- :key='p.id' @click='removePlace(p.id)') {{p.name}}
</template>
<script>
@ -36,14 +55,15 @@ export default {
},
data () {
return {
filter: null,
search: ''
}
},
computed: {
...mapState(['tags', 'places', 'filters', 'settings']),
selectedPlaces () {
return this.places.filter(p => this.filters.places.includes(p.id))
},
// selectedPlaces () {
// return this.places.filter(p => this.filters.places.includes(p.id))
// },
keywords () {
const tags = this.tags.filter(t => !this.filters.tags.includes(t.tag)).map(t => ({ type: 'tag', label: t.tag, weigth: t.weigth, id: t.tag }))
const places = this.places.filter(p => !this.filters.places.includes(p.id))
@ -58,10 +78,10 @@ export default {
showRecurrent: {
set (value) { this.showRecurrentEvents(value) },
get () { return this.filters.show_recurrent_events }
},
filter () {
return this.filters.tags.concat(this.filters.places)
}
// filter () {
// return this.filters.tags.concat(this.filters.places)
// }
},
methods: {
...mapActions(['setSearchPlaces', 'setSearchTags',

View file

@ -1,6 +1,7 @@
<template lang="pug">
v-container
v-card
v-card-title {{$t('common.settings')}}
v-card-text
//- select timezone
v-autocomplete(v-model='instance_timezone'
:label="$t('admin.select_instance_timezone')"

View file

@ -1,25 +1,43 @@
<template lang="pug">
v-container
v-card
v-card-title {{$t('common.theme')}}
v-card-text
p {{settings['theme.primary']}}
//- LOGO
v-file-input.mt-5(ref='upload'
:label="$t('admin.favicon')"
@change='uploadLogo'
accept='image/*')
template(slot='append-outer')
v-btn(small @click='resetLogo') Reset
v-img(:src='`${settings.baseurl}/favicon.ico?${logoKey}`'
max-width="100px" max-height="80px" contain)
//- LOGO
v-file-input.mt-5(ref='upload'
:label="$t('admin.favicon')"
@change='uploadLogo'
accept='image/*')
template(slot='append-outer')
v-btn(small @click='resetLogo') Reset
v-img(:src='`${settings.baseurl}/favicon.ico?${logoKey}`'
max-width="100px" max-height="80px" contain)
v-switch.mt-5(v-model='is_dark'
inset
:label="$t('admin.is_dark')")
v-color-picker(
mode='hexa'
:label="$t('common.primary_color')"
v-model='primary_color')
v-switch.mt-5(v-model='is_dark'
inset
:label="$t('admin.is_dark')")
v-row
v-col
v-menu(v-model='primaryMenu'
:close-on-content-click="false"
transition="slide-x-transition"
offset-y
absolute
bottom
max-width="290px"
min-width="290px")
template(v-slot:activator='{ on }')
v-text-field(
:label="$t('event.from')"
:value='primary_color'
v-on='on'
clearable
readonly)
v-color-picker(
mode='hexa'
:label="$t('common.primary_color')"
v-model='primary_color')
</template>
<script>
import { mapActions, mapState } from 'vuex'
@ -27,7 +45,8 @@ export default {
name: 'Theme',
data () {
return {
logoKey: 0
logoKey: 0,
primaryMenu: false
}
},
computed: {
@ -43,13 +62,12 @@ export default {
get () { return this.settings['theme.primary'] },
set (value) {
if (!value) { return }
this.setSetting({ key: 'theme.primary', value })
if (this.settings['theme.is_dark']) {
this.$vuetify.theme.themes.dark.primary = value
} else {
this.$vuetify.theme.themes.light.primary = value
}
// this.$vuetify.theme.themes.light.primary = value.hex
// this.setSetting({ key: 'theme.primary', value: value.hex })
}
}
},

View file

@ -5,7 +5,7 @@
Nav
v-main(app)
v-scroll-y-transition(hide-on-leave)
v-fade-transition(hide-on-leave)
nuxt
Footer
@ -26,6 +26,7 @@ export default {
created () {
this.$vuetify.theme.dark = this.settings['theme.is_dark']
this.$vuetify.theme.themes.dark.primary = this.settings['theme.primary']
this.$vuetify.theme.themes.light.primary = this.settings['theme.primary']
}
}
</script>

View file

@ -1,7 +1,7 @@
<template lang='pug'>
v-container.p-4.text-center#error
h1(v-if="error.statusCode === 404") <i class='el-icon-warning'></i> {{error.message}}
h1(v-else) <i name='el-icon-warning'></i> An error occurred: {{error.message}}
v-container.p-4.text-center
v-alert(v-if="error.statusCode === 404") ¯\_()_/¯ {{error.message}}
v-calert(v-else) <i>warning</i> An error occurred: {{error.message}}
nuxt-link(to='/') Back to home
</template>
@ -16,10 +16,3 @@ export default {
}
}
</script>
<style lang="less">
#error {
margin-top: 20px;
color: orange;
i { color: orangered }
}
</style>

View file

@ -80,7 +80,9 @@
"delete": "Elimina",
"announcements": "Annunci",
"url": "Indirizzo URL",
"place": "Luogo"
"place": "Luogo",
"tags": "Tags",
"theme": "Tema"
},
"login": {
"description": "Entrando puoi pubblicare nuovi eventi.",

View file

@ -24,13 +24,14 @@ module.exports = {
/*
** Global CSS
*/
// css: [
css: [
'@mdi/font/css/materialdesignicons.css'
// 'bootstrap/dist/css/bootstrap.min.css',
// 'element-ui/lib/theme-chalk/index.css',
// 'element-ui/lib/theme-chalk/display.css',
// '@/assets/theme/index.css'
// '@/assets/style.less'
// ],
],
/*
** Plugins to load before mounting the App
@ -98,6 +99,7 @@ module.exports = {
'@nuxtjs/vuetify'
],
vuetify: {
defaultAssets: false,
optionsPath: './vuetify.options.js'
/* module options */
},

View file

@ -33,16 +33,14 @@
"axios": "^0.19.2",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.5.0",
"config": "^3.3.1",
"consola": "^2.13.0",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"cross-env": "^7.0.2",
"date-fns": "^2.15.0",
"dayjs": "^1.8.30",
"dayjs": "^1.8.31",
"dompurify": "^2.0.11",
"element-ui": "^2.13.2",
"email-templates": "^7.1.0",
"express": "^4.17.1",
"express-oauth-server": "^2.0.0",
@ -58,26 +56,25 @@
"moment-timezone": "^0.5.31",
"morgan": "^1.10.0",
"multer": "^1.4.2",
"nominatim-geocoder": "^0.1.4",
"nuxt": "^2.13.3",
"nuxt": "^2.14.0",
"nuxt-express-module": "^0.0.11",
"pg": "^8.3.0",
"sequelize": "^6.3.3",
"sequelize-cli": "^6.2.0",
"sharp": "^0.25.4",
"sqlite3": "^5.0.0",
"tiptap": "^1.29.1",
"tiptap-extensions": "^1.31.1",
"tiptap": "^1.29.3",
"tiptap-extensions": "^1.31.3",
"to-ico": "^1.1.5",
"url": "^0.11.0",
"v-calendar": "^1.0.8",
"vue-awesome": "^4.1.0",
"vue-clipboard2": "^0.3.1",
"vue-i18n": "^8.18.2",
"vue-i18n": "^8.20.0",
"yargs": "^15.4.1"
},
"devDependencies": {
"@nuxtjs/eslint-config": "^3.0.0",
"@mdi/font": "^5.4.55",
"@nuxtjs/eslint-config": "^3.1.0",
"@nuxtjs/vuetify": "^1.11.2",
"babel-eslint": "^10.1.0",
"eslint": "^7.5.0",
@ -124,8 +121,5 @@
"repository": {
"type": "git",
"url": "https://framagit.org/les/gancio"
},
"resolutions": {
"prosemirror-model": "1.10.0"
}
}

View file

@ -52,7 +52,6 @@
</template>
<script>
import { mapState } from 'vuex'
import { Message } from 'element-ui'
import Users from '../components/admin/Users'
import Places from '../components/admin/Places'
import Settings from '../components/admin/Settings'
@ -99,9 +98,8 @@ export default {
this.loading = true
await this.$axios.$get(`/event/confirm/${id}`)
this.loading = false
Message({
this.$root.$message({
message: this.$t('event.confirmed'),
showClose: true,
type: 'success'
})
this.events = this.events.filter(e => e.id !== id)

View file

@ -19,19 +19,24 @@
:placeholder='$t("common.password")')
v-card-actions
v-spacer
v-btn(text @click='forgot' small) {{$t('login.forgot_password')}}
v-btn(text
tabindex="1"
@click='forgot' small) {{$t('login.forgot_password')}}
v-card-actions
v-btn(color='success'
:disabled='!valid'
@click='submit') {{$t('common.login')}}
v-spacer
v-btn(v-if='settings.allow_registration'
to='/register'
text
tabindex="1"
color='orange') {{$t('login.not_registered')}}
v-btn(color='success'
tabindex="0"
:disabled='!valid || loading' :loading='loading'
@click='submit') {{$t('common.login')}}
</template>
<script>

View file

@ -1,6 +1,6 @@
<template lang='pug'>
v-row.mt-5(align='center' justify='center')
v-col(cols='12' sm='10' md="6")
v-col(cols='12' md="6" lg="5" xl="4")
v-card
v-card-title {{$t('common.register')}}
@ -24,7 +24,9 @@
v-card-actions
v-spacer
v-btn(@click='register' :disabled='!valid' color='primary') {{$t('common.send')}}
v-btn(@click='register'
:disabled='!valid || loading' :loading='loading'
color='primary') {{$t('common.send')}}
v-icon mdi-chevron-right
</template>
@ -40,7 +42,7 @@ export default {
validators,
loading: false,
user: {},
valid: false
valid: true
}
},
// https://nuxtjs.org/api/pages-validate/
@ -49,7 +51,7 @@ export default {
return store.state.settings.allow_registration
},
computed: {
...mapState(['settings']),
...mapState(['settings'])
// disabled () {
// if (process.server) { return false }
// return !this.user.password || !this.user.email || !this.user.description

View file

@ -10,7 +10,6 @@
<script>
import Editor from '@/components/Editor'
import { mapState, mapActions } from 'vuex'
import { Message } from 'element-ui'
export default {
components: { Editor },
@ -23,8 +22,7 @@ export default {
methods: {
...mapActions(['setSetting']),
save () {
Message({
showClose: true,
this.$root.$message({
type: 'success',
message: this.$t('common.done')
})

View file

@ -151,7 +151,8 @@
v-card-actions
v-spacer
v-btn(@click='done' color='primary') {{edit?$t('common.edit'):$t('common.send')}}
v-btn(@click='done' :loading='loading' :disabled='!valid || loading'
color='primary') {{edit?$t('common.edit'):$t('common.send')}}
</template>
<script>

View file

@ -24,7 +24,7 @@
v-icon mdi-arrow-right
v-card-text
v-dialog.embedDialog(:visible.sync='showEmbed')
//- v-dialog.embedDialog(:visible.sync='showEmbed')
h4(slot='title') {{$t('common.embed_title')}}
EmbedEvent(:event='event')
@ -33,13 +33,20 @@
//- event image
v-img.main_image.mb-3(
lazy
contain
lazy
:src='imgPath'
:lazy-src='thumbImgPath'
v-if='event.image_path')
template(v-slot:placeholder)
v-row(
class="fill-height ma-0"
align="center"
justify="center")
v-progress-circular(indeterminate
color="grey lighten-5")
p.p-description(v-html='event.description')
div.p-description(v-html='event.description')
v-chip.p-category.ml-1(small v-for='tag in event.tags' color='primary' outlined :key='tag') {{tag}}
//- info & actions
@ -304,15 +311,9 @@ export default {
</script>
<style lang='less'>
.eventDetail {
.toolbar {
height: auto !important;
padding: 1em 0;
box-sizing: content-box;
}
.main_image {
width: 100%;
transition: height .100s;
transition: all 1s;
margin: 0 auto;
max-height: 83vh;
}

View file

@ -1,18 +1,17 @@
<template lang='pug'>
el-row(:gutter='10')
el-col(:span='12' :xs='24')
el-alert.mb-1.mt-1(type='info' show-icon) {{$t('common.embed_help')}}
el-input(v-model='code')
v-row(:gutter='10')
v-col(:span='12' :xs='24')
v-alert.mb-1.mt-1(type='info' show-icon) {{$t('common.embed_help')}}
v-text-field(v-model='code')
el-button(slot='append' v-clipboard:copy='code' v-clipboard:success='copyLink'
plain type="primary" icon='el-icon-document') {{$t("common.copy")}}
el-col.mt-2(:span='12' :xs='24' v-html='code')
v-col.mt-2(:span='12' :xs='24' v-html='code')
</template>
<script>
import { mapState } from 'vuex'
import { Message } from 'element-ui'
export default {
name: 'embedEvent',
name: 'EmbedEvent',
props: ['event'],
computed: {
...mapState(['settings']),
@ -25,7 +24,7 @@ export default {
},
methods: {
copyLink () {
Message({ message: this.$t('common.copied'), type: 'success', showClose: true })
this.$root.$message({ message: this.$t('common.copied'), type: 'success' })
}
}
}

View file

@ -13,7 +13,6 @@
</template>
<script>
import { mapState } from 'vuex'
import { MessageBox } from 'element-ui'
import url from 'url'
export default {
@ -56,9 +55,7 @@ export default {
// })
// },
remove_account () {
MessageBox.confirm(this.$t('settings.remove_account_confirm'), this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
this.$root.$confirm(this.$t('settings.remove_account_confirm'), this.$t('common.confirm'), {
type: 'error'
}).then(() => {
this.$axios.$delete('/user')

View file

@ -13,7 +13,6 @@
</template>
<script>
import { Message } from 'element-ui'
export default {
name: 'Recover',
@ -33,15 +32,13 @@ export default {
async change_password () {
try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
Message({
showClose: true,
this.$root.$message({
type: 'success',
message: this.$t('common.password_updated')
})
this.$router.replace('/login')
} catch (e) {
Message({
showClose: true,
this.$root.$message({
type: 'warning',
message: e
})

View file

@ -14,7 +14,6 @@
</template>
<script>
import { Message } from 'element-ui'
export default {
name: 'Recover',
@ -34,15 +33,13 @@ export default {
async change_password () {
try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
Message({
showClose: true,
this.$root.$message({
type: 'success',
message: this.$t('common.password_updated')
})
this.$router.replace('/login')
} catch (e) {
Message({
showClose: true,
this.$root.$message({
type: 'warning',
message: e
})

1371
yarn.lock

File diff suppressed because it is too large Load diff