Merge remote-tracking branch 'origin/priority-display' into dev

This commit is contained in:
Oliver Hamlet
2014-12-27 11:25:32 +00:00
5 changed files with 104 additions and 15 deletions
+3 -3
View File
@@ -163,15 +163,15 @@ loot-clear-metadata
<paper-dropdown class="dropdown" halign="right" opened="{{data.isMenuOpen}}">
<core-menu class="menu">
<paper-checkbox id="showOnlyConflicts" label="Show Only Conflicts" checked="{{data.isConflictFilterChecked}}" flex></paper-checkbox>
<paper-item id="editMetadata">
<paper-item id="editMetadata" noink>
<core-icon icon="create"></core-icon>
Edit Metadata
</paper-item>
<paper-item id="copyMetadata">
<paper-item id="copyMetadata" noink>
<core-icon icon="content-copy"></core-icon>
Copy Metadata
</paper-item>
<paper-item id="clearMetadata">
<paper-item id="clearMetadata" noink>
<core-icon icon="delete"></core-icon>
Clear User Metadata
</paper-item>
+89 -5
View File
@@ -15,13 +15,76 @@
display: block;
margin-right: 0;
}
core-tooltip {
paper-item > core-tooltip {
margin-left: 16px;
}
/* paper-item (two-line) */
paper-item.two-line {
/* Two-line items should be 72px high according to Material Design.
Squeeze the height to fit more items in. */
/*height: 72px;*/
}
#primary,
#secondary,
#secondary core-icon,
paper-item.two-line::shadow .button-content {
transition: 0.6s;
}
paper-item.two-line::shadow .button-content {
padding: 14px 16px;
}
:host-context(body[data-editors]) paper-item.two-line::shadow .button-content {
padding: 7.5px 16px;
}
#text {
/* Padding is disabled as otherwise text won't fit in correctly. */
/*padding: 4px 0;*/
line-height: normal;
overflow: visible;
}
:host-context(body[data-editors]) #primary {
/* MD spec says 16sp, but that doesn't fit, so use 14sp. */
/*font-size: 1.143rem;*/
font-size: 1rem;
}
#secondary {
/* MD spec says 14sp, but that doesn't fit, so use 12sp. */
/*font-size: 1rem; */
font-size: 0.857rem;
color: rgba(0, 0, 0, 0.54);
height: 13px;
overflow: visible;
}
#secondary core-icon {
margin-right: 0;
height: 13px;
}
/* When not in edit mode, hide secondary text. */
#secondary.hidden,
:host-context(body:not([data-editors])) #secondary {
height: 0;
overflow: hidden;
}
core-tooltip.hidden {
opacity: 0;
pointer-events: none;
overflow: hidden;
}
</style>
<paper-item>
<div flex><content></content></div>
<paper-item class="two-line">
<div id="text" flex>
<div id="primary"><content select=".name"></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>
</div>
<core-tooltip id="loadsBSA" label="Loads BSA" noarrow position="left">
<core-icon icon="attachment"></core-icon>
</core-tooltip>
@@ -35,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) {
@@ -52,8 +118,26 @@
}
},
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();
return this.querySelector('.name').textContent.trim();
},
handleDragStart: function(evt) {
+3 -1
View File
@@ -904,6 +904,7 @@ function handleEditorClose(evt) {
--numEditors;
if (numEditors == 0) {
document.body.removeAttribute('data-editors');
/* Re-enable toolbar elements. */
document.getElementById('wipeUserlistButton').removeAttribute('disabled');
document.getElementById('copyContentButton').removeAttribute('disabled');
@@ -912,8 +913,9 @@ function handleEditorClose(evt) {
document.getElementById('gameMenu').removeAttribute('disabled');
document.getElementById('updateMasterlistButton').removeAttribute('disabled');
document.getElementById('sortButton').removeAttribute('disabled');
} else {
document.body.setAttribute('data-editors', numEditors);
}
document.body.setAttribute('data-editors', numEditors);
}
function handleConflictsFilter(evt) {
/* evt.detail is true if the filter has been activated. */
+2 -1
View File
@@ -54,7 +54,8 @@
<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}}">
{{model.name}}
<div class="name">{{model.name}}</div>
<div class="priority">{{model.modPriority}}</div>
</loot-plugin-item>
</template>
<!-- Generated <loot-plugin-item> elements go here. -->
+7 -5
View File
@@ -429,11 +429,13 @@ namespace loot {
// Priority value was changed, so add it to the userlist data.
int priority = pluginMetadata["modPriority"].as<int>();
if (priority >= 0) {
priority += max_priority;
}
else {
priority -= max_priority;
if (pluginMetadata["isGlobalPriority"].as<bool>()) {
if (priority >= 0) {
priority += max_priority;
}
else {
priority -= max_priority;
}
}
newUserlistEntry.Priority(priority);
newUserlistEntry.SetPriorityExplicit(true);