Interesting, thanks Adam - I've been meaning to have a look at angular.
This is the kind of thing I've been doing in backbone ->
https://gist.github.com/4124680 . Any thoughts?
Adam Boas wrote:
The real nub is defining what 'better' would mean.
Simplest? Most Re-usable? Easiest to maintain? Least amount of effort?
Its always going to be a trade off. And the 'best' approach is going
to be more to do with where you app is already at, what the skill set
is of the developers, and where the app is going in terms of features
and functionality.
I tend to lean toward the simplest solution I can manage, particularly
on pre-existing, large apps. If you already have controllers shipping
HTML there is nothing wrong with leveraging that and sprinkling a
little AJAX pixie dust to make the app seem more responsive. To me the
only absolute is to keep the pixie dust out of the templates and make
it clean and readable.
I personally really like Backbone for building an app with significant
rich client behaviour, but would never introduce it to an existing
full page post application just to get a little bit of responsive
behaviour in some forms. It introduces significant complexity that
just doesn't make any sense for the kind of thing you have mentioned.
And if you are not routing or changing views, and have no significant
model(s) it really adds very little value.
Angular is a framework I have been playing with a bit recently and it
does seem to offer a nice, lighter weight alternative to just writing
Jquery plugins for this kind of thing. Its binding behaviour can make
responding to your posts nice and simple. I can definitely recommend
having a bit of a look at if as an alternative, particularly if you
want to play with the new shiny :-)
Adam Boas
e: adam.b...@gmail.com <mailto:adam.b...@gmail.com>
m: +61 457 741 117
On 21/11/2012, at 8:41 PM, Michael Pearson <mipear...@gmail.com
<mailto:mipear...@gmail.com>> wrote:
On Wed, Nov 21, 2012 at 8:10 PM, Adam Boas <adam.b...@gmail.com
<mailto:adam.b...@gmail.com>> wrote:
Hi Michael,
The bad news is that link_to_remote still exists. It has just
changed syntax: link_to(…, remote: true)
This functionality would be trivial to write in JS or Coffee to
attach to the button and form and post it via ajax. I definitely
wouldn't inline it in the link_to though. Write a JQuery plugin
and attach it in dom-ready. I would probably write it fairly
generically, since this form/button/ response HTML/text pattern
is pretty common.
You'll see I'm already using the new :remote => true syntax in my
example, which handles part of the problem.
You're right in that re-implementing the lost behaviour would be
fairly trivial - but I'm wondering whether there's a better way to do it?
Returning HTML & text snippets from actions never quite felt right to
me, even if it was fairly easy.
I'm wondering whether we should be looking at something more
sophisticated. I'm worried that by re-implementing the old RJS
helpers using UJS will close us off from better designs for the way
our smattering of client side JS interacts with our Rails app.
--
Michael Pearson
--
You received this message because you are subscribed to the Google
Groups "Ruby or Rails Oceania" group.
To post to this group, send email to rails-oceania@googlegroups.com
<mailto:rails-oceania@googlegroups.com>.
To unsubscribe from this group, send email to
rails-oceania+unsubscr...@googlegroups.com
<mailto:rails-oceania+unsubscr...@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Ruby or Rails Oceania" group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.
--
You received this message because you are subscribed to the Google Groups "Ruby or
Rails Oceania" group.
To post to this group, send email to rails-oceania@googlegroups.com.
To unsubscribe from this group, send email to
rails-oceania+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.