Skip to content

Commit

Permalink
Added debounce for typeahead search optimization (publiclab#4904)
Browse files Browse the repository at this point in the history
* Added debounce for typeahead search optimization

* Update README.md (publiclab#4883)

The "What makes this project different" section had several long sentences which were difficult to understand. I tried to fix this by breaking the sentences down into smaller more concise sentences.

* convert chars to unicode (publiclab#4901)

* fixes for map module (publiclab#4909)

* fixes for map module

* yarn.lock update

* updated yarn.lock (publiclab#4911)

* updated yarn.lock

* tweak

* Remove useless variable assignment (publiclab#4885)

* Simplify username generation

* Use status module

* Tiny fix

* Fix indentation

* Made moderate buttons to appear on the same line (publiclab#4913)

* Made moderate buttons to appear on the same line

* Removed break tag.

* Clean up (publiclab#4902)

* Clean up with Rubocop

* More cleanup

* Excluse views

* Small refactor

* More clean up

* Clean up

* Fix conflict

* Tiny fix

* Follow tag asynchronously (publiclab#4587)

* Follow tag asynchronously


Added link to manage subscriptions


Add precondition failed http error code


cleanup


codeclimate fix


Fix typo change


remove data-remote


Preserve code for non xhr requests


Seperate JS and html


Codeclimate fix


Code Climate fixes


Updated tests

* Remove pre-compilation of async.js

* pre compilation of js assets

* cc fix try

* Move verification link (publiclab#4786)

* Move verification link

* Change link to text

* Remove unnecessary message

* popover works, styling is still not showing under elements but is und… (publiclab#4906)

* popover works, styling is still not showing under elements but is under.btn-default

* copied yml file back in

* First timer tag script (publiclab#4878)

* First timer tag script

* migration for attaching first-time-poster

* change migration bump version to 5.1

* Update schema.rb.example

* Consolidating ranges and stats (publiclab#4887)

* restyle range page to be a partial

* remove static stats

* merge range and main stats

* render range in main stats

* fix failing range test

* add questions vs answers graph

* add go back and further buttons

* minor fixes

* Change contribution graph making method

Change method to create graph based on the range given

* fix failing test and code climate issues

* remove commented code and indent

* remove stats_nav partial

* add contribution graph tests

* review requests implemetation

* move tag graph button (publiclab#4921)

* move tag graph button

* Update _user_controls.html.erb

* Added reply by tweet feature (publiclab#3175)

* Added reply by tweet feature

* Updated schedule.rb file

* Finalized reply-by-tweet

* Corrected schema version

* Minor change

* Added reply_by_tweet doc

* Minor changes

* Added twitter gem

* Minor changes

* Added Environment variables in Docker

* Added summery in Doc file

* Corrected schema version

* Added some documentation

* Added some documentation

* Migration timestamp changed

* Changed migration

* Minor change

* Minor changes

* Added rake to general gem list

* Added bundle exec for rake/rails tasks in schedule.rb

* Added path env variable

* MINOR CHANGE

* MINOR CHANGE

* MINOR CHANGE

* MINOR CHANGE

* Added print statement to check print

* Minor change

* Minor change

* Changed whenever config

* Minor change

* Completed reply by tweet feature

* Minor change

* Minor change

* Added gemfile.lock

* Update comment.rb

* Added gemfile.lock

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Add more relevant search results (publiclab#4848)

* add helper functions

* Modify controller to take extra results

* add dict file

* add  more objects

* refactor code and add tests

* cc fix

* change numbers to account for additions in fixtures

* fix tests

* remove unused include

* code quality fixes

* tab fix

* changing implementation ideas, removal of unnecessary code

* newline fix

* cc fix

* cc space inside brackets fix

* modify query to get rid of redundant words

* reduce word to root then tranform

* Change file name

* chore: update README.md (publiclab#4926)

Fixes task mentioned in issue publiclab#4749

* Bump cytoscape from 3.4.2 to 3.5.0 (publiclab#4929)

Bumps [cytoscape](https://github.com/cytoscape/cytoscape.js) from 3.4.2 to 3.5.0.
- [Release notes](https://github.com/cytoscape/cytoscape.js/releases)
- [Commits](cytoscape/cytoscape.js@v3.4.2...v3.5.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Tiny fix (publiclab#4933)

* Tiny fix

* Rubocop

* Update 20190301075323_add_first_tag_poster.rb

* updates (publiclab#4851)

* fix for wiki update (publiclab#4942)

* fixes, extend to title suggestions

* extended to atwho
  • Loading branch information
aashna27 authored and icarito committed Apr 9, 2019
1 parent c6d44e8 commit cca91ef
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ env:
jquery: true
node: true

parseOptions:
sourceType: module

# http://eslint.org/docs/rules/
rules:
# Possible Errors
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//
//= require jquery
//= require jquery_ujs
//= require debounce/index.js
//= require bootstrap/dist/js/bootstrap.min.js
//= require bootstrap-3-typeahead/bootstrap3-typeahead.min.js
//= require bootstrap-datepicker/dist/js/bootstrap-datepicker.js
Expand Down
8 changes: 4 additions & 4 deletions app/assets/javascripts/atwho_autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
at: "@",
delay: 400,
callbacks: {
remoteFilter: function(query, callback) {
remoteFilter: debounce(function(query, callback) {
$.getJSON("/api/srch/profiles?query=" + query + "&sort_by=recent&field=username", {}, function(data) {
if (data.hasOwnProperty('items') && data.items.length > 0) {
callback(data.items.map(function(i) { return i.doc_title }));
}
});
}
}, 200)
},
limit: 20
},
hashtags_config = {
at: "#",
delay: 400,
callbacks: {
remoteFilter: function(query, callback) {
remoteFilter: debounce(function(query, callback) {
if (query != ''){
$.post('/tag/suggested/' + query, {}, function(response) {
callback(response.map(function(tagnames){ return tagnames }));
});
}
}
}, 200)
},
limit: 20
},
Expand Down
5 changes: 2 additions & 3 deletions app/assets/javascripts/restful_typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ $(function() {
var typeahead = $(el).typeahead({
items: 10,
minLength: 3,
delay: 350,
showCategoryHeader: true,
autoSelect: false,
source: function (query, process) {
source: debounce(function (query, process) {
var encoded_query = encodeURIComponent(query);
var qryType = $(el).attr('qryType');
return $.getJSON('/api/srch/' + qryType + '?query=' + encoded_query, function (data) {
return process(data.items);
},'json');
},
}, 350),
highlighter: function (text, item) {
return item.doc_title;
},
Expand Down
4 changes: 2 additions & 2 deletions app/views/editor/rich.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@

titleModule: {
suggestRelated: true,
fetchRelated: function(show) {
fetchRelated: debounce(function(show) {
$.getJSON("/api/srch/notes?query=" + editor.titleModule.value(), function(response) {
/* API provides:
{"items":[{
Expand All @@ -353,7 +353,7 @@
show(formatted);
}
});
}
}, 350)
},

tagsModule: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"bootstrap-tokenfield": "^0.12.0",
"chart.js": "^2.7.0",
"cytoscape": "^3.5.0",
"debounce": "^1.2.0",
"file-saver": "^2.0.0",
"font-awesome": "^4.5.0",
"i18n-js": "^3.2.1",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.2-1.2.3.tgz#b0220c02de98617433b72851cf47de3df2cdbee9"
integrity sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=

debounce@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131"
integrity sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg==

[email protected]:
version "0.7.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39"
Expand Down

0 comments on commit cca91ef

Please sign in to comment.