Skip to content

Commit

Permalink
fixed multi drawer behaviour
Browse files Browse the repository at this point in the history
Change-Id: Ie6a8552cf4d78b08686e6be62020dc9daa54f5ac
Reviewed-on: http://review.northscale.com/3206
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information
Aliaksey Kandratsenka authored and steveyen committed Oct 11, 2010
1 parent cb0d4fa commit 84b8ec4
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions deps/menelaus/priv/js/app-misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,35 +380,26 @@ var MultiDrawersWidget = mkClass({

if (!cell) {
var uriCell = new Cell(function (openedNames) {
if (this.self.value || !_.include(openedNames, e[key]))
return this.self.value;

if (!_.include(openedNames, e[key]))
return undefined;
return self.options.uriExtractor(e);
}, {openedNames: self.openedNames});

cell = new Cell(function (uri) {
return future.get({url: uri}, function (childItem) {
if (self.options.valueTransformer)
childItem = self.options.valueTransformer(e, childItem);
return childItem;
});
return future.get({url: uri});
}, {uri: uriCell});

self.knownKeys[e[key]] = cell;
} else {
cell.keepValueDuringAsync = true;
cell.invalidate();
}

e[drawerCellName] = cell;

var oldE = oldElementsByName[e[key]];
var oldCell = oldE && oldE[drawerCellName];

// use previous value if possible, but refresh it
if (oldCell && oldCell.value) {
cell.setValue(oldCell.value);
cell.keepValueDuringAsync = true;
cell.invalidate();
}

self.elementsByName[e[key]] = e;
});
return elements;
Expand Down Expand Up @@ -456,7 +447,12 @@ var MultiDrawersWidget = mkClass({
throw new Error("MultiDrawersWidget: bad markup!");
}

var s = renderCellTemplate(element[self.options.drawerCellName], [container, self.options.template]);
var s = renderCellTemplate(element[self.options.drawerCellName], [container, self.options.template],
function (value) {
if (!self.options.valueTransformer)
return value;
return self.options.valueTransformer(element, value);
});
subscriptions.push(s);

q.show();
Expand Down

0 comments on commit 84b8ec4

Please sign in to comment.