Skip to content

Commit

Permalink
reverts #55 and closes #86 by considering single items as a group unt…
Browse files Browse the repository at this point in the history
…o themselves; possibly revisit this choice, there are clear cases where it's not helpful, like when every property value is different
  • Loading branch information
zepheiryan committed Sep 28, 2012
1 parent 8b858fe commit d3e1f08
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
15 changes: 15 additions & 0 deletions scripted/src/scripts/ui/views/ordered-view-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,31 @@ Exhibit.OrderedViewFrame.prototype._internalReconstruct = function(allItems) {
processNonNumericLevel(items, index, values, valueType) :
processNumericLevel(items, index, values, valueType);

grouped = true;
// The idea here appears to be to avoid considering a set of
// one item a group; but this ends up producing very confusing
// grouping with ordering - a single-item set without a group
// has no label and subsequent sibling entities (items or groups) then
// end up appearing as children instead, depending on position
// relative to the end of the supergroup. The current solution:
// consider single items a group. Comments labelled mono-grouping
// optimize this choice. Consider revisiting it in the future,
// possibly as a setting.
/** mono-grouping
grouped = false;
for (k = 0; k < keys.length; k++) {
if (keys[k].items.size() > 1) {
grouped = true;
}
}
*/

hasSomeGrouping = true;
/** mono-grouping
if (grouped) {
hasSomeGrouping = true;
}
*/

for (k = 0; k < keys.length; k++) {
key = keys[k];
Expand Down
27 changes: 13 additions & 14 deletions scripted/src/scripts/ui/views/thumbnail-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Exhibit.ThumbnailView.prototype._reconstructWithFloats = function() {
state.groupDoms = state.groupDoms.slice(0, groupLevel);
state.groupCounts = state.groupCounts.slice(0, groupLevel);

if (groupLevel > 0 && groupLevel <= state.groupDoms.length) {
if (groupLevel > 0) {
state.div = state.groupDoms[groupLevel - 1].contentDiv;
} else {
state.div = view._dom.bodyDiv;
Expand Down Expand Up @@ -292,7 +292,7 @@ Exhibit.ThumbnailView.prototype._reconstructWithTable = function() {
closeGroups = function(groupLevel) {
var i;
for (i = groupLevel; i < state.groupDoms.length; i++) {
state.groupDoms[i].countSpan.innerHTML = state.groupCounts[i];
Exhibit.jQuery(state.groupDoms[i].countSpan).html(state.groupCounts[i]);
}
state.groupDoms = state.groupDoms.slice(0, groupLevel);
state.groupCounts = state.groupCounts.slice(0, groupLevel);
Expand All @@ -308,7 +308,6 @@ Exhibit.ThumbnailView.prototype._reconstructWithTable = function() {
};

this._orderedViewFrame.onNewGroup = function(groupSortKey, keyType, groupLevel) {
// @@@ this may not be algorithmically correct
closeGroups(groupLevel);

var groupDom = Exhibit.ThumbnailView.constructGroup(
Expand Down Expand Up @@ -427,28 +426,28 @@ Exhibit.ThumbnailView.prototype.stateDiffers = function(state) {
*/
Exhibit.ThumbnailView.constructGroup = function(groupLevel, label) {
var template = {
tag: "div",
"tag": "div",
"class": "exhibit-thumbnailView-group",
children: [
{ tag: "h" + (groupLevel + 1),
children: [
"children": [
{ "tag": "h" + (groupLevel + 1),
"children": [
label,
{ tag: "span",
{ "tag": "span",
"class": "exhibit-collectionView-group-count",
children: [
"children": [
" (",
{ tag: "span",
field: "countSpan"
{ "tag": "span",
"field": "countSpan"
},
")"
]
}
],
field: "header"
"field": "header"
},
{ tag: "div",
{ "tag": "div",
"class": "exhibit-collectionView-group-content",
field: "contentDiv"
"field": "contentDiv"
}
]
};
Expand Down

0 comments on commit d3e1f08

Please sign in to comment.