@@ -8,71 +8,99 @@ export default {
88 mixins: [LensMixin],
99 data () {
1010 return {
11- expanded: false ,
11+ categoriesIsExpanded: false ,
12+ sigelIsExpanded: false ,
1213 };
1314 },
1415 props: {
1516 sigel: Object ,
1617 availableCategories: [],
18+ availableSigels: [],
1719 },
1820 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 });
2125 },
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 ;
2434 },
2535 isActiveCategory (categoryId ) {
26- const obj = this .userChangeCategories . find ( c => c . heldBy === this . sigelUri ) ;
36+ const obj = this .userChangeCategories [ 0 ] ;
2737 return obj ? obj .triggers .includes (categoryId) : false ;
2838 },
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+ },
2944 label (obj ) {
3045 return this .getLabel (obj);
3146 },
47+ sigelLabel (sigel ) {
48+ return StringUtil .getSigelLabel (sigel);
49+ },
50+ sigelUri (sigel ) {
51+ return StringUtil .getLibraryUri (sigel .code );
52+ },
3253 },
3354 computed: {
3455 ... mapGetters ([
3556 ' userChangeCategories' ,
3657 ]),
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- },
4658 },
4759 mounted () {
48- this .$nextTick (() => {
49- });
5060 },
5161};
5262 </script >
5363
54- <template >
64+ <template >< div >
5565 <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 >
6182 </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" >
6491 <div class =" Categories-row" v-for =" category in availableCategories" :key =" category['@id']" >
6592 <div class =" Categories-key" >{{ label(category) }}</div >
6693 <div class =" Categories-value" >
6794 <input id =" categoryCheckbox"
6895 class =" customCheckbox-input"
6996 type =" checkbox"
70- @change =" updateChangeCategories(...arguments, sigel , category['@id'])" :checked =" isActiveCategory(category['@id'])" >
97+ @change =" e => updateCategory(e , category['@id'])" :checked =" isActiveCategory(category['@id'])" >
7198 <div class =" customCheckbox-icon" ></div >
7299 </div >
73100 </div >
74101 </div >
75102 </div >
103+ </div >
76104</template >
77105
78106<style scoped lang="less">
@@ -96,11 +124,11 @@ export default {
96124 border-width : 0px 0px 1px 0px ;
97125 }
98126 &-key {
99- padding : 0.5 em ;
127+ padding : 0.6 em ;
100128 width : 50% ;
101129 }
102130 &-value {
103- padding : 0.5 em ;
131+ padding : 0.6 em ;
104132 width : 50% ;
105133 }
106134 &-label {
0 commit comments