Merge remote-tracking branch 'origin/develop'

This commit is contained in:
Ramon Wenger 2019-09-09 14:12:40 +02:00
commit 253dcd1446
7 changed files with 84 additions and 63 deletions

View File

@ -2,7 +2,7 @@
<div class="content-block__container hideable-element" :class="{'hideable-element--hidden': hidden}">
<div class="content-block" :class="specialClass">
<div class="block-actions" v-if="canEditContentBlock && editModule">
<user-widget v-bind="me" class="block-actions__user-widget content-block__user-widget"></user-widget>
<user-widget :show-menu="false" v-bind="me" class="block-actions__user-widget content-block__user-widget"></user-widget>
<more-options-widget>
<li class="popover-links__link"><a @click="deleteContentBlock(contentBlock)">Löschen</a></li>
<li class="popover-links__link"><a @click="editContentBlock(contentBlock)">Bearbeiten</a></li>
@ -122,7 +122,7 @@
},
contentBlocksWithContentLists() {
/*
collects all conent_list_items in content_lists:
collects all content_list_items in content_lists:
{
text_block,
content_list_item: [contents...],
@ -146,18 +146,21 @@
}
*/
let contentList = [];
let startingIndex = 0;
let newContent = this.contentBlock.contents.reduce((newContents, content, index) => {
// collect content_list_items
if (content.type === 'content_list_item') {
contentList = [...contentList, content]
if (index === this.contentBlock.contents.length - 1) { // content is last element of contents array
return [...newContents, ...this.createContentListOrBlocks(contentList)];
startingIndex = this.updateStartingIndex(startingIndex, contentList);
return [...newContents, ...this.createContentListOrBlocks(contentList, startingIndex)];
}
return newContents
return newContents;
} else {
// handle all other items and reset current content_list if necessary
if (contentList.length !== 0) {
newContents = [...newContents, ...this.createContentListOrBlocks(contentList), content];
newContents = [...newContents, ...this.createContentListOrBlocks(contentList, startingIndex), content];
startingIndex = this.updateStartingIndex(startingIndex, contentList);
contentList = [];
return newContents;
} else {
@ -165,9 +168,8 @@
}
}
}, []);
return Object.assign({}, this.contentBlock, {
contents: newContent
contents: this.removeSingleContentListItem(newContent, startingIndex)
});
},
schoolClass() {
@ -209,18 +211,29 @@
}
});
},
createContentListOrBlocks(contentList) {
// if list contains only one item, return blocks
if (contentList.length === 1) {
return contentList[0].value;
}
createContentListOrBlocks(contentList, startingIndex) {
return [{
type: 'content_list',
contents: contentList,
id: contentList[0].id
id: contentList[0].id,
startingIndex
}];
},
updateStartingIndex(startingIndex, contentList) {
return contentList.length > 1 ? startingIndex + contentList.length : startingIndex;
},
removeSingleContentListItem(content, index) {
// just handle the case where we have one contentlistItem ( no index like "a)"" will be shown)
if (index > 0) {
return content;
};
let contentListIndex = content.findIndex(contentItem => contentItem.type === 'content_list');
if (contentListIndex < 0) {
return content;
}
return [...content.slice(0, contentListIndex), ...content[contentListIndex].contents[0].value, ...content.slice(contentListIndex + 1)];
}
},
data() {
return {

View File

@ -1,27 +1,28 @@
<template>
<div class="user-widget" :class="{'user-widget--is-profile': isProfile}">
<div class="user-widget__avatar" @click="toggleShowPopover()">
<avatar :avatar-url="avatarUrl" :icon-highlighted="isProfile"/>
</div>
<widget-popover v-if="showPopover"
@hide-me="showPopover = false"
:mobile="mobile"
class="user-widget__popover ">
<li class="popover-links__link popover-links__link--large popover-links__link--emph">{{firstName}} {{lastName}}</li>
<li class="popover-links__link popover-links__link--large">
<router-link to="/me/activity" @click="toggleShowPopover()">Aktivität</router-link>
</li>
<li class="popover-links__link popover-links__link--large" @click="toggleShowPopover()">
<router-link to="/me/profile">Profil</router-link>
</li>
<li class="popover-links__link popover-links__link--large" @click="toggleShowPopover()">
<router-link to="/me/myclasses">Klassenliste</router-link>
</li>
<li class="popover-links__link popover-links__link--large" data-cy="logout" @click="logout()">
<a>Logout</a>
</li>
</widget-popover>
<div class="user-widget" :class="{'user-widget--is-profile': isProfile}">
<div class="user-widget__avatar" @click="toggleShowPopover()">
<avatar :avatar-url="avatarUrl" :icon-highlighted="isProfile"/>
</div>
<widget-popover v-if="showPopover && showMenu"
@hide-me="showPopover = false"
:mobile="mobile"
class="user-widget__popover ">
<li class="popover-links__link popover-links__link--large popover-links__link--emph">{{firstName}} {{lastName}}
</li>
<li class="popover-links__link popover-links__link--large">
<router-link to="/me/activity" @click="toggleShowPopover()">Aktivität</router-link>
</li>
<li class="popover-links__link popover-links__link--large" @click="toggleShowPopover()">
<router-link to="/me/profile">Profil</router-link>
</li>
<li class="popover-links__link popover-links__link--large" @click="toggleShowPopover()">
<router-link to="/me/myclasses">Klassenliste</router-link>
</li>
<li class="popover-links__link popover-links__link--large" data-cy="logout" @click="logout()">
<a>Logout</a>
</li>
</widget-popover>
</div>
</template>
<script>
@ -34,15 +35,19 @@
firstName: {
type: String
},
lastName: {
lastName: {
type: String
},
avatarUrl: {
avatarUrl: {
type: String
},
mobile: {
mobile: {
type: Boolean,
default: false
},
showMenu: {
type: Boolean,
default: true
}
},
@ -54,13 +59,17 @@
methods: {
toggleShowPopover() {
this.showPopover = !this.showPopover;
if (this.showMenu) {
this.showPopover = !this.showPopover;
}
},
logout() {
this.$apollo.mutate({
mutation: LOGOUT_MUTATION,
}).then(({data}) => {
if (data.logout.success) { location.replace('/') }
if (data.logout.success) {
location.replace('/')
}
});
}
},

View File

@ -7,11 +7,11 @@
<router-link tag="div" class="book-subnavigation__item" to="/instruments/sprache-kommunikation">Sprache und Kommunikation</router-link>
<router-link tag="div" class="book-subnavigation__item" to="/instruments/gesellschaft">Gesellschaft</router-link>
</sub-navigation-item>
<sub-navigation-item title="News">
<template slot="title">
<h2 class="sub-navigation__title" slot="title">ABU News</h2>
</template>
</sub-navigation-item>
<!--<sub-navigation-item title="News">-->
<!--<template slot="title">-->
<!--<h2 class="sub-navigation__title" slot="title">ABU News</h2>-->
<!--</template>-->
<!--</sub-navigation-item>-->
</aside>
</template>

View File

@ -1,7 +1,7 @@
<template>
<div class="content-list-block__container">
<div class="content-list-wrapper">
<ol class="content-list">
<ol class="content-list" :style="`counter-reset: list ${startingIndex}`">
<li class="content-list__item contentlist-item" :key="contentBlock.id" v-for="contentBlock in contentBlocks">
<content-block :contentBlock="contentBlock"></content-block>
</li>
@ -15,7 +15,7 @@
// import ContentBlock from '@/components/ContentBlock';
export default {
props: ['contents', 'parent'],
props: ['contents', 'parent', 'startingIndex'],
name: 'content-block-list',
components: {
@ -43,7 +43,6 @@
.content-list-wrapper {
.content-list {
/* https://stackoverflow.com/questions/1632005/ordered-list-html-lower-alpha-with-right-parentheses */
counter-reset: list;
&__item {
list-style: none;

View File

@ -4,7 +4,7 @@
v-if="editModule"
:block="objective"></visibility-action>
<div class="block-actions" v-if="editModule && canEdit">
<user-widget class="block-actions__user-widget objective__user-widget" v-bind="me"></user-widget>
<user-widget class="block-actions__user-widget objective__user-widget" :show-menu="false" v-bind="me"></user-widget>
<more-options-widget>
<div class="popover-links__link"><a @click="deleteObjective(objective)">Löschen</a></div>
</more-options-widget>

View File

@ -35,16 +35,16 @@
<portfolio-illustration></portfolio-illustration>
</section-block>
</div>
<!-- <div class="start-page__news news">-->
<!-- <h2 class="news__title">News</h2>-->
<!-- <news-teaser date="19. Dezember 2018" title="Bilder eines Jahres"-->
<!-- url="https://www.brennpunkt-welt.ch/jahresrückblick-2018/"></news-teaser>-->
<!-- <news-teaser date="20. November 2018" title="100 Jahre Erster Weltkrieg"-->
<!-- url="http://abunews-1f178193a10edaabff3ab828e30af44.webflow.io/"></news-teaser>-->
<!-- <news-teaser date="31. Oktober 2018" title="Sommerzeit - Festivalzeit"-->
<!-- url="https://abunews.webflow.io/"></news-teaser>-->
<!-- <div class="news__more">Mehr...</div>-->
<!-- </div>-->
<div class="start-page__news news">
<h2 class="news__title">News</h2>
<news-teaser date="9. September 2019" title="Klima was sonst?"
url="https://abunews-1f178193a10edaabf-4caff67b27d10.webflow.io/"></news-teaser>
<!--<news-teaser date="20. November 2018" title="100 Jahre Erster Weltkrieg"-->
<!--url="http://abunews-1f178193a10edaabff3ab828e30af44.webflow.io/"></news-teaser>-->
<!--<news-teaser date="31. Oktober 2018" title="Sommerzeit - Festivalzeit"-->
<!--url="https://abunews.webflow.io/"></news-teaser>-->
<div class="news__more">Mehr...</div>
</div>
</div>
</template>
<script>

View File

@ -18,9 +18,9 @@
line-height: 1.5;
@include light-border(top);
&:last-of-type {
@include light-border(bottom);
}
}
&:last-child {
@include light-border(bottom);
}
}