Skip to content

Commit

Permalink
List fields also for all other item types (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuphilip authored and dstillman committed Feb 26, 2018
1 parent edfe72d commit a46e0d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/chrome/content/scaffold/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ var Scaffold = new function() {
}, true);

generateTranslatorID();

// Add List fields help menu entries for all other item types
var types = Zotero.ItemTypes.getAll().map(t => t.name).sort();
var morePopup = document.getElementById('mb-help-fields-more-popup');
var primaryTypes = ['book', 'bookSection', 'conferencePaper', 'journalArticle', 'magazineArticle', 'newspaperArticle'];
for (let type of types) {
if (primaryTypes.includes(type)) continue;
var menuitem = document.createElement('menuitem');
menuitem.setAttribute('label', type);
menuitem.addEventListener('command', () => { Scaffold.addTemplate('templateNewItem', type) });
morePopup.appendChild(menuitem);
}
}

function onResize() {
Expand Down
7 changes: 7 additions & 0 deletions src/chrome/content/scaffold/scaffold.xul
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@
<menupopup id="mb-help-fields-popup">
<menuitem id="mb-help-fields-book" label="book" oncommand="Scaffold.addTemplate('templateNewItem', 'book')"/>
<menuitem id="mb-help-fields-booksection" label="bookSection" oncommand="Scaffold.addTemplate('templateNewItem', 'bookSection')"/>
<menuitem id="mb-help-fields-conferencepaper" label="conferencePaper" oncommand="Scaffold.addTemplate('templateNewItem', 'conferencePaper')"/>
<menuitem id="mb-help-fields-journalarticle" label="journalArticle" oncommand="Scaffold.addTemplate('templateNewItem', 'journalArticle')"/>
<menuitem id="mb-help-fields-magazinearticle" label="magazineArticle" oncommand="Scaffold.addTemplate('templateNewItem', 'magazineArticle')"/>
<menuitem id="mb-help-fields-newspaperarticle" label="newspaperArticle" oncommand="Scaffold.addTemplate('templateNewItem', 'newspaperArticle')"/>
<menu id="mb-help-fields-more" label="&scaffold.toolbar.template.more.label;">
<menupopup id="mb-help-fields-more-popup">
<!-- This will be filled on load with all other item types -->
</menupopup>
</menu>
</menupopup>
</menu>
</menupopup>
Expand Down
5 changes: 3 additions & 2 deletions src/chrome/locale/en-US/scaffold/scaffold.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<!ENTITY scaffold.toolbar.template.label "Add a template">
<!ENTITY scaffold.toolbar.template.newWeb.label "Add web translator template">
<!ENTITY scaffold.toolbar.template.scrape.label "Add scrape function using…">
<!ENTITY scaffold.toolbar.template.itemTypes.label "List all item types">
<!ENTITY scaffold.toolbar.template.newItem.label "List all fields for item type">
<!ENTITY scaffold.toolbar.export.label "Export">
<!ENTITY scaffold.toolbar.detectWeb.label "Run detectWeb">
<!ENTITY scaffold.toolbar.doWeb.label "Run doWeb">
Expand All @@ -18,6 +16,9 @@
<!ENTITY scaffold.tabs.testing.label "Testing">

<!ENTITY scaffold.menu.help "Help">
<!ENTITY scaffold.toolbar.template.itemTypes.label "List all item types">
<!ENTITY scaffold.toolbar.template.newItem.label "List all fields for item type">
<!ENTITY scaffold.toolbar.template.more.label "More">

<!ENTITY scaffold.tabUrl.label "Current URL:">
<!ENTITY scaffold.testFrame.label "Test Frame:">
Expand Down

0 comments on commit a46e0d7

Please sign in to comment.