Fixed inconsistent navigation via sidebar items.

Fixes #368. Also tidied up the priority observers.
This commit is contained in:
Oliver Hamlet
2014-12-27 22:52:21 +00:00
parent b566c27271
commit 6e0827869b
2 changed files with 17 additions and 17 deletions
+16 -15
View File
@@ -77,12 +77,12 @@
<paper-item class="two-line">
<div id="text" flex>
<div id="primary"><content select=".name"></content></div>
<div id="primary"><content></content></div>
<div id="secondary" layout horizontal center>
<core-tooltip label="Global Priority" noarrow position="right">
<core-icon icon="star"></core-icon>
</core-tooltip>
<content select=".priority"></content>
<div id="priority"></div>
</div>
</div>
<core-tooltip id="loadsBSA" label="Loads BSA" noarrow position="left">
@@ -100,12 +100,13 @@
observe: {
'data.userlist': 'onUserlistChange',
'data.modPriority': 'onPriorityChange',
'data.isGlobalPriority': 'onPriorityChange'
'data.isGlobalPriority': 'onPriorityIsGlobalChange'
},
dataChanged: function(oldValue, newValue) {
this.onUserlistChange();
this.onPriorityChange();
this.onPriorityIsGlobalChange();
},
onUserlistChange: function(oldValue, newValue) {
@@ -119,25 +120,25 @@
},
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');
}
if (this.data && this.data.modPriority) {
this.shadowRoot.getElementById('priority').textContent = this.data.modPriority;
this.shadowRoot.getElementById('secondary').classList.remove('hidden');
} else {
this.shadowRoot.getElementById('priority').textContent = '';
this.shadowRoot.getElementById('secondary').classList.add('hidden');
}
},
onPriorityIsGlobalChange: function(oldValue, newValue) {
if (this.data && this.data.isGlobalPriority) {
this.shadowRoot.getElementById('secondary').firstElementChild.classList.remove('hidden');
} else {
this.shadowRoot.getElementById('secondary').firstElementChild.classList.add('hidden');
}
},
getName: function() {
return this.querySelector('.name').textContent.trim();
return this.textContent.trim();
},
handleDragStart: function(evt) {
+1 -2
View File
@@ -54,8 +54,7 @@
<core-list id="cardsNav" class="tab-content" flex>
<template>
<loot-plugin-item data-id="{{model.id}}" data-bsa?="{{model.loadsBSA}}" data="{{model}}" data-index="{{index}}">
<div class="name">{{model.name}}</div>
<div class="priority">{{model.modPriority}}</div>
{{model.name}}
</loot-plugin-item>
</template>
<!-- Generated <loot-plugin-item> elements go here. -->