so you want there to be transition links/buttons on the index page for
each card?
<extend tag="card" for="Site">
<old-card merge>
<append-body:>
<transition-buttons />
</append-body:>
</old-card>
</extend>
This should show all available transitions as buttons at the bottom of
the card. They'll be straight to the do_transition if there's no
params defined for the transition, otherwise will go to /
model_controller/transition_name page.
On Oct 6, 10:53 am, spokra <[email protected]> wrote:
> I'm attempting to us lifecycles for a page the displays site
> memberships for sale. Hobo auto gens the taglibs for the
> transition but I would think the index page should show the buttons.
> her eis the contents of my model, the controller has auto_actions :all
> in it.. Am I on the right track.. I've been following the tutorial
> but not getting very far.. :>
>
> class Site < ActiveRecord::Base
>
> hobo_model # Don't put anything above this
>
> fields do
> number :integer
> description :html
> price :decimal, :precision => 15, :scale => 2
> timestamps
> end
> belongs_to :user
>
> has_attached_file :photo, :styles => { :medium => "300x300>", :thumb
> => "100x100>" }
>
> # --- Permissions --- #
>
> def create_permitted?
> acting_user.administrator?
> end
>
> def update_permitted?
> acting_user.administrator?
> end
>
> def destroy_permitted?
> acting_user.administrator?
> end
>
> def view_permitted?(field)
> true
> end
> lifecycle do
> state :listed
> state :sold, :pending
> create :listing, :become => :listed, :available_to
> => :all
>
> transition :offer, { :listed
> => :pending }, :available_to => :all
> transition :denied, { :pending
> => :listed } , :available_to => :all
> transition :acceped, { :pending
> => :sold } , :available_to => :all
> transition :delete, { :sold
> => :destroy }, :available_to => :all
> transition :unlist, { :listed
> => :destroy }, :available_to => :all
> end
> end
--
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.