Thanks Matt,
A simple solution in the end.
I save the filter parameters in the index action of the controller
with:
filter_parameters = request.parameters
filter_parameters.delete(:controller)
filter_parameters.delete(:action)
session[:filter_parameters] = filter_parameters
I delete the action and controller entries to keep it tidy.
In the nav-bar in my application.dryml I restore the parameters with
<nav-item with="&Survey" params="&session[:filter_parameters]"
if="¤t_user.signed_up?">
<ht key="surveys.nav_item">Surveys</ht>
</nav-item>
Works a treat! The user can set up their filters, wander off through
the system and then return to their last index view by simply clicking
on the appropriate navigation button.
This is probably going to be useful to others so I've written up a
recipe for it.
Dean
On Jul 8, 4:37 am, Matt Jones <[email protected]> wrote:
> On Wed, Jul 7, 2010 at 11:46 AM, Dean <[email protected]> wrote:
> > This feature has thwarted my many attempts to implement it.
>
> > In my application I have a list of tasks at different progress states
> > and for different sites and assigned to different users. Users come
> > onto the system and work on all of the tasks in a particular state,
> > site or combination of both.
>
> > At the moment I have an index page with a <table-plus> listing of
> > tasks. Users use the filters to select the subset of tasks they wish
> > to work on. The problem is that working on each task takes the user
> > away from the index screen. When they have completed the task and
> > return to the index screen, their filter parameters have been reset
> > and they now need to reselect their subset of tasks they are working
> > on.
>
> > The users would like the filter parameters to remain in use in their
> > current session until they change them.
>
> I did something like this in an old PHP app - what I did was stash the
> filter parameters (actually, the whole query string) in the session
> and then add them back to the URL when linking / redirecting back to
> the index page. So a link that would normally go to '/some_models'
> instead was to '/some_models?search_param1=xxx&search_param2=xxx'.
>
> Probably not the most glamorous solution, but it did the job.
>
> --Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.