Skip to content

Commit 2c5677f

Browse files
sunkupraimund-schluessler
authored andcommitted
[WIP] Introduce RepeatFreqInterval
1 parent d51baa6 commit 2c5677f

File tree

4 files changed

+70
-7
lines changed

4 files changed

+70
-7
lines changed

src/components/AppSidebar/RepeatItem.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
2727
<component :is="icon" :size="20" />
2828
</div>
2929
<RepeatSummary class="property-repeat__summary__content"
30-
:recurrence-rule="recurrence" />
30+
:recurrence-rule="recurrenceRule" />
3131
<Actions>
3232
<ActionButton @click="toggleOptions">
3333
<template #icon>
@@ -38,7 +38,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
3838
</Actions>
3939

4040
<div v-if="showOptions" class="property-repeat__options">
41-
options
41+
options {{ recurrenceRule.interval }}
42+
<RepeatFreqInterval :frequency="recurrenceRule.frequency"
43+
:interval="recurrenceRule.interval" />
4244
</div>
4345
</div>
4446
</template>
@@ -47,20 +49,22 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
4749

4850
import { translate as t } from '@nextcloud/l10n'
4951
import RepeatSummary from './RepeatItem/RepeatSummary.vue'
52+
import RepeatFreqInterval from './RepeatItem/RepeatFreqInterval.vue'
5053
import Pencil from 'vue-material-design-icons/Pencil.vue'
5154
import Check from 'vue-material-design-icons/Check.vue'
5255
import { NcActions as Actions, NcActionButton as ActionButton } from '@nextcloud/vue'
5356

5457
export default {
5558
components: {
5659
RepeatSummary,
60+
RepeatFreqInterval,
5761
Actions,
5862
ActionButton,
5963
Pencil,
6064
Check,
6165
},
6266
props: {
63-
recurrence: {
67+
recurrenceRule: {
6468
type: Object,
6569
required: true,
6670
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!--
2+
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com>
3+
-
4+
- @author Georg Ehrke <[email protected]>
5+
-
6+
- @license AGPL-3.0-or-later
7+
-
8+
- This program is free software: you can redistribute it and/or modify
9+
- it under the terms of the GNU Affero General Public License as
10+
- published by the Free Software Foundation, either version 3 of the
11+
- License, or (at your option) any later version.
12+
-
13+
- This program is distributed in the hope that it will be useful,
14+
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
- GNU Affero General Public License for more details.
17+
-
18+
- You should have received a copy of the GNU Affero General Public License
19+
- along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
-
21+
-->
22+
23+
<template>
24+
<div class="repeat-option-set repeat-option-set--interval-freq">
25+
<span class="repeat-option-set__label">
26+
{{ repeatEveryLabel }}
27+
</span>
28+
<input class="intervalInput"
29+
type="number"
30+
min="1"
31+
max="366"
32+
:value="interval">
33+
</div>
34+
</template>
35+
36+
<script>
37+
38+
export default {
39+
name: 'RepeatFreqInterval',
40+
props: {
41+
frequency: {
42+
type: String,
43+
required: true,
44+
},
45+
interval: {
46+
type: Number,
47+
required: true,
48+
},
49+
},
50+
computed: {
51+
repeatEveryLabel() {
52+
if (this.frequency === 'NONE') {
53+
return t('tasks', 'Repeat')
54+
}
55+
return t('tasks', 'Repeat every')
56+
},
57+
},
58+
}
59+
</script>

src/models/task.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export default class Task {
338338
* @readonly
339339
* @memberof Task
340340
*/
341-
get recurrence() {
341+
get recurrenceRule() {
342342
if (this._recurrence === undefined || this._recurrence === null) {
343343
return getDefaultRecurrenceRuleObject()
344344
}
@@ -754,7 +754,7 @@ export default class Task {
754754
*/
755755
completeRecurring() {
756756
// Get recurrence iterator, starting at start date
757-
const iter = this.recurrence.iterator(this.start)
757+
const iter = this.recurrenceRule.iterator(this.start)
758758
// Skip the start date itself
759759
iter.next()
760760
// If there is a next recurrence, update the start date to next recurrence date

src/views/AppSidebar.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
224224
@add-tag="updateTag"
225225
@set-tags="updateTags" />
226226
<RepeatItem v-show="!readOnly || task.recurring"
227-
:recurrence="task.recurrence"
228-
:disabled="readOnly"
227+
:recurrence-rule="task.recurrenceRule"
228+
:disabled="false"
229229
:placeholder="t('tasks', 'No recurrence')"
230230
icon="IconRepeat" />
231231
</div>

0 commit comments

Comments
 (0)