summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 16:07:44 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 16:07:44 +0200
commit87240e989ba913bad787d8bc81da1a9b87f1da53 (patch)
treeecd75d098682e90d30e72a251be4691687f87a76 /app/controllers
parent2c3355f9584a1a22d91806b8b49d441f22c0c286 (diff)
downloadgitlab-ce-move-ci-settings.tar.gz
Move CI project settings page to CE project settings areamove-ci-settings
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/ci/projects_controller.rb33
-rw-r--r--app/controllers/projects/application_controller.rb2
-rw-r--r--app/controllers/projects/ci_settings_controller.rb36
3 files changed, 39 insertions, 32 deletions
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb
index 13766fb8f6f..e8788955eba 100644
--- a/app/controllers/ci/projects_controller.rb
+++ b/app/controllers/ci/projects_controller.rb
@@ -2,9 +2,9 @@ module Ci
class ProjectsController < Ci::ApplicationController
before_action :authenticate_user!, except: [:build, :badge, :show]
before_action :authenticate_public_page!, only: :show
- before_action :project, only: [:build, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
+ before_action :project, only: [:build, :show, :badge, :toggle_shared_runners, :dumped_yaml]
before_action :authorize_access_project!, except: [:build, :badge, :show, :new, :disabled]
- before_action :authorize_manage_project!, only: [:edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
+ before_action :authorize_manage_project!, only: [:toggle_shared_runners, :dumped_yaml]
before_action :authenticate_token!, only: [:build]
before_action :no_cache, only: [:badge]
skip_before_action :check_enable_flag!, only: [:disabled]
@@ -23,28 +23,6 @@ module Ci
@commits = @commits.page(params[:page]).per(20)
end
- def edit
- end
-
- def update
- if project.update_attributes(project_params)
- Ci::EventService.new.change_project_settings(current_user, project)
-
- redirect_to :back, notice: 'Project was successfully updated.'
- else
- render action: "edit"
- end
- end
-
- def destroy
- project.gl_project.gitlab_ci_service.update_attributes(active: false)
- project.destroy
-
- Ci::EventService.new.remove_project(current_user, project)
-
- redirect_to ci_projects_url
- end
-
# Project status badge
# Image with build status for sha or ref
def badge
@@ -74,12 +52,5 @@ module Ci
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
-
- def project_params
- params.require(:project).permit(:path, :timeout, :timeout_in_minutes, :default_ref, :always_build,
- :polling_interval, :public, :ssh_url_to_repo, :allow_git_fetch, :email_recipients,
- :email_add_pusher, :email_only_broken_builds, :coverage_regex, :shared_runners_enabled, :token,
- { variables_attributes: [:id, :key, :value, :_destroy] })
- end
end
end
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index 56a63ce9758..519d6d6127e 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -33,6 +33,6 @@ class Projects::ApplicationController < ApplicationController
end
def ci_project
- @ci_project ||= @project.gitlab_ci_project
+ @ci_project ||= @project.ensure_gitlab_ci_project
end
end
diff --git a/app/controllers/projects/ci_settings_controller.rb b/app/controllers/projects/ci_settings_controller.rb
new file mode 100644
index 00000000000..a263242a850
--- /dev/null
+++ b/app/controllers/projects/ci_settings_controller.rb
@@ -0,0 +1,36 @@
+class Projects::CiSettingsController < Projects::ApplicationController
+ before_action :ci_project
+ before_action :authorize_admin_project!
+
+ layout "project_settings"
+
+ def edit
+ end
+
+ def update
+ if ci_project.update_attributes(project_params)
+ Ci::EventService.new.change_project_settings(current_user, ci_project)
+
+ redirect_to edit_namespace_project_ci_settings_path(project.namespace, project), notice: 'Project was successfully updated.'
+ else
+ render action: "edit"
+ end
+ end
+
+ def destroy
+ ci_project.destroy
+ Ci::EventService.new.remove_project(current_user, ci_project)
+ project.gitlab_ci_service.update_attributes(active: false)
+
+ redirect_to project_path(project), notice: "CI was disabled for this project"
+ end
+
+ protected
+
+ def project_params
+ params.require(:project).permit(:path, :timeout, :timeout_in_minutes, :default_ref, :always_build,
+ :polling_interval, :public, :ssh_url_to_repo, :allow_git_fetch, :email_recipients,
+ :email_add_pusher, :email_only_broken_builds, :coverage_regex, :shared_runners_enabled, :token,
+ { variables_attributes: [:id, :key, :value, :_destroy] })
+ end
+end