-
Notifications
You must be signed in to change notification settings - Fork 109
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
Rails5 ajax fixes #2570
Rails5 ajax fixes #2570
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. It's quite a lot of change in how we handle the AJAX specially.
@raycarrick-ed @xsrust lets hold off on this one. I'm going to play around some more with it to see if starting rails ujs in the |
ok @raycarrick-ed and @xsrust I think I may have stumbled upon the puma hanging issue. I noticed that it was trying to load the JSON file for the ResearchProjectsController which uses the Rails cache and the Thread library. When I commented out the 'Thread' bit things started puma stopped hanging. That JSON load may be a good candidate for ActionCable's web-socket functionality. Something to investigate down the road I guess. This PR should be good to go. Note that I enabled Turbolinks. I think now that we have a handle on the Ajax UJS issue that we can enable it again. I went through more of the pages and fixed up the ajax. Note the checkboxes on the Plans page and Users page which were previously checkboxes wrapped inside a form. This are now just 'remote' checkboxes and I had to add |
ok some final commits on this one @raycarrick-ed and @xsrust. I fixed up all of the tests broken by adding the I had to re-disable turbolinks in the application.js |
@@ -45,6 +45,7 @@ def set_gettext_locale | |||
|
|||
def current_locale | |||
session[:locale] || FastGettext.default_locale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch to ||=
@@ -4,6 +4,8 @@ class OrgsController < ApplicationController | |||
|
|||
include OrgSelectable | |||
|
|||
skip_before_action :verify_authenticity_token, only: %w[search] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch to pass auth token
@@ -31,7 +31,8 @@ def funder_type | |||
|
|||
def fetch_projects | |||
Rails.cache.fetch(["research_projects", funder_type], expires_in: expiry) do | |||
Thread.new { ExternalApis::OpenAireService.search(funder: funder_type) }.value | |||
#Thread.new { ExternalApis::OpenAireService.search(funder: funder_type) }.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create ticket to investigate this
application.js
to share Rails UJS with our custom JS and JS.ERB files@raycarrick-ed note that in order for a scenario where we were programmatically calling
.submit
for a form, we now should useRails.fire(form[0], 'submit');
(whereform
is the JQuery element). I found this fix in this article: https://stackoverflow.com/questions/12683524/with-rails-ujs-how-to-submit-a-remote-form-from-a-function