52 |
|
|
53 |
template 'view' => sub :CRUDView { |
template 'view' => sub :CRUDView { |
54 |
my $self = shift; |
my $self = shift; |
55 |
my $record = $self->_get_record( get('id') ); |
my ( $id, $unit ) = get(qw(id unit)); |
56 |
|
my $record = $self->_get_record( $id ); |
57 |
|
|
58 |
my $update = $record->as_update_action( |
my $delete = $record->as_delete_action( |
59 |
moniker => "update-" . Jifty->web->serial, |
moniker => "delete-" . Jifty->web->serial, |
60 |
); |
); |
61 |
|
|
|
my $unit = get('unit'); |
|
62 |
#warn "## unit $unit"; |
#warn "## unit $unit"; |
63 |
|
|
64 |
|
|
65 |
div { |
div { |
66 |
{ class is 'form_field' }; |
{ class is 'form_field' }; |
67 |
if ( $record->current_user_can('update') && $self->current_user->editing ) { |
if ( $record->current_user_can('delete') && $self->current_user->editing ) { |
68 |
hyperlink( |
hyperlink( |
69 |
label => _("Edit"), |
label => _("Delete"), |
70 |
class => "float-crud-button", |
class => "float-crud-button", |
71 |
onclick => { |
onclick => { |
72 |
replace_with => $self->fragment_for('update'), |
submit => $delete, |
73 |
args => { id => $record->id } |
confirm => _('Really delete?'), |
74 |
|
replace_with => '/__jifty/empty', |
75 |
|
refresh_self => 1, |
76 |
|
args => { id => $id }, |
77 |
}, |
}, |
78 |
as_button => 1, |
as_button => 1, |
79 |
); |
); |
80 |
} |
}; |
81 |
render_param( $update => 'material', render_mode => 'read' ); |
label { { class is 'label' } _("Material") }; |
82 |
|
span { $record->material->name }; |
83 |
}; |
}; |
84 |
|
|
85 |
}; |
}; |
88 |
my $self = shift; |
my $self = shift; |
89 |
return unless $self->current_user->editing; |
return unless $self->current_user->editing; |
90 |
|
|
91 |
my ( $object_type, $id, $unit ) = ( $self->object_type, get('id'), get('unit') ); |
my ( $id, $unit ) = get(qw(id unit)); |
92 |
my $record_class = $self->record_class; |
my $record_class = $self->record_class; |
93 |
my $create = $record_class->as_create_action( |
my $create = $record_class->as_create_action( |
94 |
moniker => "create-" . Jifty->web->serial, |
moniker => "create-" . Jifty->web->serial, |
116 |
element => $attach_to, |
element => $attach_to, |
117 |
append => $self->fragment_for('view'), |
append => $self->fragment_for('view'), |
118 |
args => { |
args => { |
119 |
object_type => $object_type, |
object_type => $self->object_type, |
120 |
id => { result_of => $create, name => 'id' }, |
id => { result_of => $create, name => 'id' }, |
121 |
|
unit => $unit, |
122 |
}, |
}, |
123 |
}, |
}, |
124 |
], |
], |