define sections in one location

This commit is contained in:
j 2019-12-09 13:12:44 +00:00
parent 2093922208
commit 5168ed4a33
4 changed files with 11 additions and 16 deletions

View File

@ -1647,12 +1647,10 @@ pandora.ui.mainMenu = function() {
function getViewMenu() {
return { id: 'viewMenu', title: Ox._('View'), items: [
{ id: 'section', title: Ox._('Section'), items: [
{ group: 'viewsection', min: 1, max: 1, items: Object.keys(pandora.site.sectionFolders).map(function(section) {
return {
id: section,
title: section == 'items' ? Ox._(pandora.site.itemName.plural) : Ox._(Ox.toTitleCase(section)),
checked: ui.section == section
};
{ group: 'viewsection', min: 1, max: 1, items: pandora.site.sections.map(function(section) {
section = Ox.extend({}, section)
section.checked = section.id == ui.section;
return section;
}) }
] },
{},

View File

@ -395,6 +395,11 @@ appPanel
}) ? 'manual' : data.site.layers.some(function(layer) {
return layer.hasPlaces;
}) ? 'auto' : 'none',
sections: [
{id: 'items', title: Ox._(pandora.site.itemName.plural)},
{id: 'edits', title: Ox._('Edits')},
{id: 'documents', title: Ox._('Documents')}
],
sectionFolders: {
items: [
{id: 'personal', title: 'Personal Lists'},

View File

@ -2,11 +2,7 @@
pandora.ui.sectionButtons = function(section) {
var that = Ox.ButtonGroup({
buttons: [
{id: 'items', title: Ox._(pandora.site.itemName.plural)},
{id: 'edits', title: Ox._('Edits')},
{id: 'documents', title: Ox._('Documents')}
],
buttons: pandora.site.sections,
id: 'sectionButtons',
selectable: true,
value: section || pandora.user.ui.section

View File

@ -4,11 +4,7 @@ pandora.ui.sectionSelect = function(section) {
// fixme: duplicated
var that = Ox.Select({
id: 'sectionSelect',
items: [
{id: 'items', title: Ox._(pandora.site.itemName.plural)},
{id: 'edits', title: Ox._('Edits')},
{id: 'documents', title: Ox._('Documents')}
],
items: pandora.site.sections,
value: section || pandora.user.ui.section
}).css({
float: 'left',