From cd8e562fc718661e489d620294efdbf6bcc8f66f Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 7 Feb 2014 11:36:03 +0000 Subject: [PATCH] fix local/global edit setting sync in UI controller --- static/js/UI.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/static/js/UI.js b/static/js/UI.js index e91dc02c0..9cab9d74a 100644 --- a/static/js/UI.js +++ b/static/js/UI.js @@ -164,6 +164,7 @@ pandora.UI = (function() { } if (args.edit) { + // add local edit settings if (!pandora.user.ui.edits[args.edit]) { add['edits.' + that.encode(args.edit)] = {}; } @@ -175,6 +176,24 @@ pandora.UI = (function() { }); } + Ox.forEach({ + editSelection: 'selection', + editSort: 'sort', + editView: 'view' + }, function(editSetting, setting) { + var key = 'edits.' + that.encode(args.edit || pandora.user.ui.edit) + '.' + editSetting; + if (setting in args) { + // add local edit setting + add[key] = args[setting]; + } else if (setting in add) { + // add local edit setting + add[key] = add[setting]; + } else if (key in add) { + // add global edit setting + add[setting] = add[key]; + } + }); + if (args.text) { add['texts.' + that.encode(args.text)] = Ox.map(textSettings, function(value, key) { var textsKey = 'texts.' + that.encode(args.text), @@ -186,19 +205,6 @@ pandora.UI = (function() { }); } - Ox.forEach({ - editSelection: 'selection', - editSort: 'sort', - editView: 'view' - }, function(editSetting, setting) { - var key = 'edits.' + that.encode(args.edit || pandora.user.ui.edit) + '.' + editSetting; - if (setting in args) { - add[key] = args[setting]; - } else if (setting in add) { - add[key] == add[setting]; - } - }); - // items in args trigger events, items in add do not [args, add].forEach(function(obj, isAdd) { Ox.forEach(obj, function(val, key) {