update UI controller (handle edits, some cosmetic changes)

This commit is contained in:
rolux 2013-08-07 14:47:44 +00:00
parent c1229438bf
commit 486b8a3c2a

View file

@ -34,6 +34,7 @@ pandora.UI = (function() {
var add = {}, var add = {},
args, args,
editSettings = pandora.site.editSettings,
item, item,
list, list,
listSettings = pandora.site.listSettings, listSettings = pandora.site.listSettings,
@ -56,11 +57,11 @@ pandora.UI = (function() {
self.previousUI._list = pandora.getListState(self.previousUI.find); self.previousUI._list = pandora.getListState(self.previousUI.find);
if (args.section == 'texts') { if (args.section == 'texts') {
trigger['section'] = args['section']; trigger.section = args.section;
trigger['text'] = args['text']; trigger.text = args.text;
} else if (args.section == 'edits') { } else if (args.section == 'edits') {
trigger['section'] = args['section']; trigger.section = args.section;
trigger['edit'] = args['edit']; trigger.edit = args.edit;
} else { } else {
if ('find' in args) { if ('find' in args) {
// the challenge here is that find may change list, // the challenge here is that find may change list,
@ -162,12 +163,12 @@ pandora.UI = (function() {
} }
if (args.edit) { if (args.edit) {
if ( add['edits.' + that.encode(args.edit)] = Ox.map(editSettings, function(value, key) {
!pandora.user.ui.editPoints[args.edit] var editsKey = 'edits.' + that.encode(args.edit) + '.' + key;
&& !args['editPoints.' + args.edit] return editsKey in args ? args[editsKey]
) { : pandora.user.ui.edits[args.edit] ? pandora.user.ui.edits[args.edit][key]
add['editPoints.' + args.edit] = {clip: '', 'in': 0, out: 0, position: 0}; : value;
} });
} }
// items in args trigger events, items in add do not // items in args trigger events, items in add do not
@ -183,7 +184,7 @@ pandora.UI = (function() {
} }
if (!Ox.isEqual(ui[keys[0]], val)) { if (!Ox.isEqual(ui[keys[0]], val)) {
if (val === null) { if (val === null) {
delete ui[keys[0]] delete ui[keys[0]];
} else { } else {
ui[keys[0]] = val; ui[keys[0]] = val;
} }