Changeset 19
- Timestamp:
- 02/10/07 00:54:00 (2 years ago)
- Files:
-
- trunk/Memories/Photo.pm (modified) (3 diffs)
- trunk/templates/macros (modified) (1 diff)
- trunk/templates/photo/paged (moved) (moved from trunk/templates/photo/recent) (1 diff)
- trunk/templates/rhs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Memories/Photo.pm
r15 r19 15 15 LIMIT 4 16 16 }); 17 __PACKAGE__->set_sql(popular => q{ 18 SELECT __ESSENTIAL__ 19 FROM __TABLE__ 20 ORDER BY hit_count DESC 21 LIMIT 4 22 }); 17 23 18 24 __PACKAGE__->has_many(comments => "Memories::Comment"); … … 119 125 use Class::DBI::Plugin::AbstractCount; 120 126 121 sub recent :Exported {122 my ($self, $r ) = @_;127 sub view_paged_ordered { 128 my ($self, $r, $how) = @_; 123 129 my $page = $r->params->{page} || 1; 124 130 my $pager = $self->pager( … … 126 132 page => $page, 127 133 syntax => PAGER_SYNTAX, 128 order_by => "uploaded desc"134 order_by => $how 129 135 ); 130 136 $r->objects([$pager->retrieve_all ]); 131 137 $r->{template_args}{pager} = $pager; 132 138 $r->last_search; 139 $r->template("paged"); # Set the what using the action name 140 } 141 142 sub recent :Exported { 143 my ($self, $r) = @_; 144 $self->view_paged_ordered($r, "uploaded desc"); 145 } 146 147 sub popular :Exported { 148 my ($self, $r) = @_; 149 $self->view_paged_ordered($r, "hit_count desc"); 133 150 } 134 151 trunk/templates/macros
r18 r19 30 30 <br/> 31 31 [% IF r > 0 OR photo.hit_count > 0 %] 32 [% photo.hit_count %] views 33 [% IF r > 0 %] <br> [% ministar(r, photo) %] in [%photo.rated %] ratings [% END %] 32 [% photo.hit_count %] view[%IF photo.hit_count>1%]s[% END %] 33 [% IF r > 0 %] <br> [% ministar(r, photo) %] in [%photo.rated %] 34 rating[%IF photo.rated > 1%]s[%END%] [% END %] 34 35 [% END %] 35 36 </td></tr> trunk/templates/photo/paged
r2 r19 1 1 [% INCLUDE header %] 2 2 [% PROCESS macros %] 3 <h1> Recentphotos </h1>3 <h1> Most [% request.action %] photos </h1> 4 4 <table class="userlist"> 5 5 [% WHILE photos.size > 0 %] trunk/templates/rhs
r2 r19 16 16 <tr> 17 17 <td><a href="[%base%]/photo/recent">Recently uploaded</a></td> 18 </tr> 19 <tr> 20 <td><a href="[%base%]/photo/popular">Most popular</a></td> 18 21 </tr> 19 22 <tr>
