Skip to content

Commit

Permalink
set data as URL string so At.js will launch Ajax request to the serve…
Browse files Browse the repository at this point in the history
…r to get the JSON data
  • Loading branch information
TildaDares committed Jun 10, 2021
1 parent 0230086 commit 589f901
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions app/assets/javascripts/atWhoAutoComplete.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
(function() {

// settings at https://github.com/ichord/At.js/wiki/Base-Document#settings
const users = [];

(function getRecentlyActiveUsers() {
$.getJSON("/users/active", function(data) {
data.forEach(function(i) { users.push(i.user.username)})
});
})();

var at_config = {
at: "@",
data: users,
displayTpl: (item) => `<li>${item.username ? item.username : item.name}</li>`,
data: '/users/active',
delay: 400,
callbacks: {
remoteFilter: debounce(function(query, callback) {
Expand Down

0 comments on commit 589f901

Please sign in to comment.