Revision 9cddaf37
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/DB/RequirementSpecTextBlock.pm | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
5 |
use Carp; |
|
5 | 6 |
use List::MoreUtils qw(any); |
6 | 7 |
use Rose::DB::Object::Helpers; |
7 | 8 |
use Rose::DB::Object::Util; |
... | ... | |
11 | 12 |
use SL::DB::Helper::ActsAsList; |
12 | 13 |
use SL::Locale::String; |
13 | 14 |
|
15 |
__PACKAGE__->meta->add_relationship( |
|
16 |
pictures => { |
|
17 |
type => 'one to many', |
|
18 |
class => 'SL::DB::RequirementSpecPicture', |
|
19 |
column_map => { id => 'text_block_id' }, |
|
20 |
}, |
|
21 |
); |
|
22 |
|
|
14 | 23 |
__PACKAGE__->meta->initialize; |
15 | 24 |
|
16 | 25 |
__PACKAGE__->configure_acts_as_list(group_by => [qw(requirement_spec_id output_position)]); |
... | ... | |
48 | 57 |
return 1; |
49 | 58 |
} |
50 | 59 |
|
60 |
sub pictures_sorted { |
|
61 |
my ($self, @args) = @_; |
|
62 |
|
|
63 |
croak "Not a writer" if @args; |
|
64 |
|
|
65 |
return [ sort { $a->position <=> $b->position } $self->pictures ]; |
|
66 |
} |
|
67 |
|
|
51 | 68 |
1; |
Auch abrufbar als: Unified diff
Pflichtenhefte: Unterstützung für an Textblöcke angehängte Bilder