mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
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:
+279
-275
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"]');
|
||||
|
||||
Reference in New Issue
Block a user