Skip to content

externalise jquery using jquery-rails-cdn and jquery-rails fallback #8161

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ gem 'lemmatizer', '~> 0.2.2'
gem 'mailman', require: false
# To implement fontawesome v4.7.0
gem "font-awesome-rails"
gem "lazyload-rails"
gem "lazyload-rails"
gem 'jquery-rails-cdn'

# To convert html to markdown
gem 'reverse_markdown'
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery-lazyload/jquery.lazyload.js
//= require debounce/index.js
//= require bootstrap/dist/js/bootstrap.bundle.min.js
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<%= jquery_include_tag :google, force: true %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<meta name="google-translate-customization" content="4ce4c7c384354172-5179499fc244f592-g2b333d0d29f59663-d" />
Expand Down
10 changes: 6 additions & 4 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ class Application < Rails::Application

# Enable the asset pipeline
config.assets.enabled = true

I18n.available_locales = [:en, :de, "zh-CN", :ar, :es, "hi-IN", :it, :ko, "pt-BR", :ru]
config.i18n.default_locale = :en
config.i18n.default_locale = :en

config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]

# rails will fallback to config.i18n.default_locale translation
config.i18n.fallbacks = true

# rails will fallback to en, no matter what is set as config.i18n.default_locale
config.i18n.fallbacks = [:en]

Expand All @@ -74,6 +74,8 @@ class Application < Rails::Application
config.paths.add File.join('app/api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app','api', '**', '*.rb')]

config.assets.precompile += ['jquery3.js']

# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.paths << Rails.root.join("public","lib")
Expand Down
1 change: 1 addition & 0 deletions config/initializers/jquery_cdn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jquery::Rails::Cdn.major_version = 3