From: Moritz Bunkus Date: Fri, 11 Nov 2016 09:37:00 +0000 (+0100) Subject: ActionBar: Project-Controller umgestellt X-Git-Tag: release-3.5.4~1353 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=dcef8eb00b07cf85be6fe9f97e233b3e1d4847db;p=kivitendo-erp.git ActionBar: Project-Controller umgestellt --- diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index 06d43847b..0e81e570d 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -51,17 +51,21 @@ sub action_search { include_prefix => 'l_', include_value => 'Y'); + $self->setup_search_action_bar; + $self->render('project/search', %params); } sub action_list { my ($self) = @_; + $self->setup_search_action_bar; + $self->make_filter_summary; $self->prepare_report; - $self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get); + $self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get, action_bar => 1); } sub action_new { @@ -69,14 +73,14 @@ sub action_new { $self->project(SL::DB::Project->new); $self->display_form(title => $::locale->text('Create a new project'), - callback => $::form->{callback} || $self->url_for(action => 'new')); + callback => $::form->{callback} || $self->url_for(action => 'list')); } sub action_edit { my ($self) = @_; $self->display_form(title => $::locale->text('Edit project #1', $self->project->projectnumber), - callback => $::form->{callback} || $self->url_for(action => 'edit', id => $self->project->id)); + callback => $::form->{callback} || $self->url_for(action => 'list')); } sub action_create { @@ -232,6 +236,8 @@ sub display_form { CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} }; + $self->setup_edit_action_bar(callback => $params{callback}); + $self->render('project/form', %params); } @@ -372,4 +378,60 @@ sub make_filter_summary { $self->{filter_summary} = join ', ', @filter_strings; } + +sub setup_edit_action_bar { + my ($self, %params) = @_; + + my $is_new = !$self->project->id; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + combobox => [ + action => [ + t8('Save'), + submit => [ '#form', { action => 'Project/' . ($is_new ? 'create' : 'update') } ], + accesskey => 'enter', + ], + action => [ + t8('Save as new'), + submit => [ '#form', { action => 'Project/create' }], + disabled => $is_new ? t8('The object has not been saved yet.') : undef, + ], + ], # end of combobox "Save" + + action => [ + t8('Delete'), + submit => [ '#form', { action => 'Project/destroy' } ], + confirm => $::locale->text('Do you really want to delete this object?'), + disabled => $is_new ? t8('This object has not been saved yet.') + : $self->project->is_used ? t8('This object has already been used.') + : undef, + ], + + link => [ + t8('Abort'), + link => $params{callback} || $self->url_for(action => 'list'), + ], + ); + } +} + +sub setup_search_action_bar { + my ($self, %params) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Search'), + submit => [ '#search_form', { action => 'Project/list' } ], + accesskey => 'enter', + ], + link => [ + t8('Add Project'), + link => $self->url_for(action => 'new'), + ], + ); + } +} + 1; diff --git a/locale/de/all b/locale/de/all index f0785c86a..d056dd061 100755 --- a/locale/de/all +++ b/locale/de/all @@ -3025,6 +3025,7 @@ $self->{texts} = { 'The object has been created.' => 'Das Objekt wurde angelegt.', 'The object has been deleted.' => 'Das Objekt wurde gelöscht..', 'The object has been saved.' => 'Das Objekt wurde gespeichert.', + 'The object has not been saved yet.' => 'Das Objekt wurde noch nicht gespeichert.', 'The object is in use and cannot be deleted.' => 'Das Objekt ist in Benutzung und kann nicht gelöscht werden.', 'The option field is empty.' => 'Das Optionsfeld ist leer.', 'The order has been deleted' => 'Der Auftrag wurde gelöscht.', diff --git a/templates/webpages/project/_filter.html b/templates/webpages/project/_filter.html index 90a15d0fb..5a522264a 100644 --- a/templates/webpages/project/_filter.html +++ b/templates/webpages/project/_filter.html @@ -3,7 +3,7 @@ [%- USE L %] [%- USE LxERP %] - +
diff --git a/templates/webpages/project/form.html b/templates/webpages/project/form.html index 5e25f8e77..b8343fb39 100644 --- a/templates/webpages/project/form.html +++ b/templates/webpages/project/form.html @@ -7,7 +7,7 @@ [%- INCLUDE 'common/flash.html' %] - + [% L.hidden_tag("callback", callback) %] [% L.hidden_tag("id", SELF.project.id) %] @@ -39,14 +39,4 @@ [%- END %] - -

- [% L.hidden_tag("action", "Project/dispatch") %] - [% L.submit_tag("action_" _ (SELF.project.id ? "update" : "create"), LxERP.t8('Save')) %] - [%- IF SELF.project.id %] - [% L.submit_tag("action_create", LxERP.t8('Save as new')) %] - [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) IF !SELF.project.is_used %] - [%- END %] - [%- LxERP.t8('Abort') %] -

diff --git a/templates/webpages/project/report_top.html b/templates/webpages/project/report_top.html index 83ccf4868..ae3509a75 100644 --- a/templates/webpages/project/report_top.html +++ b/templates/webpages/project/report_top.html @@ -15,7 +15,6 @@ [% L.hidden_tag('sort_by', FORM.sort_by) %] [% L.hidden_tag('sort_dir', FORM.sort_dir) %] [% L.hidden_tag('page', FORM.page) %] -[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%] diff --git a/templates/webpages/project/search.html b/templates/webpages/project/search.html index ad706a46a..d2adb5826 100644 --- a/templates/webpages/project/search.html +++ b/templates/webpages/project/search.html @@ -11,10 +11,4 @@

[%- INCLUDE 'project/_filter.html' %]

- -
- - [% L.hidden_tag('action', 'Project/list') %] - -

[% L.submit_tag('dummy', LxERP.t8('Continue')) %]

[% 'Number' | $T8 %] [% L.input_tag('filter.projectnumber:substr::ilike', filter.projectnumber_substr__ilike, size=60) %]