Sidebar priorities display made conditional.

Stars only show for global priorities, and values only show for non-zero priorities.
This commit is contained in:
Oliver Hamlet
2014-12-27 11:12:23 +00:00
parent 18190d9019
commit eefed22374
+22 -1
View File
@@ -98,11 +98,14 @@
data: undefined,
observe: {
'data.userlist': 'onUserlistChange'
'data.userlist': 'onUserlistChange',
'data.modPriority': 'onPriorityChange',
'data.isGlobalPriority': 'onPriorityChange'
},
dataChanged: function(oldValue, newValue) {
this.onUserlistChange();
this.onPriorityChange();
},
onUserlistChange: function(oldValue, newValue) {
@@ -115,6 +118,24 @@
}
},
onPriorityChange: function(oldValue, newValue) {
if (this.data) {
if (this.data.modPriority != 0) {
this.shadowRoot.getElementById('secondary').classList.remove('hidden');
} else {
this.shadowRoot.getElementById('secondary').classList.add('hidden');
}
if (this.data.isGlobalPriority) {
this.shadowRoot.getElementById('secondary').firstElementChild.classList.remove('hidden');
} else {
this.shadowRoot.getElementById('secondary').firstElementChild.classList.add('hidden');
}
} else {
this.shadowRoot.getElementById('secondary').classList.add('hidden');
this.shadowRoot.getElementById('secondary').firstElementChild.classList.add('hidden');
}
},
getName: function() {
return this.textContent.trim();
},