diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-10 23:36:54 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-10 23:36:54 +0200 |
commit | 907c0e6796b69f9577c147dd489cf55748c749ac (patch) | |
tree | c4db6a3d3785fa845be98447eb4303b548ab7809 /app/controllers/projects/environments_controller.rb | |
parent | cf7da039bedcad5163ce9deedccc94206d4c485a (diff) | |
download | gitlab-ce-907c0e6796b69f9577c147dd489cf55748c749ac.tar.gz |
Added initial version of deployments
Diffstat (limited to 'app/controllers/projects/environments_controller.rb')
-rw-r--r-- | app/controllers/projects/environments_controller.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index f5af24ed217..722954a6b78 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -1,17 +1,19 @@ class Projects::EnvironmentsController < Projects::ApplicationController layout 'project' + before_action :authorize_read_environment! + before_action :environment, only: [:show] def index - @environments = project.builds.where.not(environment: nil).pluck(:environment).uniq - @environments = @environments.map { |env| build_for_env(env) }.compact + @environments = project.environments end def show - @environment = params[:id].to_s - @builds = project.builds.where.not(status: ["manual"]).where(environment: params[:id].to_s).order(id: :desc).page(params[:page]).per(30) end - def build_for_env(environment) - project.builds.success.order(id: :desc).find_by(environment: environment) + private + + def environment + @environment ||= project.environments.find(params[:id].to_s) + @environment || render_404 end end |