15 |
type is 'text', |
type is 'text', |
16 |
label is _("Number"), |
label is _("Number"), |
17 |
is mandatory; |
is mandatory; |
18 |
|
|
19 |
column material => |
column campaign => |
20 |
label is _("Material"), |
label is _("Part of campaign"), |
21 |
refers_to Arh::Model::UnitMaterial; |
refers_to Arh::Model::Campaign, |
22 |
|
is mandatory, |
23 |
|
since '0.0.9'; |
24 |
|
|
25 |
column dimensions => |
column dimensions => |
26 |
label is _("Dimensions"), |
label is _("Dimensions"), |
32 |
type is 'text'; |
type is 'text'; |
33 |
|
|
34 |
column description => |
column description => |
35 |
label is _("Description"); |
label is _("Description"), |
36 |
|
render as 'textarea'; |
37 |
|
|
38 |
column chronology => |
column chronology => |
39 |
label is _("Chronology"), |
label is _("Chronology"), |
46 |
|
|
47 |
}; |
}; |
48 |
|
|
49 |
|
#use Jifty::Plugin::ActorMetadata::Mixin::Model::ActorMetadata; # created_by, created_on, updated_on |
50 |
|
|
51 |
# Your model-specific methods go here. |
# Your model-specific methods go here. |
52 |
|
|
53 |
|
sub material { |
54 |
|
my $self = shift; |
55 |
|
my $m = Arh::Model::UnitMaterialCollection->new; |
56 |
|
$m->limit( column => 'unit', value => $self->id ); |
57 |
|
return $m; |
58 |
|
} |
59 |
|
|
60 |
|
sub current_user_can { |
61 |
|
my ( $self, $action,$item,$name ) = @_; |
62 |
|
return 1 if $self->current_user->superuser || $self->current_user->administrator; |
63 |
|
return 1 if $self->current_user->id && $action eq 'read'; |
64 |
|
return 0; |
65 |
|
} |
66 |
|
|
67 |
1; |
1; |
68 |
|
|