You should re-run rails generator chaltron:install
to keep all updated.
Sometimes it's easier to manually follow the generator, to update what is needed. Don't forget to add the last migration!
class AddEnabledToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :enabled, :boolean, default: true
end
end
Just update your bundle
Add the following gems before chaltron
gem 'devise'
gem 'omniauth'
gem 'omniauth-rails_csrf_protection'
gem 'gitlab_omniauth-ldap'
gem 'cancancan'
gem 'bootstrap'
gem 'autoprefixer-rails'
gem 'font-awesome-sass'
gem 'jquery-rails'
gem 'jquery-datatables'
gem 'ajax-datatables-rails'
gem 'bootstrap_form'
gem 'nprogress-rails'
gem 'simple-navigation'
gem 'rails-i18n'
Note that chaltron
gem must be declared after devise
, because both of them change the view paths
Add the following dependencies, replacing //= require chaltron
//= require jquery
//= require popper
//= require bootstrap
//= require datatables/jquery.dataTables
//= require datatables/dataTables.bootstrap4
//= require datatables/extensions/Responsive/dataTables.responsive
//= require datatables/extensions/Responsive/responsive.bootstrap4
//= require nprogress
//= require nprogress-turbolinks
//= require nprogress-ajax
//= require chaltron
And (at the bottom)
document.addEventListener('DOMContentLoaded', function(event) {
Chaltron.locale = $('body').data('locale');
});
NProgress.configure({
showSpinner: false,
});
Copy chaltron_custom.scss and datatables.scss into app/assets/stylesheets/
In app/views/layouts/application.html.erb
add the following data field to your body
<%= content_tag :body, data: { locale: I18n.locale } do %>
...
<% end %>
Remove app/assets/javascripts/localization.js
(or any other reference to Chaltron.prototype.lang
)
The current language is now retrieved with
Chaltron.locale
Remove any reference to Chaltron.locales
DataTables
objects are localized with the following options
language: Chaltron.translate('datatables')