summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 07:28:07 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-29 07:28:07 +0000
commitada95df88ed845701143a0438fa0338d804c180f (patch)
tree34cdb049b152b64ef9c8cab45492bd5f98f9cdd9 /app
parent231ee19c81d2491e3b5648647bf19992c6b56d83 (diff)
parent037defc7def3e2d0f2de4930516149d7567362fc (diff)
downloadgitlab-ce-ada95df88ed845701143a0438fa0338d804c180f.tar.gz
Merge branch 'move-variables-page' into 'master'
Move CI variables page to project settings Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Part of #2594 See merge request !1457
Diffstat (limited to 'app')
-rw-r--r--app/controllers/ci/variables_controller.rb33
-rw-r--r--app/controllers/projects/application_controller.rb4
-rw-r--r--app/controllers/projects/runners_controller.rb4
-rw-r--r--app/controllers/projects/variables_controller.rb25
-rw-r--r--app/views/layouts/ci/_nav_project.html.haml5
-rw-r--r--app/views/layouts/nav/_project_settings.html.haml5
-rw-r--r--app/views/projects/variables/show.html.haml (renamed from app/views/ci/variables/show.html.haml)10
7 files changed, 39 insertions, 47 deletions
diff --git a/app/controllers/ci/variables_controller.rb b/app/controllers/ci/variables_controller.rb
deleted file mode 100644
index 9c6c775fde8..00000000000
--- a/app/controllers/ci/variables_controller.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-module Ci
- class VariablesController < Ci::ApplicationController
- before_action :authenticate_user!
- before_action :project
- before_action :authorize_access_project!
- before_action :authorize_manage_project!
-
- layout 'ci/project'
-
- def show
- end
-
- def update
- if project.update_attributes(project_params)
- Ci::EventService.new.change_project_settings(current_user, project)
-
- redirect_to ci_project_variables_path(project), notice: 'Variables were successfully updated.'
- else
- render action: 'show'
- end
- end
-
- private
-
- def project
- @project ||= Ci::Project.find(params[:project_id])
- end
-
- def project_params
- params.require(:project).permit({ 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 48c922f450c..56a63ce9758 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -31,4 +31,8 @@ class Projects::ApplicationController < ApplicationController
def ci_enabled
return render_404 unless @project.gitlab_ci?
end
+
+ def ci_project
+ @ci_project ||= @project.gitlab_ci_project
+ end
end
diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb
index d59884a1dd7..6cb6e3ef6d4 100644
--- a/app/controllers/projects/runners_controller.rb
+++ b/app/controllers/projects/runners_controller.rb
@@ -55,10 +55,6 @@ class Projects::RunnersController < Projects::ApplicationController
protected
- def ci_project
- @ci_project = @project.gitlab_ci_project
- end
-
def set_runner
@runner ||= @ci_project.runners.find(params[:id])
end
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
diff --git a/app/views/layouts/ci/_nav_project.html.haml b/app/views/layouts/ci/_nav_project.html.haml
index 9ebe7eabd8e..4b0dc4fc2f5 100644
--- a/app/views/layouts/ci/_nav_project.html.haml
+++ b/app/views/layouts/ci/_nav_project.html.haml
@@ -11,11 +11,6 @@
%span
Commits
%span.count= @project.commits.count
- = nav_link path: 'variables#show' do
- = link_to ci_project_variables_path(@project) do
- = icon('code fw')
- %span
- Variables
= nav_link path: 'web_hooks#index' do
= link_to ci_project_web_hooks_path(@project) do
= icon('link fw')
diff --git a/app/views/layouts/nav/_project_settings.html.haml b/app/views/layouts/nav/_project_settings.html.haml
index a85dd71126c..c8975fb8492 100644
--- a/app/views/layouts/nav/_project_settings.html.haml
+++ b/app/views/layouts/nav/_project_settings.html.haml
@@ -40,3 +40,8 @@
= icon('cog fw')
%span
Runners
+ = nav_link(controller: :variables) do
+ = link_to namespace_project_variables_path(@project.namespace, @project) do
+ = icon('code fw')
+ %span
+ Variables
diff --git a/app/views/ci/variables/show.html.haml b/app/views/projects/variables/show.html.haml
index ebf68341e08..29416a94ff6 100644
--- a/app/views/ci/variables/show.html.haml
+++ b/app/views/projects/variables/show.html.haml
@@ -1,21 +1,21 @@
%h3.page-title
Secret Variables
-%p.light
+%p.light
These variables will be set to environment by the runner and will be hidden in the build log.
%br
- So you can use them for passwords, secret keys or whatever you want.
+ So you can use them for passwords, secret keys or whatever you want.
%hr
-= nested_form_for @project, url: url_for(controller: 'ci/variables', action: 'update'), html: { class: 'form-horizontal' } do |f|
+= nested_form_for @ci_project, url: url_for(controller: 'projects/variables', action: 'update'), html: { class: 'form-horizontal' } do |f|
- if @project.errors.any?
#error_explanation
- %p.lead= "#{pluralize(@project.errors.count, "error")} prohibited this project from being saved:"
+ %p.lead= "#{pluralize(@ci_project.errors.count, "error")} prohibited this project from being saved:"
.alert.alert-error
%ul
- - @project.errors.full_messages.each do |msg|
+ - @ci_project.errors.full_messages.each do |msg|
%li= msg
= f.fields_for :variables do |variable_form|