On July 13, 2010 06:59:48 pm Bart Bunting wrote:
> Hi,
> 
> I am new to Hobo and so far it is ausom.  I'm struggling with a few
> things, hopefully they are easy if someone can give me a pointer or two.
> 
> I am writing an application for our on call staff.
> 
> There is a shift model that contains information for who is on a shift
> for a given day, one shift per day.
> 
> I have the index action of the shifts model showing a table using
> table+.
> 
> This is working very well.  I now want to change it so that when someone
> initially visits the index it shows shifts from the current date
> onwards.  I can do this by using a find on the shifts model and assign
> to the @shifts collection.  This works but only shows the shifts from
> that point on.  What I am trying to do is have the index show the shifts
> for the current day forward when initially visited but allow paging back
> to previous shifts.
> 
> Any ideas?
> 

A couple of possibilities:
You could use a different action for the different uses (see 
http://cookbook.hobocentral.net/manual/controllers#index_actions)
You could use pagination and start from a specific record.  I don't know the 
exact details, but take a look at  
http://cookbook.hobocentral.net/manual/controllers#id64

> The other thing I'm struggling with is when a shift is created I want to
> return to the index page not display the shift.  

Presuming you never want to display the shift by itself, in the shifts 
controller, replace:
auto_actions :all
with:
auto_actions :all, :except => :show
Otherwise, take a look at Hobo's "Automatic Redirection" features:
http://cookbook.hobocentral.net/manual/controllers#automatic_redirection

> Even better would be to
> be able to inline create shifts where there is no shift already
> existing, shifts are just a date, and two user dropdowns, primary and
> secondary.
> 

Take a look at the Agility Tutorial:
http://cookbook.hobocentral.net/tutorials/agility#auto-actions-for-story
Basically, in the controller, you want to replace the
auto_actions :all
with:
auto_actions :all, :except => :new
or, combining with a previous recommendation:
auto_actions :all, :except => [:create, :new]


Regards,
Henry

> Any advice would be appreciated.
> 
> TIA
> 
> Bart

-- 
Henry Baragar
Instantiated Software
416-907-8454 x42

-- 
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.

Reply via email to