Aspartame
Instructions:
- Add
gem 'aspartame'
to gemfile and run bundle install. - Run
rails generate formtastic:install
to get the forms working properly afterward). Add to config/initializers/formtastic.rbFormtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
- Run
rake aspartame:install:migrations
and thenrake db:migrate
- Add
mount Aspartame::Engine => "/aspartame"
to main app’s routes.rb. - Add
*= require aspartame/aspartame
to main app’s application.css file. - Add
<%= render 'layouts/aspartame/aspartame_header' %>
at the top of the body of main app’s application.html.erb file. - Add
include Aspartame::ApplicationHelper
to your application_helper.rb. - Add the following to your application_controller.rb:
``` before_filter :aspartame_form_variables
def aspartame_form_variables
@aspartame_translation = Aspartame::AspartameTranslation.new
if request.fullpath.index('?')
@aspartame_url_string = request.fullpath.slice(0...(request.fullpath.index('?')))
else
@aspartame_url_string = request.fullpath
end
@aspartame_universal_translations = Aspartame::AspartameTranslation.where(:url => "UNIVERSAL", :language => params[:ln], :status => true)
@aspartame_translations = Aspartame::AspartameTranslation.where(:url => @aspartame_url_string, :language => params[:ln], :status => true)
@aspartame_user = Aspartame::AspartameUser.find_by_remember_token(cookies[:aspartame_remember_token])
end ```
RefineryCMS notes:
-
All instances of
main_app.root_path
must be replaced withrefinery.root_path
. For this reason, addgem 'aspartame-refinery'
instead to Gemfile. -
I had an issue with jQuery not being defined for $(document).ready calls. My problem was solved by moving the javascript inclusion in application.html.erb to the top of the body, above the _aspartame_header partial.