Installation
To install the gem, put this in your environment file:
config.gem 'wysihat-engine', :source => 'http://gemcutter.org'
Install and vendor the gem:
rake gems:install
rake gems:unpack
After installing, run the generator to copy the required files to your application:
script/generate wysihat
And migrate your database:
rake db:migrate
Including the javascript & stylesheets
Now you have to add some javascript and stylesheet includes in your layouts file.
WysiHat Engine comes with a minfied and concatenated file called wysihat_engine_pack.js (it includes the wysihat, facebox and wysihat_engine javascript libraries) and two stylesheets (facebox.css and wysihat.css). Include those — together with the rails :default set — in your layouts file:
<%= javascript_include_tag :defaults, 'wysihat_engine_pack' %>
<%= stylesheet_link_tag 'facebox', 'wysihat' %>
Using the editor
After installing, you can use the wysihat_editor form field in your forms, like this:
<% form_for(@page) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :content %><br />
<%= f.wysihat_editor :content %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
“Mmmm! Convenience.” – Jim Hoskins (Ruby5 episode 23)
Want to know more about using the editor? Check out the examples page!
