On Jueves, 13 de Mayo de 2010 02:12:49 Iñaki Baz Castillo escribió:
> 2010/5/13 Klaus Huber <[email protected]>:
> > Hi,
> >
> > this is my solution (edit and delete):
> > in frontends/default/views/_show.html.erb add this:
> > <%= link_to as_(:edit), { :action => 'edit'}, :class => 'cancel' %>
> > <%= link_to as_(:delete), { :action => 'delete', :method
> > => :delete}, :class => 'cancel' %>
>
> Nice. Would those links be visible even if their actions ("update" and
> "delete") are not enabled for the AS controller?

Yes, you should use skip_action_link and @record.authorized_for?

Also, put them in app/views/active_scaffold_overrides instead of monkey 
patching ActiveScaffold views:
#app/views/active_scaffold_overrides/_show.html.erb
<%= render :super %>
<%
        edit_link = active_scaffold_config.action_links[:edit]
        delete_link = active_scaffold_config.action_links[:delete]
-%>
<%= render_action_link(edit_link, {:id => @record.id}, @record) if 
!skip_action_link(edit_link) && record.authorized_for?(:crud_type => 
edit_link.crud_type, :action => edit_link.action) %>
<%= render_action_link(delete_link, {:id => @record.id}, @record) if 
!skip_action_link(delete_link) && record.authorized_for?(:crud_type => 
delete_link.crud_type, :action => delete_link.action) %>

>
>
> --
> Iñaki Baz Castillo
> <[email protected]>

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to