On Sun, Sep 30, 2012 at 04:45:25AM -0700, laurent wrote:
>
> Thanks you John for your fast answer.
>
> ":method => :post" don't change the situation : The url argument and method
> option for the form_for in rails are use for a
> <input type="submit" /> button
> The button create by FluoEditor with the "createButton" function are a
> link, and not use the url argument of the form_for :
>
> function createButton (rfeClass, tooltip, callback) {
> var i = document.createElement('a');
> ….
Hello again,
seriously, I have trouble following you, please try to explain things in a
clearer way.
Of course FluoEditor is not using "form_for", because it's a JavaScript
library, not a Ruby on Rails plugin. It knows nothing of Ruby, it's all
running client side.
And if you look at the code of createButton
https://github.com/jmettraux/ruote-fluo/blob/1cb8314cbdb4b4b69e87bba7f00804c888ee52ce/js/ruote-fluo-editor.js#L54-63
---8<---
function createButton(rfeClass, tooltip, callback) {
var i = document.createElement('a');
i.callback = callback;
i.className = 'rfe_button ' + rfeClass;
i.setAttribute('href', '');
i.setAttribute('title', tooltip);
i.setAttribute('onclick', 'this.callback(); return false;');
return i;
}
--->8---
You can see that, despite being a link, it sports a "return false" in its
"onclick" so that the link will not be followed. It only triggers the
callback.
But I can't understand why you're bringing "form_for" to the discussion
table.
> For the ruote vs FluoEditor question : Thanks you to answer, even if it's
> not a Ruote problem.
> By the way, did you know if there is a group of discussion for FluoEditor ?
According to the README:
https://github.com/jmettraux/ruote-fluo
this very group here is the right place.
> For the HTML source : I don't' see the button of class 'rfe_button ' in
> the html source.
It's generated from JavaScript, the DOM is manipulated from the JavaScript
code of ruote-fluo / ruote-fluo-editor.
> For the log console : In rails, if you have perform an Ajax request, you
> will have on the log "as JS" and not "as HTML"
>
> Processing by StudyPlansController#edit as HTML
>
> vs
>
> Processing by StudyPlansController#edit as JS
So why not "as AJAX"?
> I will look at the rails form helper page you give me, but I would like to
> try to add in the "<a ref … " button created by "createButton"
> an argument like data-remote="true"
> (the same argument if you use the helper "link_to, ….., :remote=> true"
>
> If I manually add in the "ruote-fluo-editor.js" in the "createButton"
> function the line :
>
> i.setAttribute('data-remote','true')
>
> Then, it's work. I have in my log console :
>
> Processing by StudyPlansController#edit as JS
>
> But I have to change the code of "ruote-kit", that I would like to avoid.
I don't understand. This createButton function is only used inside of the
fluo-editor, it's used for the cut/moveup/movedown/paste buttons, nothing to
do with posting back process definitions.
I do not want to modify the library because someone is mis-using it.
Those buttons should not interfere with any form.
Very confusing, very fuzzy picture. Best regards,
--
John Mettraux - http://lambda.io/jmettraux
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en