Git Product home page Git Product logo

aloha-rails's Introduction

Rails 3.2 Integration for Aloha Editor

The aloha-rails gem integrates the AlohaEditor editor with the Rails 3.2 asset pipeline.

Instructions

1. Add aloha-rails to your Gemfile

gem 'locomotive-aloha-rails', require: 'aloha-rails'

Then run bundle install.

2. Use AlohaEditor

Add to your application.js:

//= require aloha

and in your erb / haml /..etc layout

= stylesheet_link_tag 'aloha/css/aloha.css'

and use AlohaEditor in your view:

<script type="text/javascript">
    Aloha.ready( function() {

        // Make #content editable once Aloha is loaded and ready.
        Aloha.jQuery('#content').aloha();

    });
</script>

Credits

Sam Pohlenz for his tinymce-rails plugin as a blueprint.

Contact

Feel free to contact me at didier at nocoffee dot fr.

Copyright (c) 2013 NoCoffee

aloha-rails's People

Contributors

did avatar jwieringa avatar mariovisic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aloha-rails's Issues

Js console errors when using in Rails 3.2.16

Hello,

I'm attempting to use this gem for the first time. I added the line to my gemfile and did bundle install. I then added

//= require aloha

in my application.js file after my require of jquery and added the link to the stylesheets in my layout. This causes the following scripts to be loaded on the page:

<script src="/assets/aloha/preinit.js?body=1" type="text/javascript"></script>
<script src="/assets/aloha/lib/require.js?body=1" type="text/javascript"></script>
<script src="/assets/aloha/lib/aloha.js?body=1" type="text/javascript"></script>
<script src="/assets/aloha.js?body=1" type="text/javascript"></script>

The preinit attempts:

window.Aloha.settings.baseUrl = '/assets/aloha/lib/';

but throws: Cannot read property 'settings' of undefined

aloha.js itself then throws:

Uncaught TypeError: Object function (module, callback) {
return _require("", module, callback);
} has no method 'config'

any ideas?

Aloha not found

I followed the instructions on the README file and here's the error I get:

couldn't find file 'aloha'
  (in /root/app/assets/javascripts/application.js.erb:24)

I have bundled installed and restarted foreman already.

Unkown Aloha Component: could not find commonAncestorContainer

In view, I include some tag js for iframe:

<script src="/assets/locomotive/utils/aloha_settings.js?body=1" type="text/javascript" data-aloha-plugins="common/format,common/table,common/list,common/link,common/highlighteditables,common/block,common/undo,common/contenthandler,common/paste,common/commands,common/abbr,common/align,common/horizontalruler,custom/locomotive_media"></script>
<script src="/assets/aloha/preinit.js?body=1" type="text/javascript" data-aloha-plugins="common/format,common/table,common/list,common/link,common/highlighteditables,common/block,common/undo,common/contenthandler,common/paste,common/commands,common/abbr,common/align,common/horizontalruler,custom/locomotive_media"></script>
<script src="/assets/aloha/lib/aloha.js?body=1" type="text/javascript" data-aloha-plugins="common/format,common/table,common/list,common/link,common/highlighteditables,common/block,common/undo,common/contenthandler,common/paste,common/commands,common/abbr,common/align,common/horizontalruler,custom/locomotive_media"></script>
<script src="/assets/aloha.js?body=1" type="text/javascript" data-aloha-plugins="common/format,common/table,common/list,common/link,common/highlighteditables,common/block,common/undo,common/contenthandler,common/paste,common/commands,common/abbr,common/align,common/horizontalruler,custom/locomotive_media"></script>
<script src="/assets/locomotive/aloha.js?body=1" type="text/javascript" data-aloha-plugins="common/format,common/table,common/list,common/link,common/highlighteditables,common/block,common/undo,common/contenthandler,common/paste,common/commands,common/abbr,common/align,common/horizontalruler,custom/locomotive_media"></script>

<script type="text/javascript">
          Aloha.ready(function() {
            window.parent.application_view.set_page({"id":"51526eb07a03713982000006","_id":"51526eb07a03713982000006","created_at":"2013-03-27T10:59:44+07:00","updated_at":"2013-03-27T16:54:27+07:00","title":"Home page","slug":"index","fullpath":"index","handle":null,"published":true,"listed":true,"templatized":false,"templatized_from_parent":false,"redirect":false,"redirect_url":null,"cache_strategy":"none","response_type":"text\/html","template_changed":null,"editable_elements":[{"id":"515274537a03713982000009","_id":"515274537a03713982000009","created_at":null,"updated_at":null,"type":"EditableLongText","label":"tagline","slug":"tagline","block_name":"Default","block":null,"default_content":false,"default_attribute":null,"hint":"The tagline below the big title","priority":1,"disabled":false,"assignable":null,"from_parent":false,"content":"<p> Lorem ipsum (default content),,,,</p>"}],"localized_fullpaths":{"en":"index"}});

            Aloha.settings = {
              plugins: {
                format: {
                  config: ["b", "i", "sub", "sup", "p", "h1", "h2", "h3", "h4", "h5", "h6"]
                }
              }
            };
           Aloha.jQuery('.editable_div').aloha()
          });
</script>

When click to editable div, it not show toolbar editor, and each time type something, it will fire warning: Unkown Aloha Component: could not find commonAncestorContainer .And Can not using 'Backspace' and 'Delete'.

Extra plugin

Hi, any ideas to include the extra plugins repository?

Chrome detection

Jquery version detection in chrome changed, breaking the ability of aloha 0.23.2 to determine if it's a chrome browser. This is updated in the current version of Aloha (0.23.6). For that reason, I'm not going to issue a pull request on my forked hotfix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.