Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Sep 19, 2024
1 parent e666b07 commit 0c7acb9
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 96 deletions.
4 changes: 2 additions & 2 deletions src/components/ListCategoryNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@trailing-button-click="newCategoryName = ''" />

<NcButton type="tertiary"
:aria-label="t('grocerylist', 'Add category {category}', { category: newCategoryName })"
@click="addCategory">
:aria-label="t('grocerylist', 'Add category {category}', { category: newCategoryName })"
@click="addCategory">
<template #icon>
<IconPlus :size="20" />
</template>
Expand Down
30 changes: 15 additions & 15 deletions src/components/NavigationGroceryListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
{{ t('grocerylist', 'Delete list') }}
</NcActionButton>
</template>
<template #counter v-if="groceryList.uncheckedCount > 0">
<NcCounterBubble>
{{ groceryList.uncheckedCount }}
</NcCounterBubble>
</template>
<template v-if="groceryList.uncheckedCount > 0" #counter>
<NcCounterBubble>
{{ groceryList.uncheckedCount }}
</NcCounterBubble>
</template>
</NcAppNavigationItem>
</template>
<script>
import { showError, showInfo, showSuccess } from '@nextcloud/dialogs'
import {
NcActionButton,
NcAppNavigationItem,
NcCounterBubble,
NcCounterBubble,
} from '@nextcloud/vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
Expand All @@ -38,7 +38,7 @@ export default {
components: {
NcActionButton,
NcAppNavigationItem,
NcCounterBubble
NcCounterBubble,
},
props: {
groceryList: {
Expand All @@ -63,14 +63,14 @@ export default {
},
title() {
return this.groceryList.title
},
titleWithCount() {
if (this.groceryList.uncheckedCount > 0) {
return this.groceryList.title + ' (' + this.groceryList.uncheckedCount + ')'
} else {
return this.groceryList.title
}
},
},
titleWithCount() {
if (this.groceryList.uncheckedCount > 0) {
return this.groceryList.title + ' (' + this.groceryList.uncheckedCount + ')'
} else {
return this.groceryList.title
}
},
},
methods: {
async onRename(newTitle) {
Expand Down
144 changes: 71 additions & 73 deletions src/views/GroceryList.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
<template>
<div class="page-wrapper">
<div>
<NcButton aria-label="Show add/edit modal"
@click="showAddModal">
<template #icon>
<Plus :size="20"/>
</template>
<template>Add</template>
</NcButton>
</div>
<div>
<NcButton aria-label="Show add/edit modal"
@click="showAddModal">
<template #icon>
<Plus :size="20" />
</template>
<template>Add</template>
</NcButton>
</div>
<h1>{{ groceryList?.title ?? t('grocerylist', 'Grocery list') }}</h1>
<div>
<NcCheckboxRadioSwitch :checked="!!groceryList?.showOnlyUnchecked" type="switch" @update:checked="toggleVisibility">
{{ t('grocerylist', 'Show only unchecked') }}
</NcCheckboxRadioSwitch>
<NcModal
v-if="modal"
ref="modalRef"
:name="t('grocerylist', 'Add item')"
<NcModal v-if="modal"
ref="modalRef"
:name="t('grocerylist', 'Add item')"
@close="closeModal">
<form class="modal__content"
@submit.prevent="onSaveItem()">
<p class="quantityRow">
<NcTextField :value.sync="newItemQuantity"
label="Quantity…"
@keyup.up="increaseQuantity()"
@keyup.down="decreaseQuantity()"
/>
<NcButton aria-label="Increase quantity"
style="display:inline-block;"
type="tertiary"
@click="increaseQuantity()">
<template #icon>
<Plus :size="20"/>
</template>
</NcButton>
<NcButton aria-label="Decrease quantity"
style="display:inline-block;"
type="tertiary"
@click="decreaseQuantity()">
<template #icon>
<Minus :size="20"/>
</template>
</NcButton>
</p>
@keyup.up="increaseQuantity()"
@keyup.down="decreaseQuantity()" />
<NcButton aria-label="Increase quantity"
style="display:inline-block;"
type="tertiary"
@click="increaseQuantity()">
<template #icon>
<Plus :size="20" />
</template>
</NcButton>
<NcButton aria-label="Decrease quantity"
style="display:inline-block;"
type="tertiary"
@click="decreaseQuantity()">
<template #icon>
<Minus :size="20" />
</template>
</NcButton>
</p>
<p>
<NcTextField :value.sync="newItemName"
label="Item…"
Expand Down Expand Up @@ -141,17 +139,17 @@ import { ref } from 'vue'
export default {
name: 'GroceryList',
components: {
NcCheckboxRadioSwitch,
NcSelect,
NcButton,
AlarmSnooze,
NcTextField,
Plus,
Minus,
Delete,
NcModal,
},
components: {
NcCheckboxRadioSwitch,
NcSelect,
NcButton,
AlarmSnooze,
NcTextField,
Plus,
Minus,
Delete,
NcModal,
},
props: {
listId: {
Expand Down Expand Up @@ -381,37 +379,37 @@ export default {
this.newItemCategory = this.allCategories.find(i => i.id === item.category)
this.modal = true
},
increaseQuantity() {
if (this.newItemQuantity === '') {
this.newItemQuantity = 0
}
increaseQuantity() {
if (this.newItemQuantity === '') {
this.newItemQuantity = 0
}
if (this.newItemQuantity >= 1000) {
this.newItemQuantity = this.newItemQuantity + 1000
} else if (this.newItemQuantity >= 100) {
this.newItemQuantity = this.newItemQuantity + 100
} else if (this.newItemQuantity >= 10) {
this.newItemQuantity = this.newItemQuantity + 10
} else {
this.newItemQuantity = this.newItemQuantity + 1
}
},
decreaseQuantity() {
if (this.newItemQuantity > 1000) {
this.newItemQuantity = this.newItemQuantity - 1000
} else if (this.newItemQuantity > 100) {
this.newItemQuantity = this.newItemQuantity - 100
} else if (this.newItemQuantity > 10) {
this.newItemQuantity = this.newItemQuantity - 10
} else if (this.newItemQuantity > 1) {
this.newItemQuantity = this.newItemQuantity - 1
} else {
this.newItemQuantity = ''
}
},
if (this.newItemQuantity >= 1000) {
this.newItemQuantity = this.newItemQuantity + 1000
} else if (this.newItemQuantity >= 100) {
this.newItemQuantity = this.newItemQuantity + 100
} else if (this.newItemQuantity >= 10) {
this.newItemQuantity = this.newItemQuantity + 10
} else {
this.newItemQuantity = this.newItemQuantity + 1
}
},
decreaseQuantity() {
if (this.newItemQuantity > 1000) {
this.newItemQuantity = this.newItemQuantity - 1000
} else if (this.newItemQuantity > 100) {
this.newItemQuantity = this.newItemQuantity - 100
} else if (this.newItemQuantity > 10) {
this.newItemQuantity = this.newItemQuantity - 10
} else if (this.newItemQuantity > 1) {
this.newItemQuantity = this.newItemQuantity - 1
} else {
this.newItemQuantity = ''
}
},
async onSaveItem() {
if (this.newItemName === "") {
showInfo("Cannot add empty item!")
if (this.newItemName === '') {
showInfo('Cannot add empty item!')
return
}
Expand Down
12 changes: 6 additions & 6 deletions src/views/ListSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

<ListCategoryNew :list-id="listId" />

<!-- <h2>{{ t('grocerylist', 'Shares') }}</h2>-->
<!-- <span v-for="sharee in sharees" :key="sharee.userId">-->
<!-- <ul>-->
<!-- <li>{{ sharee.userId }}</li>-->
<!-- </ul>-->
<!-- </span>-->
<!-- <h2>{{ t('grocerylist', 'Shares') }}</h2>-->
<!-- <span v-for="sharee in sharees" :key="sharee.userId">-->
<!-- <ul>-->
<!-- <li>{{ sharee.userId }}</li>-->
<!-- </ul>-->
<!-- </span>-->
</div>
</template>

Expand Down

0 comments on commit 0c7acb9

Please sign in to comment.