@@ -8,71 +8,99 @@ export default {
8
8
mixins: [LensMixin],
9
9
data () {
10
10
return {
11
- expanded: false ,
11
+ categoriesIsExpanded: false ,
12
+ sigelIsExpanded: false ,
12
13
};
13
14
},
14
15
props: {
15
16
sigel: Object ,
16
17
availableCategories: [],
18
+ availableSigels: [],
17
19
},
18
20
methods: {
19
- updateChangeCategories (e , sigel , categoryId ) {
20
- this .$store .dispatch (' updateSubscribedChangeCategories' , { libraryId: this .sigelUri , categoryId: categoryId, checked: e .target .checked });
21
+ updateSigel (e , sigel ) {
22
+ console .log (' available sigels' , JSON .stringify (this .availableSigels ));
23
+ console .log (' sigelCode' , sigel);
24
+ this .$store .dispatch (' updateSubscribedSigel' , { libraryId: this .sigelUri (sigel), checked: e .target .checked });
21
25
},
22
- toggleExpanded () {
23
- this .expanded = ! this .expanded ;
26
+ updateCategory (e , categoryId ) {
27
+ this .$store .dispatch (' updateSubscribedChangeCategory' , { categoryId: categoryId, checked: e .target .checked });
28
+ },
29
+ toggleSigelExpanded () {
30
+ this .sigelIsExpanded = ! this .sigelIsExpanded ;
31
+ },
32
+ toggleCategoriesExpanded () {
33
+ this .categoriesIsExpanded = ! this .categoriesIsExpanded ;
24
34
},
25
35
isActiveCategory (categoryId ) {
26
- const obj = this .userChangeCategories . find ( c => c . heldBy === this . sigelUri ) ;
36
+ const obj = this .userChangeCategories [ 0 ] ;
27
37
return obj ? obj .triggers .includes (categoryId) : false ;
28
38
},
39
+ isActiveSigel (sigel ) {
40
+ console .log (' this.userChangeCategories' , JSON .stringify (this .userChangeCategories ));
41
+ const obj = this .userChangeCategories .find (c => c .heldBy === this .sigelUri (sigel));
42
+ return !! obj;
43
+ },
29
44
label (obj ) {
30
45
return this .getLabel (obj);
31
46
},
47
+ sigelLabel (sigel ) {
48
+ return StringUtil .getSigelLabel (sigel);
49
+ },
50
+ sigelUri (sigel ) {
51
+ return StringUtil .getLibraryUri (sigel .code );
52
+ },
32
53
},
33
54
computed: {
34
55
... mapGetters ([
35
56
' userChangeCategories' ,
36
57
]),
37
- isExpanded () {
38
- return this .expanded ;
39
- },
40
- sigelLabel () {
41
- return StringUtil .getSigelLabel (this .sigel );
42
- },
43
- sigelUri () {
44
- return StringUtil .getLibraryUri (this .sigel .code );
45
- },
46
58
},
47
59
mounted () {
48
- this .$nextTick (() => {
49
- });
50
60
},
51
61
};
52
62
</script >
53
63
54
- <template >
64
+ <template >< div >
55
65
<div class =" Categories" >
56
- <div class =" Categories-label" @click =" toggleExpanded" >
57
- <i class =" Categories-arrow fa fa-chevron-right"
58
- :class =" {'icon is-expanded' : isExpanded}"
59
- ></i >
60
- {{ sigelLabel }}
66
+ <div class =" Categories-label" @click =" toggleSigelExpanded" >
67
+ <i class =" Categories-arrow fa fa-chevron-right"
68
+ :class =" {'icon is-expanded' : sigelIsExpanded}"
69
+ ></i >
70
+ {{ 'Collections' | translatePhrase }}
71
+ </div >
72
+ <div v-if =" sigelIsExpanded" >
73
+ <div class =" Categories-row" v-for =" sigel in availableSigels" :key =" sigel.code" >
74
+ <div class =" Categories-key" >{{ sigelLabel(sigel) }}</div >
75
+ <div class =" Categories-value" >
76
+ <input id =" categoryCheckbox"
77
+ class =" customCheckbox-input"
78
+ type =" checkbox"
79
+ @change =" e => updateSigel(e, sigel)" :checked =" isActiveSigel(sigel)" >
80
+ <div class =" customCheckbox-icon" ></div >
81
+ </div >
61
82
</div >
62
-
63
- <div v-if =" isExpanded" >
83
+ </div >
84
+ <div class =" Categories-label" @click =" toggleCategoriesExpanded" >
85
+ <i class =" Categories-arrow fa fa-chevron-right"
86
+ :class =" {'icon is-expanded' : categoriesIsExpanded}"
87
+ ></i >
88
+ {{ 'Change categories' | translatePhrase }}
89
+ </div >
90
+ <div v-if =" categoriesIsExpanded" >
64
91
<div class =" Categories-row" v-for =" category in availableCategories" :key =" category['@id']" >
65
92
<div class =" Categories-key" >{{ label(category) }}</div >
66
93
<div class =" Categories-value" >
67
94
<input id =" categoryCheckbox"
68
95
class =" customCheckbox-input"
69
96
type =" checkbox"
70
- @change =" updateChangeCategories(...arguments, sigel , category['@id'])" :checked =" isActiveCategory(category['@id'])" >
97
+ @change =" e => updateCategory(e , category['@id'])" :checked =" isActiveCategory(category['@id'])" >
71
98
<div class =" customCheckbox-icon" ></div >
72
99
</div >
73
100
</div >
74
101
</div >
75
102
</div >
103
+ </div >
76
104
</template >
77
105
78
106
<style scoped lang="less">
@@ -96,11 +124,11 @@ export default {
96
124
border-width : 0px 0px 1px 0px ;
97
125
}
98
126
&-key {
99
- padding : 0.5 em ;
127
+ padding : 0.6 em ;
100
128
width : 50% ;
101
129
}
102
130
&-value {
103
- padding : 0.5 em ;
131
+ padding : 0.6 em ;
104
132
width : 50% ;
105
133
}
106
134
&-label {
0 commit comments