From 7ecdada4ca91dac7a0db32baeb7013be53160a35 Mon Sep 17 00:00:00 2001 From: Nazar Kanaev Date: Sun, 5 Jul 2020 13:44:20 +0100 Subject: [PATCH] item status toggle buttons --- template/index.html | 13 ++++++++++++- template/static/images/star-full.svg | 1 + template/static/javascripts/app.js | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 template/static/images/star-full.svg diff --git a/template/index.html b/template/index.html index 8304933..f45f434 100644 --- a/template/index.html +++ b/template/index.html @@ -89,7 +89,18 @@
-
+
+
+ + +
+
diff --git a/template/static/images/star-full.svg b/template/static/images/star-full.svg new file mode 100644 index 0000000..eeed68d --- /dev/null +++ b/template/static/images/star-full.svg @@ -0,0 +1 @@ + diff --git a/template/static/javascripts/app.js b/template/static/javascripts/app.js index bf569ed..cd566f6 100644 --- a/template/static/javascripts/app.js +++ b/template/static/javascripts/app.js @@ -55,6 +55,9 @@ var vm = new Vue({ }, 'itemSelected': function(newVal, oldVal) { this.itemSelectedDetails = this.itemsById[newVal] + if (this.itemSelectedDetails.status == 'unread') { + this.itemSelectedDetails.status = 'read' + } }, }, methods: { @@ -141,5 +144,19 @@ var vm = new Vue({ vm.loading.newfeed = false }) }, + toggleItemStarred: function(item) { + if (item.status == 'starred') { + item.status = 'read' + } else if (item.status != 'starred') { + item.status = 'starred' + } + }, + toggleItemRead: function(item) { + if (item.status == 'unread') { + item.status = 'read' + } else if (item.status == 'read') { + item.status = 'unread' + } + }, } })