Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fetch elements more efficiently.

  • Loading branch information...
commit 5e94ba530f46e6d59aa28f04e6f85537daa1e19a 1 parent fe4bd14
Denny de la Haye authored
24 lib/ShinyCMS/Controller/Shop.pm
View
@@ -7,6 +7,17 @@ use namespace::autoclean;
BEGIN { extends 'ShinyCMS::Controller'; }
+=head1 NAME
+
+ShinyCMS::Controller::Shop
+
+=head1 DESCRIPTION
+
+Controller for ShinyCMS shop.
+
+=cut
+
+
has items_per_page => (
isa => Int,
is => 'ro',
@@ -20,19 +31,8 @@ has can_like => (
);
-=head1 NAME
-
-ShinyCMS::Controller::Shop
-
-=head1 DESCRIPTION
-
-Controller for ShinyCMS shop.
-
=head1 METHODS
-=cut
-
-
=head2 index
For now, forwards to the category list.
@@ -315,6 +315,7 @@ sub get_item : Chained( 'base' ) : PathPart( 'item' ) : CaptureArgs( 1 ) {
code => $item_id,
hidden => 'false',
});
+ $c->stash->{ item }->{ elements } = $c->stash->{ item }->get_elements;
}
else {
# numeric identifier
@@ -322,6 +323,7 @@ sub get_item : Chained( 'base' ) : PathPart( 'item' ) : CaptureArgs( 1 ) {
id => $item_id,
hidden => 'false',
});
+ $c->stash->{ item }->{ elements } = $c->stash->{ item }->get_elements;
}
unless ( $c->stash->{ item } ) {
4 lib/ShinyCMS/Schema/Result/ShopItem.pm
View
@@ -284,13 +284,13 @@ sub in_category {
}
-=head2 elements
+=head2 get_elements
Return a hash containing the associated elements
=cut
-sub elements {
+sub get_elements {
my( $self ) = @_;
my $elements = {};
Please sign in to comment.
Something went wrong with that request. Please try again.