Hello,
I want to add to the admin subsite index a block button at the index
but nomatter what I try I get an error of some sort.

This is what I've added to the user lifecycle

    state :blocked

and after auto generated transitions

        transition :block, { :inactive => :blocked }, :available_to
=> :all,
                   :params => [:given_id]
        transition :block, { :active => :blocked }, :available_to
=> :all,
                   :params => [:given_id ]
        transition :unblock, { :blocked => :inactive }, :available_to
=> :all,
                   :params => [:given_id]

to the users controller under admin



  def block(given_id)

    user = User.where(:id=>given_id)
    user.state = 'blocked'
    flash[:now] ="TEST"
  end

  def unblock(given_id)
    user = User.where(:id=>given_id)
    user.state = 'inactive'
  end
end

finally the view

  <collection:>
   <a><name/></a><%=this.state%><%if this.state=='blocked'%>
<transition-button transition="unblock"
params="&{:given_id=>this.id}" />  <%else%>  <transition-button
transition="block"/>  <%end%>
   </collection:>

The goal:

Ability for the admin and him alone to block/unblock users using the
above buttons

The problems

At this point I click the button and I get a redirect but nothing
happens as if nothing ran.

If i remove the params from the transitions I get a no route matches
admin/users error and with the current setup that happens when I use
the user switcher to switch to a user without admin permission (as if
it wanted to block the acting user aka admin?! )

I know this is screwed up bad and Iknow I need to pass a param of the
user id to the transition and set state to "blocked" on a user with
this id I just dunno how exactly.

Also I've modified the user controller in the admin dir to class
Admin::UsersController < Admin::AdminSiteController as the auto
generated one inherited from application controller and that allowed
non admin users in to parts of the subsite.

Btw. On this collection I've lost the nice default hobo formatting and
now I've got a bare link and a system-themed button. How do I bring
back the nice index look ?

Lifecycles where always magical to me. Yes, I read the lifecycle
section in beta 6 book till my eyes bled. Any and all help is much
appreciated. Thanks in advance.

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