diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 12:45:31 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 12:45:31 +0200 |
commit | 6cdbb27ec3cf72ce6728986909aa3df54b7a26c6 (patch) | |
tree | b989b826e119a382e1bc0fde590e312c8d3bbcda /app/controllers/projects/environments_controller.rb | |
parent | 7aea16b64624eb681a1c134759a8f4fa1e5b2a78 (diff) | |
download | gitlab-ce-6cdbb27ec3cf72ce6728986909aa3df54b7a26c6.tar.gz |
Refactor code to use available and stopped statuses and refactor views to use separate renders
Diffstat (limited to 'app/controllers/projects/environments_controller.rb')
-rw-r--r-- | app/controllers/projects/environments_controller.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 2ec316a1ebd..40da5be2e49 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -10,8 +10,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController @all_environments = project.environments @environments = case @scope - when 'closed' then @all_environments.closed - else @all_environments.opened + when 'stopped' then @all_environments.stopped + else @all_environments.available end end @@ -45,7 +45,9 @@ class Projects::EnvironmentsController < Projects::ApplicationController end def stop - + action = @environment.stop_action + new_action = action.active? ? action : action.play(current_user) + redirect_to [project.namespace.become(Namespace), project, new_action] end def destroy |