From 037defc7def3e2d0f2de4930516149d7567362fc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 28 Sep 2015 17:19:20 +0200 Subject: Move CI variables page to project settings Signed-off-by: Dmitriy Zaporozhets --- app/controllers/projects/variables_controller.rb | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 app/controllers/projects/variables_controller.rb (limited to 'app/controllers/projects/variables_controller.rb') diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb new file mode 100644 index 00000000000..d6561a45a70 --- /dev/null +++ b/app/controllers/projects/variables_controller.rb @@ -0,0 +1,25 @@ +class Projects::VariablesController < Projects::ApplicationController + before_action :ci_project + before_action :authorize_admin_project! + + layout 'project_settings' + + def show + end + + def update + if ci_project.update_attributes(project_params) + Ci::EventService.new.change_project_settings(current_user, ci_project) + + redirect_to namespace_project_variables_path(project.namespace, project), notice: 'Variables were successfully updated.' + else + render action: 'show' + end + end + + private + + def project_params + params.require(:project).permit({ variables_attributes: [:id, :key, :value, :_destroy] }) + end +end -- cgit v1.2.1