@@ -3,124 +3,126 @@ const Journal = {
33 template : `
44 <transition name="fade" appear>
55 <div ref="journal-view" class="journal-view">
6- <div class="toolbar" v-show="checkboxSelected === 0">
7- <div class="tool_leftitems journal-toolleft">
8- <searchfield
9- ref="searchfield"
10- tabindex="0"
11- @input-changed="searchChanged"
12- :placeholder="$t('SearchJournal')"
13- />
14- <icon
15- id="favoritebutton"
16- svgfile="./icons/emblem-favorite.svg"
17- isNative="true"
18- :color="filterFavorite ? buddycolor : undefined"
19- :size="constant.iconSizeList"
20- :title="$t('FilterFavorite')"
21- @click="toggleFilterValue('filterFavorite')"
22- />
23- <icon
24- id="assignmentbutton"
25- svgfile="./icons/assignment.svg"
26- isNative="true"
27- :color="filterAssignment ? buddycolor : undefined"
28- :size="constant.iconSizeList"
29- :title="$t('FilterAssignment')"
30- @click="toggleFilterValue('filterAssignment')"
31- />
32- <filter-box
33- ref="typepalette"
34- name="typepalette"
35- id="typepalette"
36- :options="typePalette"
37- @filter-selected="activityFilterSelected"
38- :title="$t('FilterByType')"
39- ></filter-box>
40- <filter-box
41- ref="datepalette"
42- id="datepalette"
43- name="datepalette"
44- :options="datePalette"
45- @filter-selected="dateFilterSelected"
46- :title="$t('FilterByTime')"
47- ></filter-box>
48- <filter-box
49- ref="sortpalette"
50- id="sortpalette"
51- name="sortpalette"
52- :options="sortPalette"
53- @filter-selected="sortSelected"
54- :title="$t('Sort')"
55- ></filter-box>
56- <hr />
57- <icon
58- id="fromdevicebutton"
59- class="toolbutton"
60- svgfile="./icons/copy-from-device.svg"
61- isNative="true"
62- :size="constant.iconSizeList"
63- :title="$t('CopyFromDevice')"
64- @click="fromDeviceSelected"
65- />
66- <hr />
67- <icon
68- class="toolbutton"
69- id="toolbar-help-btn"
70- svgfile="./icons/help.svg"
71- isNative="true"
72- :size="47"
73- :color="768"
74- :title="$t('Tutorial')"
75- isNative="true"
76- @click="startTutorial"
77- ></icon>
78- </div>
79- <div class="tool_rightitems">
80- <icon
81- class="toolbutton"
82- id="journal_home_button"
83- svgfile="./icons/view-radial.svg"
84- isNative="true"
85- :size="47"
86- :title="$t('FavoritesView')"
87- isNative="true"
88- @click="$emit('closeJournal')"
89- ></icon>
90- </div>
91- </div>
92- <div class="toolbar" v-show="checkboxSelected > 0" :class="{ 'toolbar-disabled': showWarning }">
93- <div class="tool_leftitems" style="gap: 12px">
94- <icon
95- id="unselallbutton"
96- svgfile="./icons/select-none.svg"
97- isNative="true"
98- :size="constant.iconSizeList"
99- :title="$t('UnselectAll')"
100- @click="unselectAll"
101- />
102- <icon
103- id="selallbutton"
104- svgfile="./icons/select-all.svg"
105- isNative="true"
106- :size="constant.iconSizeList"
107- :title="$t('SelectAll')"
108- @click="selectAll"
109- />
110- <hr />
111- <div v-for="operation in operations" v-show="operation.show()" :key="operation.id">
6+ <div class="toolbar" :class="{ 'toolbar-disabled': showWarning && checkboxSelected > 0 }">
7+ <template v-if="checkboxSelected === 0 && !isOperating">
8+ <div class="tool_leftitems journal-toolleft">
9+ <searchfield
10+ ref="searchfield"
11+ tabindex="0"
12+ @input-changed="searchChanged"
13+ :placeholder="$t('SearchJournal')"
14+ />
15+ <icon
16+ id="favoritebutton"
17+ svgfile="./icons/emblem-favorite.svg"
18+ isNative="true"
19+ :color="filterFavorite ? buddycolor : undefined"
20+ :size="constant.iconSizeList"
21+ :title="$t('FilterFavorite')"
22+ @click="toggleFilterValue('filterFavorite')"
23+ />
24+ <icon
25+ id="assignmentbutton"
26+ svgfile="./icons/assignment.svg"
27+ isNative="true"
28+ :color="filterAssignment ? buddycolor : undefined"
29+ :size="constant.iconSizeList"
30+ :title="$t('FilterAssignment')"
31+ @click="toggleFilterValue('filterAssignment')"
32+ />
33+ <filter-box
34+ ref="typepalette"
35+ name="typepalette"
36+ id="typepalette"
37+ :options="typePalette"
38+ @filter-selected="activityFilterSelected"
39+ :title="$t('FilterByType')"
40+ ></filter-box>
41+ <filter-box
42+ ref="datepalette"
43+ id="datepalette"
44+ name="datepalette"
45+ :options="datePalette"
46+ @filter-selected="dateFilterSelected"
47+ :title="$t('FilterByTime')"
48+ ></filter-box>
49+ <filter-box
50+ ref="sortpalette"
51+ id="sortpalette"
52+ name="sortpalette"
53+ :options="sortPalette"
54+ @filter-selected="sortSelected"
55+ :title="$t('Sort')"
56+ ></filter-box>
57+ <hr />
11258 <icon
113- :id="operation.id"
114- :svgfile="operation.svgfile"
59+ id="fromdevicebutton"
60+ class="toolbutton"
61+ svgfile="./icons/copy-from-device.svg"
11562 isNative="true"
11663 :size="constant.iconSizeList"
117- :title="$t(operation.titleKey )"
118- @click="handleOperation(operation) "
64+ :title="$t('CopyFromDevice' )"
65+ @click="fromDeviceSelected "
11966 />
67+ <hr />
68+ <icon
69+ class="toolbutton"
70+ id="toolbar-help-btn"
71+ svgfile="./icons/help.svg"
72+ isNative="true"
73+ :size="47"
74+ :color="768"
75+ :title="$t('Tutorial')"
76+ isNative="true"
77+ @click="startTutorial"
78+ ></icon>
12079 </div>
121- <hr />
122- <span>{{ $t("Selected_one", {count: checkboxSelected, total: processedJournal.length}) }}</span>
123- </div>
80+ <div class="tool_rightitems">
81+ <icon
82+ class="toolbutton"
83+ id="journal_home_button"
84+ svgfile="./icons/view-radial.svg"
85+ isNative="true"
86+ :size="47"
87+ :title="$t('FavoritesView')"
88+ isNative="true"
89+ @click="$emit('closeJournal')"
90+ ></icon>
91+ </div>
92+ </template>
93+ <template v-else>
94+ <div class="tool_leftitems" style="gap: 12px">
95+ <icon
96+ id="unselallbutton"
97+ svgfile="./icons/select-none.svg"
98+ isNative="true"
99+ :size="constant.iconSizeList"
100+ :title="$t('UnselectAll')"
101+ @click="unselectAll"
102+ />
103+ <icon
104+ id="selallbutton"
105+ svgfile="./icons/select-all.svg"
106+ isNative="true"
107+ :size="constant.iconSizeList"
108+ :title="$t('SelectAll')"
109+ @click="selectAll"
110+ />
111+ <hr />
112+ <div v-for="operation in operations" v-show="operation.show()" :key="operation.id">
113+ <icon
114+ :id="operation.id"
115+ :svgfile="operation.svgfile"
116+ isNative="true"
117+ :size="constant.iconSizeList"
118+ :title="$t(operation.titleKey)"
119+ @click="handleOperation(operation)"
120+ />
121+ </div>
122+ <hr />
123+ <span>{{ $t("Selected_one", {count: checkboxSelected, total: processedJournal.length}) }}</span>
124+ </div>
125+ </template>
124126 </div>
125127 <transition name="fade" appear>
126128 <div class="journal-warningbox" v-show="showWarning">
@@ -321,6 +323,7 @@ const Journal = {
321323 checkboxSelected : 0 ,
322324 showWarning : false ,
323325 isLoading : false ,
326+ isOperating : false ,
324327 } ;
325328 } ,
326329
@@ -414,14 +417,16 @@ const Journal = {
414417 titleKey : "CopyToLocal" ,
415418 show : ( ) => this . journalType !== this . constant . journalLocal ,
416419 action : this . copyToLocal ,
420+ refresh : true ,
417421 } ,
418422 {
419423 id : "copycloudonebutton" ,
420424 svgfile : "./icons/copy-cloud-one.svg" ,
421425 titleKey : "CopyToPrivate" ,
422426 show : ( ) =>
423427 this . journalType !== this . constant . journalRemotePrivate ,
424- action : this . copyToRemote ,
428+ action : this . copyToPrivate ,
429+ refresh : true ,
425430 } ,
426431 {
427432 id : "copycloudallbutton" ,
@@ -430,13 +435,15 @@ const Journal = {
430435 show : ( ) =>
431436 this . journalType !== this . constant . journalRemoteShared ,
432437 action : this . copyToShared ,
438+ refresh : true ,
433439 } ,
434440 {
435441 id : "copydevicebutton" ,
436442 svgfile : "./icons/copy-to-device.svg" ,
437443 titleKey : "CopyToDevice" ,
438444 show : ( ) => true ,
439445 action : this . copyToDevice ,
446+ refresh : true ,
440447 } ,
441448 {
442449 id : "duplicatebutton" ,
@@ -472,6 +479,8 @@ const Journal = {
472479 methods : {
473480 setupJournalEntries ( ) {
474481 this . processedJournal = this . journal . map ( ( entry , index ) => {
482+ entry . isChecked = entry . isChecked || false ;
483+ entry . isEditingTitle = entry . isEditingTitle || false ;
475484 if ( entry . metadata . buddy_color ) {
476485 entry . color = sugarizer . modules . xocolor . findIndex (
477486 entry . metadata . buddy_color
@@ -695,25 +704,27 @@ const Journal = {
695704 } ,
696705 async confirmOperation ( ) {
697706 this . showWarning = false ;
707+ const operation = this . currentOperation ;
708+ const selectedEntries = this . processedJournal . filter ( e => e . isChecked ) ;
709+
698710 this . checkboxSelected = 0 ;
699- for ( entry of this . processedJournal ) {
700- if (
701- entry . isChecked &&
702- this . currentOperation &&
703- this . currentOperation . action
704- ) {
705- entry . isChecked = false ;
706- await this . currentOperation . action ( entry , true ) ;
711+ selectedEntries . forEach ( entry => entry . isChecked = false ) ;
712+ this . isOperating = true ;
713+
714+ for ( let entry of selectedEntries ) {
715+ if ( operation && operation . action ) {
716+ await operation . action ( entry , true ) ;
707717 }
708718 }
719+ this . isOperating = false ;
709720 sugarizer . modules . humane . log (
710721 this . $t (
711- this . currentOperation . id === "removebutton"
722+ operation . id === "removebutton"
712723 ? "Erasing"
713724 : "Copying"
714725 )
715726 ) ;
716- if ( this . currentOperation . refresh )
727+ if ( operation . refresh )
717728 await this . filterJournalEntries ( ) ;
718729 } ,
719730
0 commit comments