Aspartame
Instructions:
- Add
gem 'aspartame'
to Gemfile and run bundle install. - Run
rails generate formtastic:install
to get the forms working properly. 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([:aspartame_remember_token])
end
Major Issue: I could not figure out how to get the gem to load gem dependencies and application controller/helper. This is definitely on the list of to-dos, but until then, install any uninstalled gems below via your app's Gemfile:
gem "jquery-rails"
gem 'bootstrap-sass'
gem 'formtastic'
gem 'formtastic-bootstrap'
gem 'will_paginate'
gem 'bcrypt-ruby'
gem 'sass-rails'
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem 'jquery-ui-rails'
gem 'coffee-rails'
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.