Show More
@@ -210,6 +210,15 b' function(WidgetManager, _, Backbone){' | |||
|
210 | 210 | // Replace models with model ids recursively. |
|
211 | 211 | if (value instanceof Backbone.Model) { |
|
212 | 212 | return value.id; |
|
213 | ||
|
214 | } else if ($.isArray(value)) { | |
|
215 | var packed = []; | |
|
216 | var that = this; | |
|
217 | _.each(value, function(sub_value, key) { | |
|
218 | packed.push(that._pack_models(sub_value)); | |
|
219 | }); | |
|
220 | return packed; | |
|
221 | ||
|
213 | 222 | } else if (value instanceof Object) { |
|
214 | 223 | var packed = {}; |
|
215 | 224 | var that = this; |
@@ -217,6 +226,7 b' function(WidgetManager, _, Backbone){' | |||
|
217 | 226 | packed[key] = that._pack_models(sub_value); |
|
218 | 227 | }); |
|
219 | 228 | return packed; |
|
229 | ||
|
220 | 230 | } else { |
|
221 | 231 | return value; |
|
222 | 232 | } |
@@ -224,13 +234,22 b' function(WidgetManager, _, Backbone){' | |||
|
224 | 234 | |
|
225 | 235 | _unpack_models: function(value) { |
|
226 | 236 | // Replace model ids with models recursively. |
|
227 |
if (value |
|
|
237 | if ($.isArray(value)) { | |
|
238 | var unpacked = []; | |
|
239 | var that = this; | |
|
240 | _.each(value, function(sub_value, key) { | |
|
241 | unpacked.push(that._unpack_models(sub_value)); | |
|
242 | }); | |
|
243 | return unpacked; | |
|
244 | ||
|
245 | } else if (value instanceof Object) { | |
|
228 | 246 | var unpacked = {}; |
|
229 | 247 | var that = this; |
|
230 | 248 | _.each(value, function(sub_value, key) { |
|
231 | 249 | unpacked[key] = that._unpack_models(sub_value); |
|
232 | 250 | }); |
|
233 | 251 | return unpacked; |
|
252 | ||
|
234 | 253 | } else { |
|
235 | 254 | var model = this.widget_manager.get_model(value); |
|
236 | 255 | if (model) { |
General Comments 0
You need to be logged in to leave comments.
Login now