Skip to content
Snippets Groups Projects
Unverified Commit 6d885f9c authored by James Lopez's avatar James Lopez
Browse files

some more refactoring

parent 9053f8eb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -27,7 +27,7 @@ module BlobHelper
elsif !current_user || (current_user && can_modify_blob?(blob, project, ref))
edit_link_tag(edit_text, ide_edit_path(project, ref, path, options), common_classes)
elsif current_user && can?(current_user, :fork_project, project)
edit_blob_fork(common_classes, options, path, project, ref)
edit_blob_fork(common_classes, edit_blob_path(project, ref, path, options), project, edit_in_new_fork_notice)
end
end
 
Loading
Loading
@@ -56,7 +56,7 @@ module BlobHelper
elsif current_user && can_modify_blob?(blob, project, ref)
edit_link_tag(ide_edit_text, ide_edit_path(project, ref, path, options), common_classes)
elsif current_user && can?(current_user, :fork_project, project)
edit_blob_fork(common_classes, options, path, project, ref)
edit_blob_fork(common_classes, edit_blob_path(project, ref, path, options), project, edit_in_new_fork_notice)
end
end
 
Loading
Loading
@@ -76,7 +76,7 @@ module BlobHelper
elsif can_modify_blob?(blob, project, ref)
button_tag label, class: "#{common_classes}", 'data-target' => "#modal-#{modal_type}-blob", 'data-toggle' => 'modal'
elsif can?(current_user, :fork_project, project)
edit_blob_fork(common_classes, options, path, project, ref)
edit_blob_fork(common_classes, request.fullpath, project, edit_in_new_fork_notice_action(action), action)
end
end
 
Loading
Loading
@@ -311,10 +311,10 @@ module BlobHelper
blob if blob&.readable_text?
end
 
def edit_blob_fork(common_classes, options, path, project, ref)
def edit_blob_fork(common_classes, path, project, notice, action = 'edit')
continue_params = {
to: edit_blob_path(project, ref, path, options),
notice: edit_in_new_fork_notice,
to: path,
notice: notice,
notice_now: edit_in_new_fork_notice_now
}
fork_path = project_forks_path(project, namespace_key: current_user.namespace.id, continue: continue_params)
Loading
Loading
Loading
Loading
@@ -83,6 +83,10 @@ module TreeHelper
" A fork of this project has been created that you can make changes in, so you can submit a merge request."
end
 
def edit_in_new_fork_notice_action(action)
edit_in_new_fork_notice + " Try to #{action} this file again."
end
def commit_in_fork_help
"A new branch will be created in your fork and a new merge request will be started."
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment