diff --git a/src/components/selectable_list/selectable_list.js b/src/components/selectable_list/selectable_list.js
index 93efa840..809133f5 100644
--- a/src/components/selectable_list/selectable_list.js
+++ b/src/components/selectable_list/selectable_list.js
@@ -6,14 +6,32 @@ const SelectableList = {
List,
Checkbox
},
- props: List.props,
+ props: {
+ items: {
+ type: Array,
+ default: () => []
+ },
+ getKey: {
+ type: Function,
+ default: item => item.id
+ }
+ },
data () {
return {
selected: []
}
},
+ computed: {
+ allSelected () {
+ return !this.items.find(item => !this.isSelected(item))
+ }
+ },
methods: {
- toggle (checked, key) {
+ isSelected (item) {
+ return this.selected.indexOf(this.getKey(item)) !== -1
+ },
+ toggle (checked, item) {
+ const key = this.getKey(item)
const oldChecked = this.isSelected(key)
if (checked !== oldChecked) {
if (checked) {
@@ -23,8 +41,12 @@ const SelectableList = {
}
}
},
- isSelected (key) {
- return this.selected.indexOf(key) !== -1
+ toggleAll (value) {
+ if (value) {
+ this.selected = this.items.map(this.getKey)
+ } else {
+ this.selected = []
+ }
}
}
}
diff --git a/src/components/selectable_list/selectable_list.vue b/src/components/selectable_list/selectable_list.vue
index d8938062..e8c5d09b 100644
--- a/src/components/selectable_list/selectable_list.vue
+++ b/src/components/selectable_list/selectable_list.vue
@@ -1,14 +1,21 @@
-
-
-
-
- toggle(checked, p.keyVal)" />
-
-
+
+
+
+
+
+
+ toggle(checked, p.item)" />
+
+
+
+
+
+
@@ -19,6 +26,7 @@
.selectable-list {
&-item-inner {
display: flex;
+ align-items: center;
}
&-item-selected-inner {
@@ -26,8 +34,14 @@
background-color: var(--lightBg, $fallback--lightBg);
}
+ &-header {
+ display: flex;
+ align-items: center;
+ padding: 0.6em 0;
+ }
+
&-checkbox-wrapper {
- padding: 10px;
+ padding: 0 10px;
flex: none;
}
}
From 7a8ffcd79bdb5bfd4bd03ba1d9bda8cd00e08f1d Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 4 Apr 2019 04:39:16 -0400
Subject: [PATCH 21/46] support header slot
---
src/components/selectable_list/selectable_list.vue | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/components/selectable_list/selectable_list.vue b/src/components/selectable_list/selectable_list.vue
index e8c5d09b..6c8c0bf6 100644
--- a/src/components/selectable_list/selectable_list.vue
+++ b/src/components/selectable_list/selectable_list.vue
@@ -4,6 +4,9 @@
+
@@ -38,6 +41,10 @@
display: flex;
align-items: center;
padding: 0.6em 0;
+
+ &-actions {
+ flex: 1;
+ }
}
&-checkbox-wrapper {
From d4e43e0e261c1edafe505cd448ab876d541a0474 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 4 Apr 2019 04:40:25 -0400
Subject: [PATCH 22/46] add border-bottom to the header
---
src/components/selectable_list/selectable_list.vue | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/components/selectable_list/selectable_list.vue b/src/components/selectable_list/selectable_list.vue
index 6c8c0bf6..f3dd5e88 100644
--- a/src/components/selectable_list/selectable_list.vue
+++ b/src/components/selectable_list/selectable_list.vue
@@ -41,6 +41,9 @@
display: flex;
align-items: center;
padding: 0.6em 0;
+ border-bottom: 1px solid;
+ border-bottom-color: $fallback--border;
+ border-bottom-color: var(--border, $fallback--border);
&-actions {
flex: 1;
From fe7766bc618f9a994e2c0a9337deb7cce8b162cf Mon Sep 17 00:00:00 2001
From: taehoon
Date: Thu, 4 Apr 2019 12:12:27 -0400
Subject: [PATCH 23/46] replace scope attributes by slot-scope
---
src/components/follow_requests/follow_requests.vue | 2 +-
src/components/selectable_list/selectable_list.vue | 2 +-
src/components/user_profile/user_profile.vue | 4 ++--
src/components/user_search/user_search.vue | 2 +-
src/components/user_settings/user_settings.vue | 4 ++--
src/components/who_to_follow/who_to_follow.vue | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/components/follow_requests/follow_requests.vue b/src/components/follow_requests/follow_requests.vue
index 0970713b..8b1e8f94 100644
--- a/src/components/follow_requests/follow_requests.vue
+++ b/src/components/follow_requests/follow_requests.vue
@@ -5,7 +5,7 @@