32 |
my $collection = $self->_current_collection(); |
my $collection = $self->_current_collection(); |
33 |
# XXX show just pictures from current unit |
# XXX show just pictures from current unit |
34 |
$collection->limit( column => 'unit', value => $unit ) if $unit; |
$collection->limit( column => 'unit', value => $unit ) if $unit; |
35 |
|
|
36 |
|
warn "## list page: $page unit: $unit fragment_for_new_picture: $fragment_for_new_picture item_path: $item_path"; |
37 |
|
|
38 |
div { |
div { |
39 |
{ class is 'pictures' }; |
{ class is 'pictures' }; |
40 |
|
|
64 |
moniker => "delete-" . Jifty->web->serial, |
moniker => "delete-" . Jifty->web->serial, |
65 |
); |
); |
66 |
|
|
67 |
warn "## id: $id unit $unit"; |
warn "## view id: $id unit $unit"; |
68 |
|
|
69 |
form { |
form { |
70 |
|
img { attr { src => "/static/pics/thumb/" . $record->thumbnail } } |
71 |
|
tt { $record->filename } |
72 |
|
span { $record->type->name }; |
73 |
|
|
74 |
if ( $record->current_user_can('delete') && $self->current_user->editing ) { |
if ( $record->current_user_can('delete') && $self->current_user->editing ) { |
75 |
outs_raw( $delete->button( |
outs_raw( $delete->button( |
76 |
label => _("Delete picture"), |
label => _("Delete picture"), |
84 |
}, |
}, |
85 |
)); |
)); |
86 |
}; |
}; |
|
img { attr { src => "/raw_pic?image=" . $record->filename } } |
|
|
tt{ $record->filename } |
|
87 |
}; |
}; |
88 |
|
|
89 |
}; |
}; |
97 |
|
|
98 |
my $record_class = $self->record_class; |
my $record_class = $self->record_class; |
99 |
warn "## new_picture record_class: $record_class\n"; |
warn "## new_picture record_class: $record_class\n"; |
100 |
my $create = $record_class->as_create_action( |
# my $create = $record_class->as_create_action( |
101 |
|
my $create = new_action( |
102 |
|
class => 'UploadPicture', |
103 |
moniker => "create-" . Jifty->web->serial, |
moniker => "create-" . Jifty->web->serial, |
104 |
); |
); |
105 |
|
|
112 |
|
|
113 |
form { |
form { |
114 |
render_action( $create => [ 'campaign', 'content', 'type' ] ); |
render_action( $create => [ 'campaign', 'content', 'type' ] ); |
115 |
|
outs_raw( $create->hidden( unit => $unit ) ); |
116 |
hyperlink( |
hyperlink( |
117 |
label => _("Add picture"), |
label => _("Add picture"), |
118 |
class => "float-crud-button button-add", |
class => "float-crud-button button-add", |
119 |
onclick => [ |
onclick => [ |
120 |
{ |
{ |
121 |
submit => $create, |
submit => $create, |
|
args => { |
|
|
picture => { result_of => $picture, name => 'id' }, |
|
|
unit => $unit, |
|
|
} |
|
122 |
}, |
}, |
123 |
{ refresh_self => 1 }, |
{ refresh_self => 1 }, |
124 |
{ |
{ |
151 |
if ( $unitpictures->count ) { |
if ( $unitpictures->count ) { |
152 |
em { _('Pictures for unit'), ' ', $unit->name }; |
em { _('Pictures for unit'), ' ', $unit->name }; |
153 |
|
|
|
set( search_collection => $unitpictures ); |
|
|
render_region( |
|
|
name => 'unit-pictures', |
|
|
path => '/unitpictures/list', |
|
|
defaults => { |
|
|
page => 1, |
|
|
unit => $unit->id, |
|
|
} |
|
|
); |
|
|
|
|
154 |
} else { |
} else { |
155 |
em { _('No pictures for unit'), ' ', $unit->name }; |
em { _('No pictures for unit'), ' ', $unit->name }; |
156 |
} |
} |
157 |
|
|
158 |
|
set( search_collection => $unitpictures ); |
159 |
|
|
160 |
|
render_region( |
161 |
|
name => 'unit-pictures', |
162 |
|
path => '/unitpictures/list', |
163 |
|
defaults => { |
164 |
|
page => 1, |
165 |
|
unit => $unit->id, |
166 |
|
} |
167 |
|
); |
168 |
|
|
169 |
} |
} |
170 |
}; |
}; |
171 |
|
|