mirror of
https://github.com/redmine/redmine.git
synced 2026-05-07 02:17:43 +02:00
API to archive/unarchive projects (#35420).
Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@21044 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
|
||||
before_action :authorize_global, :only => [:new, :create]
|
||||
before_action :require_admin, :only => [:copy, :archive, :unarchive]
|
||||
accept_rss_auth :index
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
accept_api_auth :index, :show, :create, :update, :destroy, :archive, :unarchive
|
||||
require_sudo_mode :destroy
|
||||
|
||||
helper :custom_fields
|
||||
@@ -233,16 +233,31 @@ class ProjectsController < ApplicationController
|
||||
|
||||
def archive
|
||||
unless @project.archive
|
||||
flash[:error] = l(:error_can_not_archive_project)
|
||||
error = l(:error_can_not_archive_project)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
flash[:error] = error if error
|
||||
redirect_to_referer_or admin_projects_path(:status => params[:status])
|
||||
end
|
||||
format.api do
|
||||
if error
|
||||
render_api_errors error
|
||||
else
|
||||
render_api_ok
|
||||
end
|
||||
end
|
||||
end
|
||||
redirect_to_referer_or admin_projects_path(:status => params[:status])
|
||||
end
|
||||
|
||||
def unarchive
|
||||
unless @project.active?
|
||||
@project.unarchive
|
||||
end
|
||||
redirect_to_referer_or admin_projects_path(:status => params[:status])
|
||||
respond_to do |format|
|
||||
format.html{ redirect_to_referer_or admin_projects_path(:status => params[:status]) }
|
||||
format.api{ render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
def bookmark
|
||||
|
||||
Reference in New Issue
Block a user