On Jul 15, 2013, at 7:37 AM, Fai Wong
<wongwf82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I''ve a sortable unordered list as follows. How do I use controller
to detect this element and get the contents to save each LI item into a row in
the database?
>
> <ul id="show-items" class="ui-sortable">
> <li id="todo-163"><span class="editable">1.
Good</span> <a href="#" style="display:
none;">X</a></li>
> <li id="todo-190"><span class="editable">2.
Better</span> <a href="#" style="display:
none;">X</a></li>
> <li id="todo-189"><span class="editable">3.
Best</span> <a href="#" style="display:
none;">X</a></li>
> </ul>
There is just so much here you''ve left us to guess at.
Even the question "how do I use a controller to detect this" is rather
odd. Controllers do not detect things in a web page, they respond to HTTP
requests.
Where did this list come from? How was it initially generated? Seeing
it''s apparently some kind of to-do list, is it something that is based
upon a javascript library or framework such as backbone, ember, angular, etc? If
the latter, those all have really great methods for interacting with a server
controller, but not from a presentation view such as this.
Indeed, going from an unordered list such as this, you must create a javascript
capability that can strip the content of that list, package things up in JSON,
and make a call from javascript to the server controller, things which the above
frameworks do for you already.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/8AAC1066-75FD-455E-B975-4F2916765761%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.