Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-02-22 00:37:00 +0300
committerJose Ivan Vargas <jvargas@gitlab.com>2017-03-06 18:47:44 +0300
commita29517dd0c6515121a2f42e08ad011415a3d8618 (patch)
tree93977c5a003a378749a3de252336500a732771d6 /app/controllers/projects/protected_branches_controller.rb
parent336b818bcbcb070968f825f6a426e046a457d556 (diff)
Added tests for the repository_controller and repository_helper
Added specs for the deploy_keys_presenter and added a new method in the presenter called #key_available? Fixed some minor UX inconsistencies and added a concern to handle redirection
Diffstat (limited to 'app/controllers/projects/protected_branches_controller.rb')
-rw-r--r--app/controllers/projects/protected_branches_controller.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb
index 1c22b9c2ca8..b7817a71e0d 100644
--- a/app/controllers/projects/protected_branches_controller.rb
+++ b/app/controllers/projects/protected_branches_controller.rb
@@ -1,4 +1,5 @@
class Projects::ProtectedBranchesController < Projects::ApplicationController
+ include RedirectRequest
# Authorize
before_action :require_non_empty_project
before_action :authorize_admin_project!
@@ -7,15 +8,15 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
layout "project_settings"
def index
- redirect_to namespace_project_settings_repository_path(@project.namespace, @project)
+ redirect_to_repository_settings(@project)
end
def create
@protected_branch = ::ProtectedBranches::CreateService.new(@project, current_user, protected_branch_params).execute
unless @protected_branch.persisted?
- flash[:alert] = @protected_branches.errors.full_messages.join(',').html_safe
+ flash[:alert] = @protected_branches.errors.full_messages.join(', ').html_safe
end
- redirect_to namespace_project_settings_repository_path(@project.namespace, @project)
+ redirect_to_repository_settings(@project)
end
def show
@@ -40,7 +41,7 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
@protected_branch.destroy
respond_to do |format|
- format.html { redirect_to namespace_project_settings_repository_path }
+ format.html { redirect_to_repository_settings(@project) }
format.js { head :ok }
end
end
@@ -56,8 +57,4 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
merge_access_levels_attributes: [:access_level, :id],
push_access_levels_attributes: [:access_level, :id])
end
-
- def load_protected_branches
- @protected_branches = @project.protected_branches.order(:name).page(params[:page])
- end
end