use Rose::Object::MakeMethods::Generic
(
- scalar => [ qw(requirement_spec customers projects types statuses db_args flat_filter is_template) ],
+ scalar => [ qw(requirement_spec requirement_spec_item customers projects types statuses db_args flat_filter is_template) ],
);
__PACKAGE__->run_before('setup');
-__PACKAGE__->run_before('load_requirement_spec', only => [ qw( edit update destroy) ]);
+__PACKAGE__->run_before('load_requirement_spec', only => [ qw( edit update show destroy) ]);
__PACKAGE__->run_before('load_select_options', only => [ qw(new edit create update list) ]);
__PACKAGE__->run_before('load_search_select_options', only => [ qw( list) ]);
$self->render('requirement_spec/form', title => t8('Edit requirement spec'));
}
+sub action_show {
+ my ($self) = @_;
+
+ my $item = $::form->{requirement_spec_item_id} ? SL::DB::RequirementSpecItem->new(id => $::form->{requirement_spec_item_id})->load : @{ $self->requirement_spec->sections }[0];
+ $self->requirement_spec_item($item);
+
+ $self->render('requirement_spec/show', title => t8('Show requirement spec'));
+}
+
sub action_create {
my ($self) = @_;
my ($self) = @_;
$::auth->assert('config');
- $::request->{layout}->use_stylesheet("requirement_spec.css");
+ $::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec);
+ $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu client_js requirement_spec);
$self->is_template($::form->{is_template} ? 1 : 0);
return 1;
}
+sub load_requirement_spec {
+ my ($self) = @_;
+ $self->{requirement_spec} = SL::DB::RequirementSpec->new(id => $::form->{id})->load || die "No such requirement spec";
+}
+
+sub load_select_options {
+ my ($self) = @_;
+
+ my @filter = ('!obsolete' => 1);
+ if ($self->requirement_spec && $self->requirement_spec->customer_id) {
+ @filter = ( or => [ @filter, id => $self->requirement_spec->customer_id ] );
+ }
+
+ $self->customers(SL::DB::Manager::Customer->get_all_sorted(where => \@filter));
+ $self->statuses( SL::DB::Manager::RequirementSpecStatus->get_all_sorted);
+ $self->types( SL::DB::Manager::RequirementSpecType->get_all_sorted);
+}
+
+sub load_search_select_options {
+ my ($self) = @_;
+
+ $self->projects(SL::DB::Manager::Project->get_all_sorted);
+}
+
#
# helpers
#
$self->redirect_to(action => 'list');
}
-sub load_requirement_spec {
- my ($self) = @_;
- $self->{requirement_spec} = SL::DB::RequirementSpec->new(id => $::form->{id})->load;
-}
-
-sub load_select_options {
- my ($self) = @_;
-
- my @filter = ('!obsolete' => 1);
- if ($self->requirement_spec && $self->requirement_spec->customer_id) {
- @filter = ( or => [ @filter, id => $self->requirement_spec->customer_id ] );
- }
-
- $self->customers(SL::DB::Manager::Customer->get_all_sorted(where => \@filter));
- $self->statuses( SL::DB::Manager::RequirementSpecStatus->get_all_sorted);
- $self->types( SL::DB::Manager::RequirementSpecType->get_all_sorted);
-}
-
-sub load_search_select_options {
- my ($self) = @_;
-
- $self->projects(SL::DB::Manager::Project->get_all_sorted);
-}
-
sub setup_db_args_from_filter {
my ($self) = @_;