Merge remote-tracking branch 'origin/group-snapshots-by-place' into no-snapshots-welcome

This commit is contained in:
howard-stearns 2016-11-14 13:47:32 -08:00
commit 6078b833a1
2 changed files with 25 additions and 3 deletions

View file

@ -114,6 +114,7 @@ Window {
timestamp: model.created_at;
onlineUsers: model.online_users;
storyId: model.metaverseId;
drillDownToPlace: model.drillDownToPlace;
hoverThunk: function () { ListView.view.currentIndex = index; }
unhoverThunk: function () { ListView.view.currentIndex = -1; }
}
@ -392,6 +393,7 @@ Window {
tags: tags,
description: description,
online_users: data.details.concurrency || 0,
drillDownToPlace: false,
searchText: [name].concat(tags, description || []).join(' ').toUpperCase()
}
@ -407,6 +409,23 @@ Window {
selectedTab = textButton;
fillDestinations();
}
property var placeMap: ({});
function addToSuggestions(place) {
var collapse = allTab.selected && (place.action !== 'concurrency');
if (collapse) {
var existing = placeMap[place.place_name];
if (existing) {
existing.drillDownToPlace = true;
return;
}
}
suggestions.append(place);
if (collapse) {
placeMap[place.place_name] = suggestions.get(suggestions.count - 1);
} else if (place.action === 'concurrency') {
suggestions.get(suggestions.count - 1).drillDownToPlace = true; // Don't change raw place object (in allStories).
}
}
function getUserStoryPage(pageNumber, cb) { // cb(error) after all pages of domain data have been added to model
var options = [
'include_actions=' + selectedTab.includeActions,
@ -442,18 +461,20 @@ Window {
}
return function (place) {
if (matches(place)) {
suggestions.append(place);
addToSuggestions(place);
}
};
}
function filterChoicesByText() {
suggestions.clear();
placeMap = {};
allStories.forEach(makeFilteredPlaceProcessor());
}
function fillDestinations() {
allStories = [];
suggestions.clear();
placeMap = {};
getUserStoryPage(1, function (error) {
console.log('user stories query', error || 'ok', allStories.length);
});

View file

@ -27,6 +27,7 @@ Rectangle {
property var goFunction: null;
property string storyId: "";
property bool drillDownToPlace: false;
property string timePhrase: pastTime(timestamp);
property int onlineUsers: 0;
@ -113,7 +114,7 @@ Rectangle {
}
FiraSansRegular {
id: users;
text: (action === 'concurrency') ? onlineUsers : 'snapshot';
text: (action === 'concurrency') ? onlineUsers : ('snapshot' + (drillDownToPlace ? 's' : ''));
size: (action === 'concurrency') ? textSize : textSizeSmall;
color: hifi.colors.white;
anchors {
@ -140,7 +141,7 @@ Rectangle {
id: usersImage;
imageURL: "../../images/" + action + ".svg";
size: 32;
onClicked: goFunction("/user_stories/" + storyId);
onClicked: goFunction(drillDownToPlace ? ("/places/" + placeName) : ("/user_stories/" + storyId));
buttonState: 0;
defaultState: 0;
hoverState: 1;