Added sidebar indication of open editors.

A pencil icon with a "Editor Is Open" tooltip will be displayed for any
plugins with open editors. The icon replaces the user metadata icon
while the editor is open, if the latter is visible.

Despite all the churn in the l10n template, the only real change is the
addition of the new tooltip string.
This commit is contained in:
Oliver Hamlet
2015-02-09 21:43:10 +00:00
parent ba8dcbc19d
commit 4e0a2589d7
4 changed files with 299 additions and 278 deletions
File diff suppressed because it is too large Load Diff
+8 -2
View File
@@ -7,10 +7,13 @@
<polymer-element name="loot-plugin-item" attributes="priorityText data">
<template>
<style>
:host(:not([data-edits])) #hasUserEdits {
:host(:not([data-edits])) #hasUserEdits,
:host([data-editor-open]) #hasUserEdits,
:host(:not([data-editor-open])) #editorIsOpen {
display: none;
}
#hasUserEdits > core-icon {
#hasUserEdits > core-icon,
#editorIsOpen > core-icon {
display: block;
margin-right: 0;
}
@@ -99,6 +102,9 @@
<core-tooltip id="hasUserEdits" label="Has User Metadata" noarrow position="left">
<core-icon icon="account-circle"></core-icon>
</core-tooltip>
<core-tooltip id="editorIsOpen" label="Editor Is Open" noarrow position="left">
<core-icon icon="create"></core-icon>
</core-tooltip>
</paper-item>
</template>
<script>
+11 -1
View File
@@ -373,6 +373,11 @@ function onEditorOpen(evt) {
for (var i = 0; i < elements.length; ++i) {
elements[i].draggable = true;
elements[i].addEventListener('dragstart', elements[i].onDragStart, false);
/* Also add data-editor-is-open attribute to the plugin's item. */
if (elements[i].getAttribute('data-id') == evt.target.id) {
elements[i].setAttribute('data-editor-open', true);
}
}
/* Now show editor. */
@@ -444,6 +449,11 @@ function onEditorClose(evt) {
for (var i = 0; i < elements.length; ++i) {
elements[i].removeAttribute('draggable');
elements[i].removeEventListener('dragstart', elements[i].onDragStart, false);
/* Also remove data-editor-is-open attribute from the plugin's item. */
if (elements[i].getAttribute('data-id') == evt.target.id) {
elements[i].removeAttribute('data-editor-open');
}
}
/* Disable priority hover in plugins list and enable header
@@ -670,4 +680,4 @@ function setupEventHandlers() {
document.getElementById('cardsNav').addEventListener('click', onSidebarClick, false);
document.getElementById('cardsNav').addEventListener('dblclick', onSidebarClick, false);
}
}
+1
View File
@@ -138,6 +138,7 @@
}
pluginItem.querySelector('#secondary core-tooltip').setAttribute('label', l10n.translate("Global Priority").fetch());
pluginItem.getElementById('hasUserEdits').setAttribute('label', l10n.translate("Has User Metadata").fetch());
pluginItem.getElementById('editorIsOpen').setAttribute('label', l10n.translate("Editor Is Open").fetch());
/* File row template */
var fileRow = document.querySelector('link[rel="import"][href$="editable-table.html"]');