Archive filtering and bulk action button

This commit is contained in:
Jeffrey Biles
2020-03-18 01:25:53 -07:00
parent 2c13f9e8e8
commit bf1aeb4bd6
4 changed files with 8 additions and 1 deletions

View File

@@ -21,6 +21,9 @@ new Server({
}, },
sentDate(){ sentDate(){
return faker.date.recent(20) return faker.date.recent(20)
},
archived(i){
return i % 2 == 0;
} }
}) })
}, },

View File

@@ -9,6 +9,9 @@
<button @click="emailSelection.markUnread()" :disabled="Array.from(emailSelection.emails).every(e => !e.read)"> <button @click="emailSelection.markUnread()" :disabled="Array.from(emailSelection.emails).every(e => !e.read)">
Mark Unread Mark Unread
</button> </button>
<button @click="emailSelection.archive()" :disabled="numberSelected == 0">
Archive
</button>
</div> </div>
</template> </template>

View File

@@ -3,7 +3,7 @@
<BulkActionBar :emails="emails" /> <BulkActionBar :emails="emails" />
<MailTable :emails="emails" /> <MailTable :emails="emails.filter(e => !e.archived)" />
</template> </template>
<script> <script>

View File

@@ -27,6 +27,7 @@ export const useEmailSelection = function(){
}, },
markRead(){ this.forSelected(e => e.read = true )}, markRead(){ this.forSelected(e => e.read = true )},
markUnread(){ this.forSelected(e => e.read = false )}, markUnread(){ this.forSelected(e => e.read = false )},
archive(){ this.forSelected(e => e.archived = true); this.clear();},
}) })
return { return {