major UI modification

This commit is contained in:
les
2020-07-28 12:24:39 +02:00
parent 2758541df0
commit 411560c218
27 changed files with 770 additions and 572 deletions

View File

@@ -8,6 +8,11 @@
v-tab-item
Settings
//- THEME
v-tab {{$t('common.theme')}}
v-tab-item
Theme
//- USERS
v-tab
v-badge(:value='unconfirmedUsers.length' :content='unconfirmedUsers.length') {{$t('common.users')}}
@@ -21,24 +26,13 @@
//- EVENTS
v-tab
v-badge(:content='events.length') {{$t('common.events')}}
v-badge(:value='events.length') {{$t('common.events')}}
v-tab-item
p {{$t('admin.event_confirm_description')}}
v-data-table(
:items='events'
:headers='eventHeaders'
)
//- el-table-column(:label='$t("common.name")' width='300')
//- template(slot-scope='data') {{data.row.title}}
//- el-table-column(:label='$t("common.where")' width='250')
//- template(slot-scope='data') {{data.row.place.name}}
//- el-table-column(:label='$t("common.confirm")' width='250')
//- template(slot-scope='data')
//- el-button-group
//- el-button(type='primary' @click='confirm(data.row.id)' size='mini') {{$t('common.confirm')}}
//- el-button(type='success' @click='preview(data.row.id)' size='mini') {{$t('common.preview')}}
//- client-only
//- el-pagination(v-if='events.length>perPage' :page-size='perPage' :currentPage.sync='eventPage' :total='events.length')
v-container
v-subheader {{$t('admin.event_confirm_description')}}
v-data-table(
:items='events'
:headers='eventHeaders')
//- ANNOUNCEMENTS
v-tab {{$t('common.announcements')}}
@@ -65,10 +59,11 @@ import Settings from '../components/admin/Settings'
import Federation from '../components/admin/Federation'
import Moderation from '../components/admin/Moderation'
import Announcement from '../components/admin/Announcement'
import Theme from '../components/admin/Theme'
export default {
name: 'Admin',
components: { Users, Places, Settings, Federation, Moderation, Announcement },
components: { Users, Places, Settings, Federation, Moderation, Announcement, Theme },
middleware: ['auth'],
async asyncData ({ $axios, params, store }) {
try {
@@ -83,7 +78,10 @@ export default {
data () {
return {
description: '',
events: []
events: [],
eventHeaders: [
{ value: 'title', text: 'Title' }
]
}
},
computed: {

View File

@@ -7,18 +7,19 @@
v-card-subtitle(v-text="$t('login.description')")
v-card-text
v-form
v-text-field(v-model='email' type='email'
:rules='validators.email' autofocus
:placeholder='$t("common.email")'
ref='email')
v-text-field(v-model='email' type='email'
:placeholder='$t("common.email")'
ref='email')
v-text-field(v-model='password'
type='password'
:placeholder='$t("common.password")')
v-text-field(v-model='password'
:rules='validators.password'
type='password'
:placeholder='$t("common.password")')
v-card-actions
v-btn(color='success'
text
:disabled='disabled'
@click='submit') {{$t('common.login')}}
@@ -32,12 +33,13 @@
<script>
import { mapState } from 'vuex'
import { Message } from 'element-ui'
import { validators } from '../plugins/helpers'
export default {
name: 'Login',
data () {
return {
validators,
password: '',
email: '',
loading: false
@@ -49,20 +51,17 @@ export default {
return !this.email || !this.password
}
},
mounted () {
this.$refs.email.focus()
},
methods: {
async forgot () {
if (!this.email) {
Message({ message: this.$t('login.insert_email'), showClose: true, type: 'error' })
this.$root.$message({ message: this.$t('login.insert_email'), color: 'error' })
this.$refs.email.focus()
return
}
this.loading = true
await this.$axios.$post('/user/recover', { email: this.email })
this.loading = false
Message({ message: this.$t('login.check_email'), type: 'success' })
this.$root.$message({ message: this.$t('login.check_email'), color: 'success' })
},
async submit (e) {
if (this.disabled) { return false }
@@ -76,9 +75,9 @@ export default {
data.append('client_id', 'self')
await this.$auth.loginWith('local', { data })
this.loading = false
Message({ message: this.$t('login.ok'), showClose: true, type: 'success' })
this.$root.$message({ message: this.$t('login.ok'), color: 'success' })
} catch (e) {
Message({ message: this.$t('login.error'), showClose: true, type: 'error' })
this.$root.$message({ message: this.$t('login.error'), color: 'error' })
this.loading = false
return
}

View File

@@ -8,28 +8,35 @@
v-card-text
p(v-html="$t('register.description')")
v-text-field(ref='email' v-model='user.email' type='email' required
:placeholder='$t("common.email")' autocomplete='email'
prefix-icon='el-icon-message')
v-form(ref='form')
v-text-field(ref='email'
v-model='user.email' type='email'
:rules="validators.email"
:label='$t("common.email")' autocomplete='email')
v-text-field(v-model='user.password' type="password"
placeholder="Password")
v-text-field(v-model='user.password' type="password"
:rules="validators.password"
:label="$t('common.password')")
v-text-field(v-model='user.description' textarea rows='3' :placeholder="$t('common.description')")
v-textarea(v-model='user.description'
:rules="[validators.required('description')]"
:label="$t('common.description')")
v-card-actions
v-btn(plain type="success" :disabled='disabled' @click='register') {{$t('common.send')}} <v-icon name='chevron-right'/>
v-btn(@click='register' color='primary') {{$t('common.send')}}
v-icon mdi-chevron-right
</template>
<script>
import { mapState } from 'vuex'
import { Message } from 'element-ui'
import get from 'lodash/get'
import { validators } from '../plugins/helpers'
export default {
name: 'Register',
data () {
return {
validators,
loading: false,
user: {}
}
@@ -41,34 +48,30 @@ export default {
},
computed: {
...mapState(['settings']),
disabled () {
if (process.server) { return false }
return !this.user.password || !this.user.email || !this.user.description
}
// disabled () {
// if (process.server) { return false }
// return !this.user.password || !this.user.email || !this.user.description
// }
},
mounted () {
this.$refs.email.focus()
},
methods: {
async register () {
const valid = this.$refs.form.validate()
if (!valid) { return }
try {
this.loading = true
const user = await this.$axios.$post('/user/register', this.user)
// this is the first user registered
const first_user = user && user.is_admin && user.is_active
Message({
showClose: true,
message: first_user ? this.$t('register.first_user') : this.$t('register.complete'),
type: 'success'
this.$root.$message({
message: first_user ? this.$t('register.first_user') : this.$t('register.complete')
})
this.$router.replace('/')
} catch (e) {
const error = get(e, 'response.data.errors[0].message', String(e))
Message({
showClose: true,
message: this.$t(error),
type: 'error'
})
this.$root.$message({ message: this.$t(error), color: 'error' })
}
this.loading = false
}

View File

@@ -1,101 +1,132 @@
<template lang="pug">
v-container
h2.text-center {{edit?$t('common.edit_event'):$t('common.add_event')}}
v-form
v-card
v-card-text
h2.text-center {{edit?$t('common.edit_event'):$t('common.add_event')}}
p {{valid}}
v-form(v-model='valid')
//- NOT LOGGED EVENT
div(v-if='!$auth.loggedIn')
v-divider <v-icon name='user-secret'/> {{$t('event.anon')}}
p(v-html="$t('event.anon_description')")
//- NOT LOGGED EVENT
div(v-if='!$auth.loggedIn')
v-divider <v-icon name='user-secret'/> {{$t('event.anon')}}
p(v-html="$t('event.anon_description')")
//- title
v-text-field.mb-3(v-model='event.title'
:label="$t('event.what_description')"
ref='title')
//- title
v-text-field.mb-3(v-model='event.title'
:rules="[validators.required('title')]"
:label="$t('event.what_description')"
ref='title')
//- description
//- span {{$t('event.description_description')}}
//- Editor.mb-3(v-model='event.description' border no-save style='max-height: 400px;')
//- description
//- span {{$t('event.description_description')}}
Editor(
v-model='event.description'
:label="$t('event.description')"
style='max-height: 400px;')
//- tags
//- div {{$t('event.tag_description')}}
//- client-only
//- v-select.m b-3(v-model='event.tags' multiple filterable
//- @input.native='queryTags=$event.target.value' @change='queryTags=""'
//- allow-create default-first-option placeholder='Tag')
//- v-option(v-for='tag in filteredTags' :key='tag.tag' :label='tag.tag' :value='tag.tag')
//- tags
//- div {{$t('event.tag_description')}}
//- client-only
v-combobox(v-model='event.tags'
chips multiple
:items="tags"
item-text='tag',
item-value='tag'
:hints="$t('event.tag_description')"
:label="$t('common.tags')")
//- v-option(v-for='tag in filteredTags' :key='tag.tag' :label='tag.tag' :value='tag.tag')
//- WHERE
//- v-divider
//- i.el-icon-location-outline
//- span {{$t('common.where')}}
//- p(v-html="$t('event.where_description')")
v-autocomplete(v-model='event.place.name'
:label="$t('common.where')"
:items="places"
item-text="name"
item-value="id"
@change='selectPlace')
//- WHERE
//- v-divider
//- i.el-icon-location-outline
//- span {{$t('common.where')}}
//- p(v-html="$t('event.where_description')")
v-autocomplete(v-model='event.place.name'
:label="$t('common.where')"
:items="places"
item-text="name"
item-value="name"
@change='selectPlace')
//- div {{$t("common.address")}}
v-text-field(ref='address' :label="$t('common.address')" v-model='event.place.address' :disabled='disableAddress')
//- div {{$t("common.address")}}
v-text-field(ref='address' :label="$t('common.address')" v-model='event.place.address' :disabled='disableAddress')
//- WHEN
//- v-divider <v-icon name='clock'/> {{$t('common.when')}}
.text-center
v-btn-toggle(v-model="event.type")
v-btn(value='normal' label="normal") <v-icon name='calendar-day'/> {{$t('event.normal')}}
v-btn(value='multidate' label="multidate") <v-icon name='calendar-week'/> {{$t('event.multidate')}}
v-btn(v-if='settings.allow_recurrent_event' value='recurrent' label="recurrent") <v-icon name='calendar-alt'/> {{$t('event.recurrent')}}
br
span {{$t(`event.${event.type}_description`)}}
v-select.ml-2(v-if='event.type==="recurrent"' v-model='event.recurrent.frequency' placeholder='Frequenza')
v-option(:label="$t('event.each_week')" value='1w' key='1w')
v-option(:label="$t('event.each_2w')" value='2w' key='2w')
//- el-option(:label="$t('event.each_month')" value='1m' key='1m')
//- WHEN
//- v-divider <v-icon name='clock'/> {{$t('common.when')}}
.text-center
v-btn-toggle(v-model="event.type" color='primary')
v-btn(value='normal' label="normal") {{$t('event.normal')}}
v-btn(value='multidate' label="multidate") {{$t('event.multidate')}}
v-btn(v-if='settings.allow_recurrent_event' value='recurrent' label="recurrent") {{$t('event.recurrent')}}
client-only
#picker.mx-auto
v-date-picker.mb-2.mt-3(
:mode='datePickerMode'
:attributes='attributes'
v-model='date'
:locale='$i18n.locale'
:from-page.sync='page'
is-dark
is-inline
is-expanded
:min-date='event.type !== "recurrent" && new Date()')
p {{$t(`event.${event.type}_description`)}}
v-select(v-if='event.type==="recurrent"'
:items="frequencies"
v-model='event.recurrent.frequency')
//- v-option(:label="$t('event.each_week')" value='1w' key='1w')
//- v-option(:label="$t('event.each_2w')" value='2w' key='2w')
//- el-option(:label="$t('event.each_month')" value='1m' key='1m')
div.text-center.mb-2(v-if='event.type === "recurrent"')
span(v-if='event.recurrent.frequency !== "1m" && event.recurrent.frequency !== "2m"') {{whenPatterns}}
v-radio-group(v-else v-model='event.recurrent.type')
v-radio-button(v-for='whenPattern in whenPatterns' :label='whenPattern.key' :key='whenPatterns.key')
span {{whenPattern.label}}
client-only
v-date-picker.mx-auto(
:mode='datePickerMode'
:attributes='attributes'
v-model='date'
:locale='$i18n.locale'
:from-page.sync='page'
is-dark
is-inline
is-expanded
:style="{width: '500px'}"
:min-date='event.type !== "recurrent" && new Date()')
.text-center
v-time-picker.mr-2(
:label="$t('event.from')"
ref='time_start'
v-model="time.start")
div.text-center.mb-2(v-if='event.type === "recurrent"')
span(v-if='event.recurrent.frequency !== "1m" && event.recurrent.frequency !== "2m"') {{whenPatterns}}
v-radio-group(v-else v-model='event.recurrent.type')
v-radio-button(v-for='whenPattern in whenPatterns' :label='whenPattern.key' :key='whenPatterns.key')
span {{whenPattern.label}}
v-time-picker(v-model='time.end'
:label="$t('event.due')")
v-row
v-col
v-menu(v-model='fromDateMenu')
template(v-slot:activator='{ on }')
v-text-field(
:label="$t('event.from')"
v-on='on'
:value='time.start'
readonly)
v-time-picker.mr-2(
:label="$t('event.from')"
ref='time_start'
v-model="time.start")
List(v-if='event.type==="normal" && todayEvents.length' :events='todayEvents' :title='$t("event.same_day")')
v-col
v-menu(v-model='dueDateMenu')
template(v-slot:activator='{ on }')
v-text-field(
:label="$t('event.due')"
v-on='on'
:value='time.end'
readonly)
v-time-picker.mr-2(
:label="$t('event.due')"
v-model="time.end")
//- MEDIA / FLYER / POSTER
List(v-if='event.type==="normal" && todayEvents.length' :events='todayEvents' :title='$t("event.same_day")')
p {{JSON.stringify(event.image)}}
v-file-input(
:label="$t('common.media')"
:hint="$t('event.media_description')"
filled
prepend-icon="mdi-camera"
v-model='event.image'
persistent-hint
accept='image/*')
v-btn.mt-2.float-right(@click='done' :disabled='!couldProceed') {{edit?$t('common.edit'):$t('common.send')}}
//- MEDIA / FLYER / POSTER
v-file-input(
:label="$t('common.media')"
:hint="$t('event.media_description')"
prepend-icon="mdi-camera"
v-model='event.image'
persistent-hint
accept='image/*')
v-card-actions
v-spacer
v-btn(@click='done' color='primary') {{edit?$t('common.edit'):$t('common.send')}}
</template>
<script>
@@ -104,7 +135,7 @@ import _ from 'lodash'
import moment from 'moment-timezone'
import Editor from '@/components/Editor'
import List from '@/components/List'
import { Message } from 'element-ui'
import { validators } from '../../plugins/helpers'
export default {
name: 'NewEvent',
@@ -152,6 +183,10 @@ export default {
const month = moment().month() + 1
const year = moment().year()
return {
validators,
valid: false,
dueDateMenu: false,
fromDateMenu: false,
event: {
type: 'normal',
place: { name: '', address: '' },
@@ -170,7 +205,12 @@ export default {
loading: false,
mediaUrl: '',
queryTags: '',
disableAddress: true
disableAddress: true,
frequencies: [
{ value: '1w', text: this.$t('event.each_week') },
{ value: '2w', text: this.$t('event.each_2w') },
{ value: '1m', text: this.$t('event.each_month') }
]
}
},
computed: {
@@ -289,7 +329,6 @@ export default {
cb(ret)
},
selectPlace (p) {
console.error('sono dentro selectPlace ', p)
const place = this.places.find(place => place.id === p)
if (place && place.address) {
this.event.place.address = place.address
@@ -312,7 +351,6 @@ export default {
uploadedFile (files) {
// const file = files[0]
console.error('dentro uploadedfile', arguments)
// if (file.size / 1024 / 1024 > 4) {
// Message({ type: 'warning', showClose: true, message: this.$tc('event.image_too_big') })
// this.fileList = []
@@ -358,7 +396,8 @@ export default {
}
if (this.event.image) {
formData.append('image', this.event.image[0])
console.error(this.event.image)
formData.append('image', this.event.image)
}
formData.append('title', this.event.title)
formData.append('place_name', this.event.place.name)
@@ -381,15 +420,15 @@ export default {
this.updateMeta()
this.$router.replace('/')
this.loading = false
Message({ type: 'success', showClose: true, message: this.$auth.loggedIn ? this.$t('event.added') : this.$t('event.added_anon') })
this.$root.$message({ type: 'success', message: this.$auth.loggedIn ? this.$t('event.added') : this.$t('event.added_anon') })
} catch (e) {
console.error(e.response)
switch (e.request.status) {
case 413:
Message({ type: 'error', showClose: true, message: this.$t('event.image_too_big') })
this.$root.$message({ type: 'error', message: this.$t('event.image_too_big') })
break
default:
Message({ type: 'error', showClose: true, message: e.response.data })
this.$root.$message({ type: 'error', message: e.response.data })
}
this.loading = false
}

View File

@@ -1,10 +1,8 @@
<template lang="pug">
el-container.announcement-page.text-white
el-header.text-white
h3 <i style='color: red' class='el-icon-info'/> {{announcement.title}}
v-container.announcement-page.text-white
h3 <i style='color: red' class='el-icon-info'/> {{announcement.title}}
el-main
pre.mt-4(v-html='announcement.announcement')
p.mt-4(v-html='announcement.announcement')
</template>
<script>
@@ -36,39 +34,39 @@ export default {
}
</script>
<style lang='less'>
.announcement-page {
// .announcement-page {
.el-header {
height: auto !important;
padding-top: 1em;
border-bottom: 1px solid lightgray;
}
// .el-header {
// height: auto !important;
// padding-top: 1em;
// border-bottom: 1px solid lightgray;
// }
.title {
max-width: 80%;
max-height: 0.1rem;
overflow: hidden;
font-size: 1.6rem;
line-height: 1;
padding-right: 40px;
}
// .title {
// max-width: 80%;
// max-height: 0.1rem;
// overflow: hidden;
// font-size: 1.6rem;
// line-height: 1;
// padding-right: 40px;
// }
pre {
white-space: pre-line;
word-break: break-word;
color: #aaa;
font-size: 1.2em;
font-family: inherit;
}
// pre {
// white-space: pre-line;
// word-break: break-word;
// color: #aaa;
// font-size: 1.2em;
// font-family: inherit;
// }
}
// }
@media only screen and (max-width: 768px) {
#eventDetail {
.title {
font-size: 1em;
font-weight: bold;
}
}
}
// @media only screen and (max-width: 768px) {
// #eventDetail {
// .title {
// font-size: 1em;
// font-weight: bold;
// }
// }
// }
</style>

View File

@@ -1,58 +1,27 @@
<template lang="pug">
v-card#eventDetail.h-event.d-inline-block-mx-auto
v-toolbar(prominent)
v-card.h-event.eventDetail
//- .d-block
v-container
v-list-item(two-line)
v-list-item-content
h2(v-text='event.title')
v-list-item-subtitle
v-list-item-title
time.dt-start(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")')
v-icon mdi-date
b {{event|when}}
small ({{event.start_datetime|from}})
v-list-item-subtitle
v-list-item-title
i.el-icon-location-outline
b.p-location {{event.place.name}}
span - {{event.place.address}}
h2 {{event.title}}
v-spacer
v-btn.mr-1(nuxt :to='`/event/${event.prev}`' color='primary' icon :disabled='!event.prev')
v-icon mdi-arrow-left
v-btn(nuxt :to='`/event/${event.next}`' color='primary' :disabled='!event.next' icon)
v-icon mdi-arrow-right
//- h2 {{event.title}}
//- v-toolbar-subtitle
//- v-toolbar(prominent)
//- v-list-item
//- h3 {{event.title}}
//- v-row(justify='space-between')
v-col(cols='auto')
v-list-item(two-line)
v-list-item-content
v-list-item-title.headline(v-text='event.title')
v-list-item-subtitle
time.dt-start(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")')
v-icon mdi-date
b {{event|when}}
small ({{event.start_datetime|from}})
v-list-item-subtitle
i.el-icon-location-outline
b.p-location {{event.place.name}}
span - {{event.place.address}}
v-col
v-btn.mr-1(nuxt :to='`/event/${event.prev}`' color='primary' icon :disabled='!event.prev')
v-icon mdi-arrow-left
v-btn(nuxt :to='`/event/${event.next}`' color='primary' :disabled='!event.next' icon)
v-icon mdi-arrow-right
template(slot='extension')
h2 {{event.title}}
//- v-list-item
//- i.el-icon-location-outline
//- b.p-location {{event.place.name}}
//- span - {{event.place.address}}
//- v-spacer
//- v-chip.p-category.ml-1(v-for='tag in event.tags' :key='tag' small color='secondary') {{tag}}
.v-btn--absolute.v-btn--right.v-btn--top
v-btn.mr-1(nuxt icon outlined color='primary'
:to='`/event/${event.prev}`' :disabled='!event.prev')
v-icon mdi-arrow-left
v-btn(nuxt bottom right outlined icon color='primary'
:to='`/event/${event.next}`' :disabled='!event.next')
v-icon mdi-arrow-right
v-card-text
v-dialog.embedDialog(:visible.sync='showEmbed')
@@ -65,31 +34,23 @@
//- event image
v-img.main_image.mb-3(
lazy
contain
:src='imgPath'
:lazy-src='thumbImgPath'
v-if='event.image_path')
p.p-description(v-html='event.description')
v-btn.p-category.ml-1(type='text' plain round size='mini' v-for='tag in event.tags' :key='tag') {{tag}}
v-chip.p-category.ml-1(small v-for='tag in event.tags' color='primary' outlined :key='tag') {{tag}}
//- info & actions
//- v-col
v-list
time.dt-start(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') <i class='el-icon-date'></i> <b>{{event|when}}</b> <br/><small>{{event.start_datetime|from}}</small>
p
i.el-icon-location-outline
b.p-location {{event.place.name}}
span - {{event.place.address}}
v-divider {{$t('common.actions')}}
v-list-item(
v-clipboard:success='copyLink'
v-clipboard:copy='`${settings.baseurl}/event/${event.id}`') <i class='el-icon-paperclip'></i> {{$t('common.copy_link')}}
v-btn(text color='primary'
v-clipboard:success='copyLink'
v-clipboard:copy='`${settings.baseurl}/event/${event.id}`') {{$t('common.copy_link')}}
v-list-item(@click='showEmbed=true') <i class='el-icon-copy-document'></i> {{$t('common.embed')}}
v-btn(@click='showEmbed=true' text color='primary') {{$t('common.embed')}}
v-list-item
a(:href='`${settings.baseurl}/api/event/${event.id}.ics`') <i class='el-icon-date'></i> {{$t('common.add_to_calendar')}}
EventAdmin(v-if='is_mine' :event='event')
v-btn(:href='`${settings.baseurl}/api/event/${event.id}.ics`' text color='primary') {{$t('common.add_to_calendar')}}
EventAdmin(v-if='is_mine' :event='event')
//- hr
@@ -137,7 +98,6 @@ import { mapState } from 'vuex'
import EventAdmin from './eventAdmin'
import EmbedEvent from './embedEvent'
import FollowMe from '../../components/FollowMe'
import { Message, MessageBox } from 'element-ui'
import moment from 'moment-timezone'
const htmlToText = require('html-to-text')
@@ -269,7 +229,7 @@ export default {
},
async remove () {
try {
await MessageBox.confirm(this.$t('event.remove_confirmation'), this.$t('common.confirm'), {
await this.$root.$confirm(this.$t('event.remove_confirmation'), this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error'
@@ -300,18 +260,18 @@ export default {
},
async blockUser (resource) {
try {
await MessageBox.confirm(this.$t('admin.user_block_confirm'), {
await this.$root.$confirm(this.$t('admin.user_block_confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error'
})
await this.$axios.post('/instances/toggle_user_block', { ap_id: resource.ap_user.ap_id })
Message({ message: this.$t('admin.user_blocked', { user: resource.ap_user.ap_id }), type: 'success', showClose: true })
this.$root.$message({ message: this.$t('admin.user_blocked', { user: resource.ap_user.ap_id }), type: 'success' })
} catch (e) { }
},
async deleteResource (resource) {
try {
await MessageBox.confirm(this.$t('admin.delete_resource_confirm'),
await this.$root.$confirm(this.$t('admin.delete_resource_confirm'),
this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
@@ -322,7 +282,7 @@ export default {
} catch (e) { }
},
copyLink () {
Message({ message: this.$t('common.copied'), type: 'success', showClose: true })
this.$root.$message({ message: this.$t('common.copied'), type: 'success' })
},
// TOFIX
resource_filter (value) {
@@ -343,7 +303,21 @@ export default {
}
</script>
<style lang='less'>
// #eventDetail {
.eventDetail {
.toolbar {
height: auto !important;
padding: 1em 0;
box-sizing: content-box;
}
.main_image {
width: 100%;
transition: height .100s;
margin: 0 auto;
max-height: 83vh;
}
}
// time {
// margin: 0rem 0rem 0rem 1rem;
// display: inline-block;

View File

@@ -1,26 +1,21 @@
<template lang='pug'>
div
v-divider {{$t('common.admin')}}
v-btn(text color='primary' v-if='event.is_visible' @click='toggle(false)') {{$t(`common.${event.parentId?'skip':'hide'}`)}}
v-btn(text color='primary' v-else @click='toggle(false)') {{$t('common.confirm')}}
v-btn(text color='primary' @click='$router.push(`/add/${event.id}`)') {{$t('common.edit')}}
v-btn(text color='primary' v-if='!event.parentId' @click='remove(false)') {{$t('common.remove')}}
v-menu.menu
v-menu-item
div(v-if='event.is_visible' @click='toggle(false)') <i class='el-icon-open'/> {{$t(`common.${event.parentId?'skip':'hide'}`)}}
div(v-else @click='toggle(false)') <i class='el-icon-turn-off'/> {{$t('common.confirm')}}
v-menu-item(@click='$router.push(`/add/${event.id}`)') <i class='el-icon-edit'/> {{$t('common.edit')}}
v-menu-item(v-if='!event.parentId' @click='remove(false)') <i class='el-icon-delete'/> {{$t('common.remove')}}
template(v-if='event.parentId')
v-divider {{$t('event.recurrent')}}
p.text-secondary
i.el-icon-refresh
small {{event|recurrentDetail}}<br/>
v-menu-item(v-if='event.parent.is_visible' @click='toggle(true)') <i class='el-icon-video-pause'/> {{$t('common.pause')}}
v-menu-item(v-else @click='toggle(true)') <i class='el-icon-video-play'/> {{$t('common.start')}}
v-menu-item(@click='$router.push(`/add/${event.parentId}`)') <i class='el-icon-edit'/> {{$t('common.edit')}}
v-menu-item(@click='remove(true)') <i class='el-icon-delete'/> {{$t('common.remove')}}
template(v-if='event.parentId')
v-divider {{$t('event.recurrent')}}
p.text-secondary
i.el-icon-refresh
small {{event|recurrentDetail}}
v-btn(text color='primary' v-if='event.parent.is_visible' @click='toggle(true)') {{$t('common.pause')}}
v-btn(text color='primary' v-else @click='toggle(true)') {{$t('common.start')}}
v-btn(text color='primary' @click='$router.push(`/add/${event.parentId}`)') {{$t('common.edit')}}
v-btn(text color='primary' @click='remove(true)') {{$t('common.remove')}}
</template>
<script>
import { MessageBox } from 'element-ui'
import { mapActions } from 'vuex'
export default {
@@ -34,19 +29,14 @@ export default {
methods: {
...mapActions(['delEvent']),
async remove (parent = false) {
try {
await MessageBox.confirm(this.$t(`event.remove_${parent ? 'recurrent_' : ''}confirmation`), this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error'
})
const id = parent ? this.event.parentId : this.event.id
await this.$axios.delete(`/event/${id}`)
this.delEvent(Number(id))
this.$router.replace('/')
} catch (e) {
console.error(e)
}
const ret = await this.$root.$confirm(this.$t(`event.remove_${parent ? 'recurrent_' : ''}confirmation`), this.$t('common.confirm'), {
type: 'error'
})
if (!ret) { return }
const id = parent ? this.event.parentId : this.event.id
await this.$axios.delete(`/event/${id}`)
this.delEvent(Number(id))
this.$router.replace('/')
},
async toggle (parent = false) {
const id = parent ? this.event.parentId : this.event.id

View File

@@ -1,19 +1,25 @@
<template lang='pug'>
el-card.mt-5
h4(slot='header')
nuxt-link(to='/')
img(src='/favicon.ico')
span {{settings.title}} - {{$t('common.recover_password')}}
div(v-if='valid')
el-input(type='password', :placeholder='$t("common.new_password")' v-model='new_password' prefix-icon='el-icon-lock')
div(v-else) {{$t('recover.not_valid_code')}}
v-row.mt-5(align='center' justify='center')
v-col(cols='12' md="6" lg="5" xl="4")
v-card
v-card-title {{settings.title}} - {{$t('common.recover_password')}}
//- nuxt-link(to='/')
//- v-img(src='/logo.png')
//- span {{settings.title}} - {{$t('common.recover_password')}}
v-card-text
div(v-if='valid')
v-text-field(type='password'
:rules="validators.password"
autofocus :placeholder='$t("common.new_password")'
v-model='new_password')
div(v-else) {{$t('recover.not_valid_code')}}
el-button.mt-2(plain v-if='valid' type="success" icon='el-icon-check'
@click='change_password') {{$t('common.send')}}
v-card-actions
v-btn(v-if='valid' color='primary' @click='change_password') {{$t('common.send')}}
</template>
<script>
import { Message } from 'element-ui'
import { mapState } from 'vuex'
import { validators } from '../../plugins/helpers'
export default {
name: 'Recover',
@@ -28,22 +34,19 @@ export default {
}
},
data () {
return { new_password: '' }
return { new_password: '', validators }
},
computed: mapState(['settings']),
methods: {
async change_password () {
try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
Message({
showClose: true,
type: 'success',
this.$root.$message({
message: this.$t('common.password_updated')
})
this.$router.replace('/login')
} catch (e) {
Message({
showClose: true,
this.$root.$message({
type: 'warning',
message: e
})