ncri / hallo_rails Goto Github PK
View Code? Open in Web Editor NEWUse the Hallo editor to edit content in a Rails app.
License: MIT License
Use the Hallo editor to edit content in a Rails app.
License: MIT License
Hello,
I'm getting an error after HalloRails.ini();
TypeError: jQuery(...).data(...) is undefined @ http://localhost:3000/assets/application.js:28262
It happens in the line cleanup = ...
getContents: function() {
var cleanup, contentClone, plugin;
contentClone = this.element.clone();
for (plugin in this.options.plugins) {
cleanup = jQuery(this.element).data('IKS-' + plugin).cleanupContentClone;
if (!jQuery.isFunction(cleanup)) {
continue;
}
jQuery(this.element)[plugin]('cleanupContentClone', contentClone);
}
return contentClone.html();
},
HalloRails.init(); is called in $(document).ready, I added all requirements to the application.js and added the requirements to the stylesheets.
All I see is "Click to Edit" when I hover the elemens, but nothing happens.
I don't understand, whats the problem or what is missing here...
Hi,
after installing the gem, I received the error message of missing mixins border-radius and opacity.
I fixed this by adding
@mixin border-radius($radius:20px) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
border-radius: $radius;
}
@mixin opacity($value) {
opacity: $value;
}
before @import 'hallo_rails';
Also you could add a notice in your readme, that jQuery UI is used.
Otherwise theres a syntax error 'jquery.Widget is not a function'.
Greets
Hi,
Thanks for setting a version of hallo for rails. I was thinking of using the hallo.js version on my rails and found your gem.
I got 2 questions and was wondering if you can help me on it? Thanks. :- )
I might have miss out a step while implementing it. :- )
Here is just a basic call in my erb view:
<%= editable @current_user, :name, update_url: "my_own/url/to_update/the/model" %>
<%= form_editable @current_user, :name %>
<script>
jQuery(function() {
return HalloRails.init();
});
</script>
Error Logs:
=============================================================
Uncaught TypeError: Cannot read property 'cleanupContentClone' of undefined halo.js:191
jQuery.widget.getContents halo.js:191
(anonymous function) jquery-ui-1.9.2.custom.dark-hive.js:432
jQuery.widget._create halo.js:61
(anonymous function) jquery-ui-1.9.2.custom.dark-hive.js:432
$.Widget._createWidget jquery-ui-1.9.2.custom.dark-hive.js:597
$.(anonymous function).(anonymous function) jquery-ui-1.9.2.custom.dark-hive.js:396
(anonymous function) jquery-ui-1.9.2.custom.dark-hive.js:541
jQuery.extend.each jquery-7c8529c81142f97fe8e691cad80449a1.js:612
jQuery.fn.jQuery.each jquery-7c8529c81142f97fe8e691cad80449a1.js:242
$.fn.(anonymous function) jquery-ui-1.9.2.custom.dark-hive.js:536
(anonymous function) halo-rails.js:71
jQuery.extend.each jquery-7c8529c81142f97fe8e691cad80449a1.js:612
jQuery.fn.jQuery.each jquery-7c8529c81142f97fe8e691cad80449a1.js:242
attach_editors halo-rails.js:63
init halo-rails.js:18
(anonymous function)
fire jquery-7c8529c81142f97fe8e691cad80449a1.js:974
self.add jquery-7c8529c81142f97fe8e691cad80449a1.js:1017
jQuery.fn.jQuery.ready jquery-7c8529c81142f97fe8e691cad80449a1.js:247
jQuery.fn.jQuery.init jquery-7c8529c81142f97fe8e691cad80449a1.js:175
jQuery jquery-7c8529c81142f97fe8e691cad80449a1.js:45
(anonymous function)
(anonymous function) jquery-7c8529c81142f97fe8e691cad80449a1.js:565
jQuery.extend.globalEval jquery-7c8529c81142f97fe8e691cad80449a1.js:566
(anonymous function) jquery-7c8529c81142f97fe8e691cad80449a1.js:5806
=============================================================
http://createjs.org/demo/hallo/
I tried using bind but i could not figure out how to pass the data.content
up to the ajax jquery script to be send to my rails controller?
I'm a new bie so please bare with me if this is pretty simple to do :- )
jQuery('.description').bind('hallomodified', function(event, data) {
jQuery('#modified').html("Editables modified");
console.log("New contents are " + data.content);
}
<%= form_for(:article, :html => { :id =>"article-creation-form" },
:url => article_creation_configure_path(@current_user),
:remote => true ) do |f| %>
<%= f.text_field :title,
:id => 'title',
:placeholder => 'Customize your title.' %>
<%= f.text_area :descriptions,
:id => 'description',
:rows =>"3",
:placeholder => 'Customize your descriptions.' %>
<div class="create-article-button-container">
<%= f.submit t(:create_article), :class => "create-article-button" %>
<div id="article-result"></div>
</div>
<% end %>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.