Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link collection names in the UI sequentially #1433

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions modules/Collections/assets/field-collectionlink.tag
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@

}.bind(this);

this.linkQueue = [];
this.modalOpen = false;
this.link = null;
this.sort = {_created: -1};
Expand Down Expand Up @@ -467,29 +468,36 @@
var display = '...';
var cacheKey = link._id + ':' + this.lang;

if (!cache[cacheKey]) {
if (cache[cacheKey] !== undefined && cache[cacheKey] !== display) {
return cache[cacheKey]
}

this.linkQueue[link._id] = link;

if (Object.keys(this.linkQueue).length === 0 || Object.keys(this.linkQueue)[0] === link._id) {

App.request('/collections/find', {collection:this.collection.name, options:{lang:this.lang, filter:{_id:link._id}, limit:1}}).then(function(data){

if (!data.entries.length) {
cache[cacheKey] = 'n/a';
link.display = 'n/a';
delete this.linkQueue[link._id]
this.update();
return;
}

link.display = $this.cacheDisplay(data.entries[0]);

delete this.linkQueue[link._id]
cache[cacheKey] = link.display

this.update();

}.bind(this))

cache[cacheKey] = '...';

} else {
display = cache[cacheKey];
}

display = cache[cacheKey] = '...';

return display;
}

Expand Down