[Jifty-commit] r3690 - in jifty/trunk: . lib/Jifty/View/Declare
t/TestApp/lib/TestApp
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sat Jul 14 00:02:24 EDT 2007
Author: jesse
Date: Sat Jul 14 00:02:23 2007
New Revision: 3690
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/SiteNews/View/News.pm
jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
jifty/trunk/t/TestApp/lib/TestApp/View.pm
Log:
r60638 at pinglin: jesse | 2007-07-13 22:07:04 -0400
* Fixed CRUD view to no longer require you to specify a base_path for the plugin's view. It was redundant and we could intuit it.
Modified: jifty/trunk/lib/Jifty/Plugin/SiteNews/View/News.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SiteNews/View/News.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/SiteNews/View/News.pm Sat Jul 14 00:02:23 2007
@@ -25,15 +25,6 @@
sub object_type { 'News' }
-=head2 fragment_base_path
-
-/news
-
-=cut
-
-sub fragment_base_path {'/news'}
-
-
template search_region => sub {''};
template 'index.html' => page {
@@ -41,7 +32,7 @@
form {
render_region(
name => 'newslist',
- path => '/news/list');
+ path => 'list');
}
};
Modified: jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/CRUD.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/CRUD.pm Sat Jul 14 00:02:23 2007
@@ -35,7 +35,6 @@
eval qq{package $caller;
alias $vclass under '$path'; 1} or die $@;
no strict 'refs';
- *{$vclass."::fragment_base_path"} = sub { "/$path" };
*{$vclass."::object_type"} = sub { $model };
}
@@ -72,7 +71,10 @@
sub fragment_base_path {
my $self = shift;
- return $self->package_variable('base_path') || '/crud';
+ my @parts = split('/', current_template());
+ pop @parts;
+ my $path = join('/', @parts);
+ return $path;
}
=head2 _get_record $id
@@ -320,9 +322,8 @@
sub _current_collection {
my $self =shift;
my ( $page, $search_collection ) = get(qw(page search_collection));
-
my $collection_class = Jifty->app_class( "Model", $self->object_type . "Collection" );
- my $search = $search_collection || Jifty->web->response->result('search');
+ my $search = $search_collection || Jifty->web->response->result('search') ? Jifty->web->response->result('search')->content('search') : undef;
my $collection;
if ( $search ) {
$collection = $search;
Modified: jifty/trunk/t/TestApp/lib/TestApp/View.pm
==============================================================================
--- jifty/trunk/t/TestApp/lib/TestApp/View.pm (original)
+++ jifty/trunk/t/TestApp/lib/TestApp/View.pm Sat Jul 14 00:02:23 2007
@@ -54,7 +54,7 @@
if ($model =~ /^.*::(.*?)$/) {
$bare_model = $1;
}
- alias Jifty::View::Declare::CRUD under '/crud/'.$bare_model, { object_type => $bare_model, base_path => '/crud/'.$bare_model };
+ alias Jifty::View::Declare::CRUD under '/crud/'.$bare_model, { object_type => $bare_model };
}
More information about the Jifty-commit
mailing list