diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-11-24 16:43:00 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-11-24 18:35:10 +0300 |
commit | 0bee018631ae199ce87125c21379e1db2f56bf67 (patch) | |
tree | e2c4aa7cb0cd45c48eae6579112afd1c85eb33ec /app/controllers/projects/clusters_controller.rb | |
parent | 5413bf0426917846ed49bfa556ec46dd09a8cd3a (diff) |
Adds JS to toggle buttons [ci skip]
Diffstat (limited to 'app/controllers/projects/clusters_controller.rb')
-rw-r--r-- | app/controllers/projects/clusters_controller.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb index 19ae3192044..37271c4708d 100644 --- a/app/controllers/projects/clusters_controller.rb +++ b/app/controllers/projects/clusters_controller.rb @@ -7,7 +7,7 @@ class Projects::ClustersController < Projects::ApplicationController before_action :authorize_admin_cluster!, only: [:destroy] def index - @clusters ||= project.clusters.map { |cluster| cluster.present(current_user: current_user) } + @clusters ||= project.clusters.page(params[:page]).per(20).map { |cluster| cluster.present(current_user: current_user) } end def login @@ -64,10 +64,20 @@ class Projects::ClustersController < Projects::ApplicationController .execute(cluster) if cluster.valid? - flash[:notice] = "Cluster was successfully updated." - redirect_to project_cluster_path(project, project.cluster) + respond_to do |format| + format.json do + head :no_content + end + format.html do + flash[:notice] = "Cluster was successfully updated." + redirect_to project_cluster_path(project, project.cluster) + end + end else - render :show + respond_to do |format| + format.json { head :bad_request } + format.html { render :show } + end end end |