| 1 | package MojoMojo::Controller::Gallery; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 35 | ▶ | use parent 'Catalyst::Controller'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | =head1 NAME | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | MojoMojo::Controller::Gallery - Page gallery. | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | See L<MojoMojo> | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | Controller for page photo galleries. | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 METHODS | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head2 default | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | Private action to return a 404 not found page. | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub default : Private { | ||||||||||||||||||||||||||
|
Subroutine
default: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 29 | 0 | my ( $self, $c ) = @_; | |||||||||||||||||||||||||||
| 30 | 0 | $c->stash->{template} = 'message.tt'; | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | $c->stash->{message} ||= $c->loc('Photo not found'); | ||||||||||||||||||||||||||
|
Condition0%0/3
$c->stash->{"message"} ||= $c->loc("Photo not found")
MC/DC0%0/2
$c->stash->{"message"} ||= $c->loc("Photo not found")
$c->stash->{"message"}
$c->loc("Photo not found")
Truth table0%0/3
A ||= B
A= $c->stash->{"message"}B= $c->loc("Photo not found")
| |||||||||||||||||||||||||||||
| 32 | 0 | return ( $c->res->status(404) ); | |||||||||||||||||||||||||||
| 33 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =head2 gallery ( .gallery ) | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | Show a gallery page for the current node. | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =cut | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub gallery : Path { | ||||||||||||||||||||||||||
|
Subroutine
gallery: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 0 | my ( $self, $c, $page ) = @_; | |||||||||||||||||||||||||||
| 44 | 0 | $page--, $page++; # coerce to number; strings become 0 | |||||||||||||||||||||||||||
| 45 | 0 | $c->stash->{template} = 'gallery.tt'; | |||||||||||||||||||||||||||
| 46 | $c->stash->{pictures} = $c->model("DBIC::Photo")->search( | ||||||||||||||||||||||||||||
| 47 | { 'attachment.page' => $c->stash->{page}->id }, | ||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | page => $page || 1, | ||||||||||||||||||||||||||
|
Condition0%0/2
$page || 1
MC/DC0%0/1
$page || 1
$page
Truth table0%0/2
A
A= $page
| |||||||||||||||||||||||||||||
| 50 | join => [qw/attachment/], | ||||||||||||||||||||||||||||
| 51 | rows => 12, | ||||||||||||||||||||||||||||
| 52 | order_by => 'position' | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||
| 55 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =head2 by_tag ( .gallery/by_tag ) | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | Show a gallery by a given tag. Will also show photos in the | ||||||||||||||||||||||||||||
| 60 | descendants of the page with the given tag. | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =cut | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub by_tag : Local { | ||||||||||||||||||||||||||
|
Subroutine
by_tag: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | 0 | my ( $self, $c, $tag, $page ) = @_; | |||||||||||||||||||||||||||
| 66 | 0 | $page--, $page++; # coerce to number; strings become 0 | |||||||||||||||||||||||||||
| 67 | 0 | $tag = $c->model("DBIC::Tag")->search( tag => $tag )->next; | |||||||||||||||||||||||||||
| 68 | 0 | ▶ | if (not $tag) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 0 | $c->stash->{message} = $c->loc('Tag not found'); | |||||||||||||||||||||||||||
| 70 | 0 | $c->detach('default'); | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 0 | $c->stash->{template} = 'gallery.tt'; | |||||||||||||||||||||||||||
| 74 | 0 | $c->stash->{tag} = $tag->tag; | |||||||||||||||||||||||||||
| 75 | 0 | my $conditions = { 'tags.tag' => $tag->tag }; | |||||||||||||||||||||||||||
| 76 | $$conditions{'attachment.page'} = | ||||||||||||||||||||||||||||
| 77 | 0 | [ map { $_->id } ( $c->stash->{page}->descendants, $c->stash->{page} ) ] | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | unless length( $c->stash->{page}->path ) == 1; # root | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | $c->stash->{pictures} = $c->model("DBIC::Photo")->search( | ||||||||||||||||||||||||||
|
Condition0%0/2
$page || 1
MC/DC0%0/1
$page || 1
$page
Truth table0%0/2
A
A= $page
| |||||||||||||||||||||||||||||
| 80 | $conditions, | ||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | join => [qw/attachment tags/], | ||||||||||||||||||||||||||||
| 83 | page => $page || 1, | ||||||||||||||||||||||||||||
| 84 | rows => 12, | ||||||||||||||||||||||||||||
| 85 | order_by => 'taken DESC' | ||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||
| 88 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | =head2 photo ( .photo/<id> ) | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | Show a gallery photo page. | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =cut | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub photo : Global { | ||||||||||||||||||||||||||
|
Subroutine
photo: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 97 | 0 | my ( $self, $c, $photo ) = @_; | |||||||||||||||||||||||||||
| 98 | 0 | ▶ | $photo = $c->model("DBIC::Photo")->find($photo) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | or $c->detach('default'); | ||||||||||||||||||||||||||||
| 100 | 0 | $c->stash->{photo} = $photo; | |||||||||||||||||||||||||||
| 101 | 0 | $c->forward('inline_tags'); | |||||||||||||||||||||||||||
| 102 | 0 | $c->stash->{template} = 'gallery/photo.tt'; | |||||||||||||||||||||||||||
| 103 | 0 | $c->stash->{next} = $photo->next_sibling; | |||||||||||||||||||||||||||
| 104 | 0 | $c->stash->{prev} = $photo->previous_sibling; | |||||||||||||||||||||||||||
| 105 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =head2 ( /photo_by_tag/<id> ) | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | Show a picture in tag gallery. | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | =cut | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub photo_by_tag : Global { | ||||||||||||||||||||||||||
|
Subroutine
photo_by_tag: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | 0 | my ( $self, $c, $tag, $photo ) = @_; | |||||||||||||||||||||||||||
| 115 | 0 | ▶ | $photo = $c->model("DBIC::Photo")->find($photo) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | or $c->detach('default'); | ||||||||||||||||||||||||||||
| 117 | 0 | $c->stash->{photo} = $photo; | |||||||||||||||||||||||||||
| 118 | 0 | $c->stash->{tag} = $tag; | |||||||||||||||||||||||||||
| 119 | 0 | $c->forward('inline_tags'); | |||||||||||||||||||||||||||
| 120 | 0 | $c->stash->{template} = 'gallery/photo.tt'; | |||||||||||||||||||||||||||
| 121 | 0 | $c->stash->{next} = $photo->next_by_tag($tag); | |||||||||||||||||||||||||||
| 122 | 0 | $c->stash->{prev} = $photo->prev_by_tag($tag); | |||||||||||||||||||||||||||
| 123 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | =head2 submittag ( /gallery/submittag ) | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | Add a tag through form submit. | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =cut | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | sub submittag : Local { | ||||||||||||||||||||||||||
|
Subroutine
submittag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | 0 | my ( $self, $c, $photo ) = @_; | |||||||||||||||||||||||||||
| 133 | 0 | $c->forward( 'tag', [ $photo, $c->req->params->{tag} ] ); | |||||||||||||||||||||||||||
| 134 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | =head2 tag ( /.jsrpc/tag ) | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | Add a tag to a page. Forwards to | ||||||||||||||||||||||||||||
| 139 | L<< inline_tags|/inline_tags ( .gallery/tags ) >>. | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =cut | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub tag : Local { | ||||||||||||||||||||||||||
|
Subroutine
tag: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 144 | 0 | my ( $self, $c, $photo, $tagname ) = @_; | |||||||||||||||||||||||||||
| 145 | 0 | ($tagname) = $tagname =~ m/([\w\s]+)/; | |||||||||||||||||||||||||||
| 146 | 0 | foreach my $tag ( split m/\s/, $tagname ) { | |||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag and not $c->model("DBIC::Tag")->search("photo", $photo, "person", $c->user->obj->id, "tag", $tag)->next
MC/DC0%0/2
$tag and not $c->model("DBIC::Tag")->search("photo", $photo, "person", $c->user->obj->id, "tag", $tag)->next
$tag
not $c->model("DBIC::Tag")->search("photo", $photo, "person", $c->user->obj->id, "tag", $tag)->next
Truth table0%0/3
A and not(B)
A= $tagB= not $c->model("DBIC::Tag")->search("photo", $photo, "person", $c->user->obj->id, "tag", $tag)->next
| |||||||||||||||||||||||||||||
| 148 | $tag | ||||||||||||||||||||||||||||
| 149 | && !$c->model("DBIC::Tag")->search( | ||||||||||||||||||||||||||||
| 150 | photo => $photo, | ||||||||||||||||||||||||||||
| 151 | person => $c->user->obj->id, | ||||||||||||||||||||||||||||
| 152 | tag => $tag | ||||||||||||||||||||||||||||
| 153 | )->next() | ||||||||||||||||||||||||||||
| 154 | ) | ||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||
| 156 | 0 | ▶ | $c->model("DBIC::Tag")->create( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||
| 158 | photo => $photo, | ||||||||||||||||||||||||||||
| 159 | tag => $tag, | ||||||||||||||||||||||||||||
| 160 | person => $c->user->obj->id | ||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | ) if $photo; | ||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | 0 | $c->stash->{photo} = $photo; | |||||||||||||||||||||||||||
| 166 | 0 | $c->forward( 'inline_tags', [$tagname] ); | |||||||||||||||||||||||||||
| 167 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | =head2 untag ( .gallery/untag ) | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | Remove a tag from a page. Forwards to | ||||||||||||||||||||||||||||
| 172 | L<< inline_tags|/inline_tags ( .gallery/tags ) >>. | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =cut | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 0 | ▶ | sub untag : Local { | ||||||||||||||||||||||||||
|
Subroutine
untag: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 177 | 0 | my ( $self, $c, $photo, $tagname ) = @_; | |||||||||||||||||||||||||||
| 178 | 0 | my $tag = $c->model("DBIC::Tag")->search( | |||||||||||||||||||||||||||
| 179 | photo => $photo, | ||||||||||||||||||||||||||||
| 180 | person => $c->user->obj->id, | ||||||||||||||||||||||||||||
| 181 | tag => $tagname | ||||||||||||||||||||||||||||
| 182 | )->next(); | ||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $tag->delete() if $tag; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 0 | $c->stash->{photo} = $photo; | |||||||||||||||||||||||||||
| 185 | 0 | $c->forward( 'inline_tags', [$tagname] ); | |||||||||||||||||||||||||||
| 186 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =head2 inline_tags ( .gallery/tags ) | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | Make a list of the user's tags and popular tags, or just popular tags | ||||||||||||||||||||||||||||
| 191 | if no user is logged in. | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | =cut | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 0 | ▶ | sub inline_tags : Local { | ||||||||||||||||||||||||||
|
Subroutine
inline_tags: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 196 | 0 | my ( $self, $c, $highlight ) = @_; | |||||||||||||||||||||||||||
| 197 | 0 | $c->stash->{template} = 'gallery/tags.tt'; | |||||||||||||||||||||||||||
| 198 | 0 | $c->stash->{highlight} = $highlight; | |||||||||||||||||||||||||||
| 199 | 0 | ▶ | my $photo = $c->stash->{photo} || $c->req->params->{photo}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$c->stash->{'photo'} || $c->req->params->{'photo'}
MC/DC0%0/2
$c->stash->{'photo'} || $c->req->params->{'photo'}
$c->stash->{'photo'}
$c->req->params->{'photo'}
Truth table0%0/3
A || B
A= $c->stash->{'photo'}B= $c->req->params->{'photo'}
| |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $photo = $c->model("DBIC::Photo")->find($photo) unless ref $photo; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 0 | $c->stash->{photo} = $photo; | |||||||||||||||||||||||||||
| 202 | 0 | ▶ | if ( $c->user_exists ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | 0 | my @tags = $photo->others_tags( $c->user->obj->id ); | |||||||||||||||||||||||||||
| 204 | 0 | $c->stash->{others_tags} = [@tags]; | |||||||||||||||||||||||||||
| 205 | 0 | @tags = $photo->user_tags( $c->user->obj->id ); | |||||||||||||||||||||||||||
| 206 | 0 | $c->stash->{taglist} = ' ' . join( ' ', map { $_->tag } @tags ) . ' '; | |||||||||||||||||||||||||||
| 207 | 0 | $c->stash->{tags} = [@tags]; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | else { | ||||||||||||||||||||||||||||
| 210 | 0 | $c->stash->{others_tags} = [ $photo->others_tags(undef) ]; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | =head2 description ( .gallery/description ) | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | AJAX method for updating picture descriptions inline. | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | =cut | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | sub description : Local { | ||||||||||||||||||||||||||
|
Subroutine
description: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 221 | 0 | my ( $self, $c, $photo ) = @_; | |||||||||||||||||||||||||||
| 222 | 0 | ▶ | my $img = $c->model("DBIC::Photo")->find($photo) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | or $c->detach('default'); | ||||||||||||||||||||||||||||
| 224 | 0 | ▶ | if ( $c->req->param('update_value') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 225 | 0 | $img->description( $c->req->param('update_value') ); | |||||||||||||||||||||||||||
| 226 | 0 | $img->update; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 0 | $c->res->body( $img->description ); | |||||||||||||||||||||||||||
| 229 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | =head2 title ( .gallery/title ) | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | AJAX method for updating picture titles inline. | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | =cut | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub title : Local { | ||||||||||||||||||||||||||
|
Subroutine
title: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 238 | 0 | my ( $self, $c, $photo ) = @_; | |||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $img = $c->model("DBIC::Photo")->find($photo) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | or $c->detach('default'); | ||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ( $c->req->param('update_value') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 0 | $img->title( $c->req->param('update_value') ); | |||||||||||||||||||||||||||
| 243 | 0 | $img->update; | |||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 0 | $c->res->body( $img->title ); | |||||||||||||||||||||||||||
| 246 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub tags : Local { | ||||||||||||||||||||||||||
|
Subroutine
tags: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 249 | 0 | my ( $self, $c, $tag ) = @_; | |||||||||||||||||||||||||||
| 250 | 0 | $c->stash->{tags} = [ $c->model("DBIC::Tag")->by_photo ]; | |||||||||||||||||||||||||||
| 251 | 0 | my $cloud = HTML::TagCloud->new(); | |||||||||||||||||||||||||||
| 252 | 0 | foreach my $tag ( @{ $c->stash->{tags} } ) { | |||||||||||||||||||||||||||
| 253 | $cloud->add( | ||||||||||||||||||||||||||||
| 254 | $tag->tag, | ||||||||||||||||||||||||||||
| 255 | $c->req->base | ||||||||||||||||||||||||||||
| 256 | . $c->stash->{path} | ||||||||||||||||||||||||||||
| 257 | 0 | . '.gallery/by_tag/' | |||||||||||||||||||||||||||
| 258 | . $tag->tag . '/' | ||||||||||||||||||||||||||||
| 259 | . $tag->photo, | ||||||||||||||||||||||||||||
| 260 | $tag->refcount | ||||||||||||||||||||||||||||
| 261 | ); | ||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | 0 | $c->stash->{cloud} = $cloud; | |||||||||||||||||||||||||||
| 264 | 0 | $c->stash->{template} = 'gallery/cloud.tt'; | |||||||||||||||||||||||||||
| 265 | 35 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | Marcus Ramberg <mramberg@cpan.org> | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | This library is free software. You can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 274 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =cut | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 35 | 1; | |||||||||||||||||||||||||||