Fixes to navbar and edit page
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -162,7 +162,7 @@
|
||||
<div class="container">
|
||||
<div class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<span class="navbar-item" v-if="isUpdate === true && isEventModified">{{ $t('Unsaved changes') }}</span>
|
||||
<span class="navbar-item" v-if="isEventModified">{{ $t('Unsaved changes') }}</span>
|
||||
</div>
|
||||
<div class="navbar-end">
|
||||
<span class="navbar-item">
|
||||
@@ -293,7 +293,7 @@ export default class EditEvent extends Vue {
|
||||
|
||||
if (this.eventId) {
|
||||
this.event = await this.getEvent();
|
||||
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event));
|
||||
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
|
||||
|
||||
this.pictureFile = await buildFileFromIPicture(this.event.picture);
|
||||
this.limitedPlaces = this.event.options.maximumAttendeeCapacity != null;
|
||||
@@ -301,8 +301,16 @@ export default class EditEvent extends Vue {
|
||||
}
|
||||
|
||||
created() {
|
||||
const now = new Date();
|
||||
const end = new Date();
|
||||
this.initializeEvent();
|
||||
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
|
||||
}
|
||||
|
||||
private initializeEvent() {
|
||||
const roundUpTo = roundTo => x => new Date(Math.ceil(x / roundTo) * roundTo);
|
||||
const roundUpTo15Minutes = roundUpTo(1000 * 60 * 15);
|
||||
|
||||
const now = roundUpTo15Minutes(new Date());
|
||||
const end = roundUpTo15Minutes(new Date());
|
||||
end.setUTCHours(now.getUTCHours() + 3);
|
||||
|
||||
this.event.beginsOn = now;
|
||||
@@ -311,7 +319,7 @@ export default class EditEvent extends Vue {
|
||||
}
|
||||
|
||||
mounted() {
|
||||
this.observer = new IntersectionObserver((entries, observer) => {
|
||||
this.observer = new IntersectionObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
if (entry) {
|
||||
this.showFixedNavbar = !entry.isIntersecting;
|
||||
@@ -454,7 +462,7 @@ export default class EditEvent extends Vue {
|
||||
}
|
||||
|
||||
get isEventModified(): boolean {
|
||||
return JSON.stringify(this.event) !== JSON.stringify(this.unmodifiedEvent);
|
||||
return JSON.stringify(this.event.toEditJSON()) !== JSON.stringify(this.unmodifiedEvent);
|
||||
}
|
||||
|
||||
// getAddressData(addressData) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="container" v-if="config">
|
||||
<section class="hero is-link" v-if="!currentUser.id || !currentActor">
|
||||
<section class="hero is-info" v-if="!currentUser.id || !currentActor">
|
||||
<div class="hero-body">
|
||||
<div>
|
||||
<h1 class="title">{{ config.name }}</h1>
|
||||
<h2 class="subtitle">{{ config.description }}</h2>
|
||||
<router-link class="button" :to="{ name: 'Register' }" v-if="config.registrationsOpen">
|
||||
{{ $t('Register') }}
|
||||
{{ $t('Sign up') }}
|
||||
</router-link>
|
||||
<p v-else>
|
||||
{{ $t("This instance isn't opened to registrations, but you can register on other instances.") }}
|
||||
@@ -14,24 +14,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section v-else>
|
||||
<h1>
|
||||
{{ $t('Welcome back {username}', {username: `@${currentActor.preferredUsername}`}) }}
|
||||
</h1>
|
||||
<section v-else-if="currentActor">
|
||||
<b-message type="is-info">
|
||||
{{ $t('Welcome back {username}', { username: currentActor.displayName() }) }}
|
||||
</b-message>
|
||||
</section>
|
||||
<b-dropdown aria-role="list">
|
||||
<button class="button is-primary" slot="trigger">
|
||||
<span>{{ $t('Create') }}</span>
|
||||
<b-icon icon="menu-down"></b-icon>
|
||||
</button>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<router-link :to="{ name: RouteName.CREATE_EVENT }">{{ $t('Event') }}</router-link>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<router-link :to="{ name: RouteName.CREATE_GROUP }">{{ $t('Group') }}</router-link>
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
<section v-if="currentActor && goingToEvents.size > 0" class="container">
|
||||
<section v-else-if="currentActor && goingToEvents.size > 0" class="container">
|
||||
<h3 class="title">
|
||||
{{ $t("Upcoming") }}
|
||||
</h3>
|
||||
@@ -121,6 +109,7 @@ import { EventRouteName } from '@/router/event';
|
||||
},
|
||||
currentActor: {
|
||||
query: CURRENT_ACTOR_CLIENT,
|
||||
update: data => new Person(data.currentActor),
|
||||
},
|
||||
currentUser: {
|
||||
query: CURRENT_USER_CLIENT,
|
||||
|
||||
Reference in New Issue
Block a user