Commit 7b5d68f0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Error page if forking fails

parent 1487ed3e
......@@ -23,6 +23,7 @@ v 5.3.0
- Fix dashboard event filter when navigate via turbolinks
- init.d: Ensure socket is removed before starting service
- Admin area: Style teams:index, group:show pages
- Own page for failed forking
v 5.2.0
- Turbolinks
......
......@@ -7,7 +7,7 @@ class ProjectsController < ProjectResourceController
before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer]
before_filter :require_non_empty_project, only: [:blob, :tree, :graph]
layout 'navless', only: [:new, :create]
layout 'navless', only: [:new, :create, :fork]
before_filter :set_title, only: [:new, :create]
def new
......@@ -81,14 +81,15 @@ def destroy
end
def fork
@project = ::Projects::ForkContext.new(project, current_user).execute
@forked_project = ::Projects::ForkContext.new(project, current_user).execute
respond_to do |format|
format.html do
if @project.saved? && @project.forked?
redirect_to(@project, notice: 'Project was successfully forked.')
if @forked_project.saved? && @forked_project.forked?
redirect_to(@forked_project, notice: 'Project was successfully forked.')
else
render action: "new"
@title = 'Fork project'
render action: "fork"
end
end
format.js
......
.alert.alert-error.alert-block
%h4
%i.icon-code-fork
Fork Error!
%p
You are trying to fork
= link_to_project @project
but it fails due to next reason:
- if @forked_project && @forked_project.errors.any?
%p
&ndash;
= @forked_project.errors.full_messages.first
%p
= link_to fork_project_path(@project), title: "Fork", class: "btn", method: "POST" do
%i.icon-code-fork
Try to Fork again
......@@ -42,6 +42,7 @@
%p Owner: #{link_to @project.owner_name, @project.owner}
- if @project.forked_from_project
%p
%i.icon-code-fork
Forked from:
= link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment