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() { function getViewMenu() {
return { id: 'viewMenu', title: Ox._('View'), items: [ return { id: 'viewMenu', title: Ox._('View'), items: [
{ id: 'section', title: Ox._('Section'), items: [ { id: 'section', title: Ox._('Section'), items: [
{ group: 'viewsection', min: 1, max: 1, items: Object.keys(pandora.site.sectionFolders).map(function(section) { { group: 'viewsection', min: 1, max: 1, items: pandora.site.sections.map(function(section) {
return { section = Ox.extend({}, section)
id: section, section.checked = section.id == ui.section;
title: section == 'items' ? Ox._(pandora.site.itemName.plural) : Ox._(Ox.toTitleCase(section)), return section;
checked: ui.section == section
};
}) } }) }
] }, ] },
{}, {},

View file

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

View file

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

View file

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