## lib/Jizzy/Controller/Categories.pm sub edit { my $self = shift; # Fetch the category id from the parameters my $id = $self->param('id'); # Get information from the database about the category my $result = $self->db->resultset('Category')->find($id); $self->param('parent_id', $result->parent_id) unless $self->param('parent_id'); # Add information in the stash for the template (e.g. edit.html.ep) $self->stash(id => $result->id); # Render the template $self->render; } ## templates/categories/edit.html.ep % layout 'admin' % title => 'Jizzy.eu: Edycja Kategorii';
<%= label_for parent_id => 'Parent:' %> | % my $options = category_select%= select_field parent_id => $options, class => 'input' |
---|