Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

kuraga/aloha-rails-improved

Repository files navigation

Aloha::Rails::Improved

Power your Rails app with the Aloha Editor!

TravisCI Build Status Gem Version Code Climate

Installation

Required Ruby version:

  • 1.9.3,
  • 2.0.0,
  • rbx-19mode,
  • jruby-19mode.

Required gems:

(you can use Rails 3.0, 3.1, 3.2 or 4.0 to require this).

Add this line to your application's Gemfile:

gem 'aloha-rails-improved', require: 'aloha/rails'

Or, if you want to be on the edge:

gem 'aloha-rails-improved', require: 'aloha/rails', git: 'https://github.com/kuraga/aloha-rails-improved.git', branch: 'develop'

Basic Usage

Just make quick steps to start using Aloha Editor in your Rails app!

  1. Generate your Aloha Editor config:

    rails generate aloha:install
  2. Load Aloha Editor from your layout:

    <%= javascript_include_tag 'aloha-config' %>
    <%= aloha_dependencies_cdn %>
    <%= aloha_require_cdn %>
  3. Then write javascript to start edit a textarea:

    $('#some-textarea').aloha();

Enjoy!

Custom Usage

You should make these things to start using Aloha Editor in your app:

  1. Generate your Aloha Editor config: rails generate aloha:install. Use --coffee option to use CoffeeScript for js-config file.

  2. Load Aloha Editor config file.

    • insert this in your layout: <%= javascript_include_tag 'aloha-config' %>
    • or require it in your asset: //= require 'aloha-config'
  3. Load dependencies (only RequireJS library is required now).

    • to load them all using Aloha Editor CDN, just write this in your layout: <%= aloha_dependencies_cdn %>;
    • or you can load a single dependency only via CDN, i.e. <%= aloha_requirejs_cdn %>;
    • or load them manually in your own manner..., then see Aloha Editor's website to choose required dependencies' versions.
  4. Load Aloha Editor:

    • to load it via CDN asynchronously using RequireJS, write in your layout: <%= aloha_require_cdn %>;
    • to load it via CDN but without RequireJS, write in your layout (you should not load RequireJS library above): <%= aloha_cdn %>;
    • to load it from local server using RequireJS, run rake aloha:update and write in your layout: <%= aloha_require_local %>;
    • to load it from local server but without RequireJS, run rake aloha:update and write in your layout (you should not load RequireJS library above): <%= aloha_local %>;
  5. Then write javascript to start edit a textarea: $('#some-textarea').aloha();.

Enjoy too!

Additional information

See code (and tests) for aditional information.

Testing

Run rake spec to test. See tests in spec/ directory. You should use Rake 10+ and RSpec 2.12 to test.

Inspired by

See Also

Bugs List

ToDo List

  • Generator tests.
  • Asset pipeline integration.
  • Automatically checking of the latest Aloha Editor's version.
  • Hooks (i.e. Aloha.onReady).
  • Plugins and their config.
  • Make Travis, Badges, etc.

Bugs and Feedback

Follow to Github.

Contributing

We encourage you to contribute! Join us on Github!

Note: Master branch has a latest stable version of Aloha::Rails::Improved. Recent changes are in develop branch.

License

Aloha::Rails::Improved is released under the MIT License.

© 2013 Kurakin Alexander ([email protected]).

https://github.com/kuraga/aloha-rails-improved