wp update looks for optional back url after update.

pull/1801/head
Richard 10 years ago
parent 577cf50e62
commit 1632e5479e
  1. 5
      app/assets/javascripts/angular/work_packages/controllers/work-packages-list-controller.js
  2. 3
      app/assets/javascripts/angular/work_packages/directives/work-package-details-toolbar-directive.js
  3. 13
      app/controllers/work_packages_controller.rb
  4. 1
      app/views/work_packages/_edit.html.erb
  5. 3
      app/views/work_packages/edit.html.erb
  6. 4
      public/templates/work_packages.list.details.html

@ -188,10 +188,7 @@ angular.module('openproject.workPackages.controllers')
// Updates // Updates
$scope.maintainUrlQueryState = function(){ $scope.maintainUrlQueryState = function(){
var relativeUrl = "/work_packages"; var relativeUrl = decodeURIComponent($state.href($state.$current)); // ui-router escapes some of this string for whatever reason
if ($scope.projectIdentifier){
relativeUrl = "/projects/" + $scope.projectIdentifier + relativeUrl;
}
if($scope.query) { if($scope.query) {
var queryString = UrlParamsHelper.encodeQueryJsonParams($scope.query); var queryString = UrlParamsHelper.encodeQueryJsonParams($scope.query);

@ -89,6 +89,7 @@ angular.module('openproject.workPackages.directives')
templateUrl: '/templates/work_packages/work_package_details_toolbar.html', templateUrl: '/templates/work_packages/work_package_details_toolbar.html',
scope: { scope: {
workPackage: '=', workPackage: '=',
backUrl: '='
}, },
link: function(scope, element, attributes) { link: function(scope, element, attributes) {
var authorization = new WorkPackageAuthorization(scope.workPackage); var authorization = new WorkPackageAuthorization(scope.workPackage);
@ -100,7 +101,7 @@ angular.module('openproject.workPackages.directives')
scope.editWorkPackage = function() { scope.editWorkPackage = function() {
// TODO: Temporarily going to the old edit dialog until we get in-place editing done // TODO: Temporarily going to the old edit dialog until we get in-place editing done
window.location = PathHelper.staticEditWorkPackagePath(scope.workPackage.props.id); window.location = PathHelper.staticEditWorkPackagePath(scope.workPackage.props.id) + '?back_url=' + encodeURIComponent(scope.backUrl);
}; };
scope.triggerMoreMenuAction = function(action, link) { scope.triggerMoreMenuAction = function(action, link) {

@ -159,7 +159,8 @@ class WorkPackagesController < ApplicationController
:project => project, :project => project,
:priorities => priorities, :priorities => priorities,
:time_entry => time_entry, :time_entry => time_entry,
:user => current_user } :user => current_user,
:back_url => params[:back_url] }
respond_to do |format| respond_to do |format|
format.html do format.html do
@ -184,7 +185,7 @@ class WorkPackagesController < ApplicationController
flash[:notice] = l(:notice_successful_update) flash[:notice] = l(:notice_successful_update)
redirect_to(work_package_path(work_package)) redirect_to_back_url_or_work_package(work_package)
else else
edit edit
end end
@ -438,6 +439,14 @@ class WorkPackagesController < ApplicationController
private private
def redirect_to_back_url_or_work_package(work_package)
if !params[:back_url].blank?
redirect_to(params[:back_url])
else
redirect_to(work_package_path(work_package))
end
end
def load_work_packages def load_work_packages
sort_init(@query.sort_criteria.empty? ? [DEFAULT_SORT_ORDER] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [DEFAULT_SORT_ORDER] : @query.sort_criteria)
sort_update(@query.sortable_columns) sort_update(@query.sortable_columns)

@ -36,6 +36,7 @@ See doc/COPYRIGHT.rdoc for more details.
:multipart => true :multipart => true
} do |f| %> } do |f| %>
<%= hidden_field_tag 'back_url', back_url %>
<%= error_messages_for work_package %> <%= error_messages_for work_package %>
<% if edit_allowed || !allowed_statuses.empty? %> <% if edit_allowed || !allowed_statuses.empty? %>

@ -36,7 +36,8 @@ See doc/COPYRIGHT.rdoc for more details.
:project => project, :project => project,
:priorities => priorities, :priorities => priorities,
:time_entry => time_entry, :time_entry => time_entry,
:user => user } %> :user => user,
:back_url => back_url } %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= robot_exclusion_tag %> <%= robot_exclusion_tag %>
<% end %> <% end %>

@ -47,5 +47,7 @@
</div> </div>
<div class="bottom-toolbar"> <div class="bottom-toolbar">
<work-package-details-toolbar work-package='workPackage'></work-package-details-toolbar> <work-package-details-toolbar work-package='workPackage'
back-url="backUrl">
</work-package-details-toolbar>
</div> </div>

Loading…
Cancel
Save