Aloha::Rails::Improved
Power your Rails app with the Aloha Editor!
Installation
Required Ruby version:
- 1.9.3,
- 2.0.0,
- rbx-19mode,
- jruby-19mode.
Required gems:
- ActionPack 3.0, 3.1, 3.2 or 4.0.
- ActiveSupport 3.0, 3.1, 3.2 or 4.0,
(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!
-
Generate your Aloha Editor config:
rails generate aloha:install
-
Load Aloha Editor from your layout:
<%= javascript_include_tag 'aloha-config' %> <%= aloha_dependencies_cdn %> <%= aloha_require_cdn %>
-
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:
-
Generate your Aloha Editor config:
rails generate aloha:install
. Use--coffee
option to use CoffeeScript for js-config file. -
Load Aloha Editor config file.
- insert this in your layout:
<%= javascript_include_tag 'aloha-config' %>
-
or require it in your asset:
//= require 'aloha-config'
- insert this in your layout:
-
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.
-
to load them all using Aloha Editor CDN, just write this in your layout:
-
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 %>
;
-
to load it via CDN asynchronously using RequireJS, write in your layout:
-
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 (kuraga333@mail.ru).