return $c->uri_for( $id . '', $self->can_write($c) ? 'edit' :
'view' );
I'm not exactly sure how this is supposed to be behaving, but it got
my attention because when hitting the "list" action on a table with
just one row, that single record appears in edit mode, rather than
view mode, even though view mode would seem to be the more appropriate
option for someone who wanted a list.
I would try to mess with it myself, but I can see there's more going
on here than I understand. (Something to do with overriding can_write
() is my guess)
Adam Mackler
On Jan 24, 1:51 pm, mackler <adammack...@gmail.com> wrote:
> The last line of subroutine uri_for_view_on_single_result in
> CXC::Controller reads:
>
> return $c->uri_for( $id . '', $self->can_write($c) ? 'edit' :
> 'view' );
>
> I'm not exactly sure how this is supposed to be behaving, but it got
> my attention because when hitting the "list" action on a table with
> just one row, that single record appears in edit mode, rather than
> view mode, even though view mode would seem to be the more appropriate
> option for someone who wanted a list.
>
This sounds like a usability issue, where you were expecting 'list' is
analogous
to 'view' rather than 'edit'.
In my apps, I like to save clicks, so if I have the authz to edit
something, I
want to start in that mode, rather than have to explicitly select it.
But this
is a contentious issue, as IIRC my co-workers and I went back and
forth over
this very issue.
I think the inconsistency is with the behavior in 'list' mode, where
if you
click on a row it takes you to the 'view' action. We should be
consistent, and
make the behavior configurable.
I'll work on this.
Another way I look at it is that if we know a user is interested in a
particular record, we can be 100% certain that they want to read the
data, but we're not completely certain they want to change it. A view
page will meet all users' needs (that is, seeing the content of the
record), with the downside being an extra click for those who want to
both view and make changes to that content.
Of course this is the same trade-off that anyone trying to implement
data security in an office confronts...the easier it is to do what you
want, the easier it is to make damaging mistakes. And, correlatively,
protecting the users from themselves slows down work. Reasonable
people can disagree on where exactly the right balance is (so
configure it to your personal liking), but wherever it is, consistency
in whether you get either a view page or an edit page regardless of
whether you have one or more than one record in a table is better than
inconsistency.
Adam
CatalystX::CRUD 0.49 changes this to always return 'view'.
--
Peter Karman . http://peknet.com/ . pe...@peknet.com