El 05/07/14 14:58, JezC escribió: > Hi Ignacio, and thanks for your continuing help. > > Hobo does have (did have?) a sortable table. Quite a nice one. Table > Plus - http://www.hobocentral.net/tagdef/hobo_rapid/plus/table-plus > and https://github.com/tablatom/hobo/wiki/table-plus > > The issue, I think, is that the code was written before all the changes > to scopes in Rails 3. If I understand the table-plus code properly, then > it is creating and using scopes that aren't chainable. That results in a > 'default_scoped=" error. > > Several things occur to me: > > Table-plus is not core hobo. It is being documented in the wiki, but it > is not maintained the way that the rest of the code is. Otherwise you'd > know of a sortable table mechanism, I'm sure :) > > Just as with the "what are the know working versions", it'd be really > helpful to know the last working versions when something was tested. > Saves a lot of time if you know that the last time something was known > to work, was Hobo 1.3/Rails 3.0 or whatever. When I know that, I start > thinking about the likelihood of it working, and how to track down > problems, in a different way (i.e. assuming that anything that got > revised in Ruby, or Rails, since that last known working instance, is > probably the cause f any problems). > > The old (1.3) cookbook, says that Hobo's migration generator knows about > "acts_as_list" - > see http://cookbook-1.3.hobocentral.net/tutorials/agility and search for > gitorial-038, where you'll see the comment: > > The migration generator knows about |acts_as_list|, so you can just > run it and you’ll get the new position column on Task. > > I can't see any reference to this (acts_as_list) feature being removed > in Hobo 2.0/2.1 - and I also couldn't see any evidence that a "position" > column was being automatically added, either. > > I think I'll try to solve this with my own variation of table-plus. > Table plus has some neato ideas. I really liked being able to create > tables that I could sort with trivial clicks, and use drag'n'drop > reordering. I'm actually trying to solve some other problems, and this > is a sideshow to the main event... If I don't get dragged off in some > other random direction, I'll see if I can't make a modern version of > Table Plus, using the ranked-model gem, and adapting that older code.
Ok, now I'm really puzzled :). Table Plus has the sorting functionality (click on a header, results are reordered), and it should work well with the latest Hobo 2.1. On the other hand, the "Drag & Drop reordering" feature, I think that's not part of Table Plus: see the list of features and the source code: http://www.hobocentral.net/tagdef/hobo_rapid/plus/table-plus. There is another tag that does have Drag&Drop support. It's called Sortable Collection (http://www.hobocentral.net/tagdef/hobo_jquery_ui/hobo_jquery_ui/sortable-collection). It does not look like a table though. > > I hadn't expected this task (sortable table) to be a major deal, as I'd > simply used it in Hobo 1.3 and thought it *was* part of core Hobo. So... > I'll add another card to my set of stories, and deal with this later. It > is an interface neatener and sweetener rather than a core need. > > That 3-model test app is currently on bitbucket > - [email protected]:jezchatfield/hobo3model.git and the branch where I'm > playing with table-plus is, erm, tableplus. :) Thanks for sharing the code. I have taken a quick look at it and I see that you have not modified the stuffs controller. You need to ask it to parse the sorting parameters that it gets passed in the request. Something similar to this section of the Agility tutorial: http://www.hobocentral.net/tutorials/agility#improve-the-project-page-with-a-searchable-sortable-table Warm regards, Ignacio > > Cheers, JeremyC. > > On Thursday, 3 July 2014 11:00:18 UTC+1, Ignacio Huerta wrote: > > Hi, > > El 03/07/14 08:48, JezC escribió: > > Context: Ruby 2.1.2, Rails 4.0.5, Hobo 2.1.0 > > > > I'm relearning hobo, after being away on other projects. So a mix of > > newbie questions and some hangovers from older ways to do things - > which > > might be the problem. > > > > I have a model Stuff that has Things as children. > > > > I want to show a table of Things associated with each Stuff. When > I show > > Stuff-1, I want to see all the Things for Stuff-1, sortable. By > default, > > the Things are listed in ascending order, as unique cards, rather > than > > as a table. > > > > In Hobo 1, I used table-plus, and acts-as-list (years ago) - > following > > the cookbooks & manual > > > > (http://www.hobocentral.net/tutorials/44-using-multiple-sortable-collection-s-for > > <http://www.hobocentral.net/tutorials/44-using-multiple-sortable-collection-s-for> > > > and > > > http://hobocentral.net/manual/controllers#writing-an-action-from-scratch > <http://hobocentral.net/manual/controllers#writing-an-action-from-scratch> > ). > > > > I believe Hobo doesn't have a table widget that is sortable. I think > the > recipe you referred > > (http://www.hobocentral.net/tutorials/44-using-multiple-sortable-collection-s-for > > <http://www.hobocentral.net/tutorials/44-using-multiple-sortable-collection-s-for>) > > is about having a sortable list of cards. But you can always style > it to > look like a table :). > > > In Hobo 2, Rails 4... I'm getting lots of issues. > > > > Acts-as-list is kinda old and has performance problems. Ranked-models > > looks like a better and more modern solution. > > > > Scoping has changed a lot for Rails 4. > > > > So... What is the right, modern way to create a sortable table of > > children in Hobo 2? The old recipe in the hobo cookbook, and > > consequently the Agility tutorial, seems to be terribly dated. I > have a > > suspicion that there's a better way cooked into Hobo 2, that I > can't find. > > > > I'll gleefully publish my simple 3-model hobo testing app > (hobo3model) > > for critique. It's designed for me to play with associations and > tables, > > and omniauth for multiple providers. So when it works, it might be > an up > > to date version of agility. ;) > > I didn't know about Ranked-models, thanks for sharing! In theory Hobo 2 > should work with acts as list pretty much as it used to, like the > Agility tutorial says. But it's possible something might be broken. > > Could you give us more info about your issues or share your repository? > I'll be happy to clone it and play with it a bit. > > Warm regards, > Ignacio > > > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Hobo Users" group. > > To unsubscribe from this group and stop receiving emails from it, > send > > an email to [email protected] <javascript:> > > <mailto:[email protected] <javascript:>>. > > To post to this group, send email to [email protected] > <javascript:> > > <mailto:[email protected] <javascript:>>. > > Visit this group at http://groups.google.com/group/hobousers > <http://groups.google.com/group/hobousers>. > > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > -- > You received this message because you are subscribed to the Google > Groups "Hobo Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/hobousers. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/hobousers. For more options, visit https://groups.google.com/d/optout.
