Skip to content

Commit

Permalink
Merge branch 'vue' into add-new-props
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Sep 4, 2018
2 parents d2f266e + 96acf13 commit cef4c97
Show file tree
Hide file tree
Showing 21 changed files with 6,046 additions and 40 deletions.
4 changes: 2 additions & 2 deletions css/Properties/Properties.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
margin-bottom: $grid-height-unit;
}
// no delete icon on addressbook selector
&--addressbooks .icon-delete {
display: none;
&--addressbooks &__delete {
display: none !important;
}

&__delete {
Expand Down
1 change: 1 addition & 0 deletions css/contacts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $grid-input-height-with-margin: #{$grid-height-unit - $grid-input-margin * 2};
@import 'settings/settings-addressbook';
@import 'settings/settings-addressbook-shares';
@import 'settings/settings-addressbook-sharee';
@import 'details';
@import 'ContactDetails';
@import './Properties/Properties';
@import './Properties/PropertyTitle';
Expand Down
11 changes: 5 additions & 6 deletions css/settings/settings-addressbook-sharee.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

.addressbook__sharee {
.addressbook-sharee {
padding: 0 5px;
display: inline-flex;
align-items: center;
Expand All @@ -33,7 +33,7 @@
text-overflow: ellipsis;
display: inline-block;
vertical-align: top;
opacity: 0.5;
opacity: 0.7;
}
&__utils {
padding: 0 !important;
Expand All @@ -46,6 +46,9 @@
.checkbox + label {
padding: 0 !important;
}
label {
opacity: 0.7;
}
}

.icon {
Expand All @@ -56,10 +59,6 @@
display: inline-block;
}

.icon-group {
background-image: url(/apps/contacts/img/group.svg);
}

.icon-delete {
display: inline-block;
width: 24px;
Expand Down
11 changes: 10 additions & 1 deletion css/settings/settings-addressbook-shares.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@
display: flex;
flex-direction: column;
}

&__shareematch--bold {
font-weight: bold;
}

.icon-loading::after {
top: 70%;
left: 95%;
height: 14px;
width: 14px;
}

.multiselect.multiselect-vue {
width: inherit;

.multiselect__tags:focus-within,
.multiselect__tags:hover {
border-color: var(--color-primary-element);
Expand All @@ -44,6 +52,7 @@
display: none;
}
}

.multiselect.showContent {
.multiselect__content-wrapper {
display: inherit;
Expand Down
5,899 changes: 5,899 additions & 0 deletions js/contacts.js

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions src/components/ContactDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@
<section class="contact-details">

<!-- properties iteration -->
<contact-property v-for="(property, index) in sortedProperties" :key="index" :index="index"
<!-- using contact.key in the key and index as key to avoid conflicts between similar data and exact key -->
<contact-property v-for="(property, index) in sortedProperties" :key="index+contact.key" :index="index"
:sorted-properties="sortedProperties" :property="property" :contact="contact"
@updatedcontact="updateContact" />

<!-- addressbook change select -->
<property-select :prop-model="addressbookModel" :value.sync="addressbook"
:options="addressbooksOptions" class="property--addressbooks" />
<!-- addressbook change select - no last property because class is not applied here-->
<property-select :prop-model="addressbookModel" :value.sync="addressbook" :is-first-property="true"
:is-last-property="false" :options="addressbooksOptions" class="property--addressbooks" />

<!-- new property select -->
<add-new-prop :contact="contact" />
</section>
</template>
Expand Down Expand Up @@ -249,6 +251,7 @@ export default {
updateContact() {
this.$store.dispatch('updateContact', this.contact)
},

/**
* Debounce the contact update for the header props
* photo, fn, org, title
Expand All @@ -265,6 +268,13 @@ export default {
this.openedMenu = !this.openedMenu
},

/**
* Dispatch contact deletion request
*/
deleteContact() {
this.$store.dispatch('deleteContact', this.contact)
},

/**
* Move contact to the specified addressbook
*
Expand Down
5 changes: 4 additions & 1 deletion src/components/ContactDetails/ContactDetailsProperty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,11 @@ export default {
},

methods: {
/**
* Delete this property
*/
deleteProp() {
alert('deleted')
this.contact.vCard.removeProperty(this.property)
}
}

Expand Down
17 changes: 17 additions & 0 deletions src/components/ContentList/ContentListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export default {
selectedContact() {
return this.$route.params.selectedContact
},
/**
* avatar color based on server toRgb method and the displayName
* @returns {String} the color in css format
*/
colorAvatar() {
try {
let color = this.contact.uid.toRgb()
Expand All @@ -46,13 +51,25 @@ export default {
}
},
methods: {
/**
* Checkbox management method
*/
toggleSelect() {
// toggle checkbox here because we stop the propagation to not trigger selectContact
// therefore the selectContact prevent the checkbox label+input propagation
this.$refs.selected.checked = !this.$refs.selected.checked
},
/**
* Dispatch contact deletion request
*/
deleteContact() {
this.$store.dispatch('deleteContact', this.contact)
},
/**
* Select this contact within the list
*/
selectContact() {
// change url with router
this.$router.push({ name: 'contact', params: { selectedGroup: this.selectedGroup, selectedContact: this.contact.key } })
Expand Down
1 change: 1 addition & 0 deletions src/components/Properties/PropertyDateTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
* TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
Expand Down
3 changes: 2 additions & 1 deletion src/components/Properties/PropertyGroups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div v-if="propModel" class="grid-span-1 property">
<div v-if="propModel" class="grid-span-2 property">

<div class="property__row">
<div class="property__label">{{ propModel.readableName }}</div>
Expand Down Expand Up @@ -92,6 +92,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
* TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
Expand Down
1 change: 1 addition & 0 deletions src/components/Properties/PropertyMultipleText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
* TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
Expand Down
1 change: 1 addition & 0 deletions src/components/Properties/PropertySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
* TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
Expand Down
1 change: 1 addition & 0 deletions src/components/Properties/PropertyText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default {
/**
* Since we're updating a local data based on the value prop,
* we need to make sure to update the local data on pop change
* TODO: check if this create performance drop
*/
value: function() {
this.localValue = this.value
Expand Down
1 change: 0 additions & 1 deletion src/components/Properties/PropertyTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@ export default {
required: true
}
}

}
</script>
40 changes: 30 additions & 10 deletions src/components/Settings/SettingsAddressbook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->

<template>
<div>
<li :class="{'disabled': !addressbook.enabled}" class="addressbook">
Expand All @@ -29,6 +28,8 @@
<!-- sharing button -->
<a href="#" class="addressbook__share icon-shared"
@click="toggleShare" />
<!-- rename addressbook name -->
<rename-addressbook-field v-if="editingName" />
<!-- popovermenu -->
<a v-click-outside="closeMenu" href="#" class="addressbook__menu"
@click="toggleMenu">
Expand All @@ -46,6 +47,7 @@
<script>
import popoverMenu from '../core/popoverMenu'
import shareAddressBook from './SettingsAddressbookShare'
import renameAddressBookField from './SettingsRenameAddressbookField'

import clickOutside from 'vue-click-outside'

Expand All @@ -54,6 +56,7 @@ export default {
components: {
popoverMenu,
shareAddressBook,
renameAddressBookField,
clickOutside
},
directives: {
Expand All @@ -71,43 +74,54 @@ export default {
return {
menuOpen: false,
shareOpen: false,
enabled: true
editingName: false,
newName: '' // new name for addressbook
}
},
computed: {
enabled() {
return this.addressbook.enabled
},
// building the popover menu
menu() {
return [{
href: '#',
icon: 'icon-public',
text: 'Copy link'
text: 'Copy link',
action: () => {
alert('share link')
}
},
{
href: '#',
icon: 'icon-download',
text: 'Download'
text: 'Download',
action: () => {
alert('download')
}
},
{
icon: 'icon-rename',
text: 'Rename',
action: function renameAddressBook() {
alert('rename the address book')
action: () => {
/* this.editingName = true */
}
},
{
icon: 'checkbox',
text: 'Enabled',
input: 'checkbox',
model: this.enabled,
action: function toggleEnabled() {
alert('This addressbook is: enabled')
action: () => {
alert('change') // eslint-disable-line
this.$store.dispatch('toggleAddressbookEnabled', this.addressbook)
}
},
{
icon: 'icon-delete',
text: 'Delete',
action: function deleteAddressBook() {
alert('Delete AddressBook')
action: () => {
this.$store.dispatch('deleteAddressbook', this.addressbook)
}
}]
}
Expand All @@ -121,6 +135,12 @@ export default {
},
toggleMenu() {
this.menuOpen = !this.menuOpen
},
renameAddressBook() {
this.editingName = true
let addressbook = this.addressbook
let newName = this.newName
this.$store.dispatch('renameAddressbook', { addressbook, newName })
}
}
}
Expand Down
Loading

0 comments on commit cef4c97

Please sign in to comment.