Commit 7b5d68f0a7fe2f8c9ef85f2fca10ce3d3bb7e388
1 parent
1487ed3e
Exists in
master
and in
4 other branches
Error page if forking fails
Showing
4 changed files
with
27 additions
and
5 deletions
Show diff stats
CHANGELOG
| ... | ... | @@ -23,6 +23,7 @@ v 5.3.0 |
| 23 | 23 | - Fix dashboard event filter when navigate via turbolinks |
| 24 | 24 | - init.d: Ensure socket is removed before starting service |
| 25 | 25 | - Admin area: Style teams:index, group:show pages |
| 26 | + - Own page for failed forking | |
| 26 | 27 | |
| 27 | 28 | v 5.2.0 |
| 28 | 29 | - Turbolinks | ... | ... |
app/controllers/projects_controller.rb
| ... | ... | @@ -7,7 +7,7 @@ class ProjectsController < ProjectResourceController |
| 7 | 7 | before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer] |
| 8 | 8 | before_filter :require_non_empty_project, only: [:blob, :tree, :graph] |
| 9 | 9 | |
| 10 | - layout 'navless', only: [:new, :create] | |
| 10 | + layout 'navless', only: [:new, :create, :fork] | |
| 11 | 11 | before_filter :set_title, only: [:new, :create] |
| 12 | 12 | |
| 13 | 13 | def new |
| ... | ... | @@ -81,14 +81,15 @@ class ProjectsController < ProjectResourceController |
| 81 | 81 | end |
| 82 | 82 | |
| 83 | 83 | def fork |
| 84 | - @project = ::Projects::ForkContext.new(project, current_user).execute | |
| 84 | + @forked_project = ::Projects::ForkContext.new(project, current_user).execute | |
| 85 | 85 | |
| 86 | 86 | respond_to do |format| |
| 87 | 87 | format.html do |
| 88 | - if @project.saved? && @project.forked? | |
| 89 | - redirect_to(@project, notice: 'Project was successfully forked.') | |
| 88 | + if @forked_project.saved? && @forked_project.forked? | |
| 89 | + redirect_to(@forked_project, notice: 'Project was successfully forked.') | |
| 90 | 90 | else |
| 91 | - render action: "new" | |
| 91 | + @title = 'Fork project' | |
| 92 | + render action: "fork" | |
| 92 | 93 | end |
| 93 | 94 | end |
| 94 | 95 | format.js | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +.alert.alert-error.alert-block | |
| 2 | + %h4 | |
| 3 | + %i.icon-code-fork | |
| 4 | + Fork Error! | |
| 5 | + %p | |
| 6 | + You are trying to fork | |
| 7 | + = link_to_project @project | |
| 8 | + but it fails due to next reason: | |
| 9 | + | |
| 10 | + | |
| 11 | + - if @forked_project && @forked_project.errors.any? | |
| 12 | + %p | |
| 13 | + – | |
| 14 | + = @forked_project.errors.full_messages.first | |
| 15 | + | |
| 16 | + %p | |
| 17 | + = link_to fork_project_path(@project), title: "Fork", class: "btn", method: "POST" do | |
| 18 | + %i.icon-code-fork | |
| 19 | + Try to Fork again | ... | ... |
app/views/projects/show.html.haml
| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | %p Owner: #{link_to @project.owner_name, @project.owner} |
| 43 | 43 | - if @project.forked_from_project |
| 44 | 44 | %p |
| 45 | + %i.icon-code-fork | |
| 45 | 46 | Forked from: |
| 46 | 47 | = link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project) |
| 47 | 48 | ... | ... |