URL.js: add edit view and edit sort

This commit is contained in:
rolux 2014-02-08 19:16:31 +00:00
parent 8652d2e230
commit 4380a2e193

View file

@ -56,6 +56,10 @@ pandora.URL = (function() {
} }
} else if (pandora.user.ui.section == 'edits') { } else if (pandora.user.ui.section == 'edits') {
var editPoints = pandora.user.ui.edits[state.item] || {}; var editPoints = pandora.user.ui.edits[state.item] || {};
if (state.item) {
state.view = pandora.user.ui.editView;
state.sort = pandora.user.ui.editSort;
}
state.span = editPoints.clip || [].concat( state.span = editPoints.clip || [].concat(
editPoints.position editPoints.position
? editPoints.position ? editPoints.position
@ -199,6 +203,14 @@ pandora.URL = (function() {
} else if (state.type == 'edits') { } else if (state.type == 'edits') {
if (state.view) {
set.editView = state.view;
}
if (state.sort) {
set.editSort = state.sort;
}
if (state.span) { if (state.span) {
var key = 'edits.' + pandora.UI.encode(state.item); var key = 'edits.' + pandora.UI.encode(state.item);
set[key] = {}; set[key] = {};
@ -259,6 +271,7 @@ pandora.URL = (function() {
} }
function getOptions () { function getOptions () {
var itemsSection = pandora.site.itemsSection, var itemsSection = pandora.site.itemsSection,
sortKeys = {}, views = {}; sortKeys = {}, views = {};
@ -319,12 +332,19 @@ pandora.URL = (function() {
// Edits // Edits
views['edits'] = { views['edits'] = {
list: [], list: [],
item: ['edit'] item: ['list', 'grid', 'annotations']
}; };
sortKeys['edits'] = { sortKeys['edits'] = {
list: {}, list: {},
item: {} item: {}
}; };
views['edits'].item.forEach(function(view) {
sortKeys['edits'].item[view] = [
{id: 'index', operator: '+'}
]
.concat(pandora.site.clipKeys)
.concat(pandora.site.itemKeys);
});
// Texts // Texts
views['texts'] = { views['texts'] = {
@ -340,6 +360,7 @@ pandora.URL = (function() {
views: views, views: views,
sortKeys: sortKeys sortKeys: sortKeys
}; };
} }
that.init = function() { that.init = function() {
@ -362,7 +383,11 @@ pandora.URL = (function() {
}; };
spanType['edits'] = { spanType['edits'] = {
list: {}, list: {},
item: {edit: 'duration'} item: {
list: 'duration',
grid: 'duration',
annotations: 'duration'
}
}; };
spanType['texts'] = { spanType['texts'] = {
list: {}, list: {},