88 span( v-else style ="opacity: 0.6" )
99 icon( name ="circle" scale ="0.4" style ="margin-left: 1em; margin-right: 1.22em;" )
1010 | {{ _class.name.slice(depth).join(" ➤ ")}}
11+ icon.ml-1 ( v-if ="_class.data && _class.data.color" name ="circle" : style= "'color: ' + _class.data.color" )
1112 span.ml-1 ( v-if ="_class.children.length > 0" style ="opacity: 0.5" ) ({{totalChildren}})
1213
1314 div.col-4.col-md-8
4445
4546 hr
4647
48+ div.my-1
49+ b Color
50+
51+ b-form-checkbox( v-model ="editing.inherit_color" switch )
52+ | Inherit parent color
53+ b-input-group.my-1 ( prepend ="Color" v-if ="!editing.inherit_color" )
54+ b-form-input( v-model ="editing.color" , placeholder ="#FF0" )
55+ icon.mt-1.ml-2 ( name ="circle" scale ="1.8" : style= "{'color': editing.color}" )
56+ b-btn.px-1 ( @click ="randomColor()" style ="border: 0" variant ="outline-dark" title ="Randomize" )
57+ icon( name ="sync" scale ="1.5" )
58+
59+ //
60+ div.my-1
61+ b Productivity score
62+ b-input-group.my-1(prepend="Points")
63+ b-form-input(v-model="editing.productivity")
64+
65+ hr
66+
4767 div.my-1
4868 b-btn( variant ="danger" , @click ="removeClass(_class); $refs.edit.hide()" )
4969 icon( name ="trash" )
@@ -58,6 +78,7 @@ import 'vue-awesome/icons/caret-right';
5878import ' vue-awesome/icons/trash' ;
5979import ' vue-awesome/icons/plus' ;
6080import ' vue-awesome/icons/edit' ;
81+ import ' vue-awesome/icons/sync' ;
6182
6283import _ from ' lodash' ;
6384
@@ -78,6 +99,8 @@ export default {
7899 name: null ,
79100 rule: {},
80101 parent: [],
102+ inherit_color: true ,
103+ color: null ,
81104 },
82105 };
83106 },
@@ -140,6 +163,7 @@ export default {
140163 id: this .editing .id ,
141164 name: this .editing .parent .concat (this .editing .name ),
142165 rule: this .editing .rule .type !== null ? this .editing .rule : { type: null },
166+ data: { color: this .editing .inherit_color === true ? undefined : this .editing .color },
143167 };
144168 this .$store .commit (' categories/updateClass' , new_class);
145169
@@ -149,14 +173,21 @@ export default {
149173 });
150174 },
151175 resetModal () {
176+ const color = this ._class .data ? this ._class .data .color : undefined ;
177+ const inherit_color = ! color;
152178 this .editing = {
153179 id: this ._class .id ,
154180 name: this ._class .subname ,
155181 rule: _ .cloneDeep (this ._class .rule ),
182+ color,
183+ inherit_color,
156184 parent: this ._class .parent ? this ._class .parent : [],
157185 };
158186 // console.log(this.editing);
159187 },
188+ randomColor () {
189+ this .editing .color = ' #' + (0x1000000 + Math .random () * 0xffffff ).toString (16 ).substr (1 , 6 );
190+ },
160191 },
161192};
162193 </script >
0 commit comments