Setup new fork link in sidebar and routes. #2406
This commit is contained in:
parent
a382ad99ef
commit
7765ce1875
|
@ -3,6 +3,9 @@ class Projects::ForksController < Projects::ApplicationController
|
|||
before_action :require_non_empty_project
|
||||
before_action :authorize_download_code!
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def new
|
||||
@namespaces = current_user.manageable_namespaces
|
||||
@namespaces.delete(@project.namespace)
|
||||
|
|
|
@ -47,7 +47,7 @@ module BlobHelper
|
|||
notice: edit_in_new_fork_notice,
|
||||
notice_now: edit_in_new_fork_notice_now
|
||||
}
|
||||
fork_path = namespace_project_fork_path(project.namespace, project, namespace_key: current_user.namespace.id,
|
||||
fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id,
|
||||
continue: continue_params)
|
||||
|
||||
link_to "Edit", fork_path, class: 'btn btn-small', method: :post
|
||||
|
@ -73,7 +73,7 @@ module BlobHelper
|
|||
notice: edit_in_new_fork_notice + " Try to #{action} this file again.",
|
||||
notice_now: edit_in_new_fork_notice_now
|
||||
}
|
||||
fork_path = namespace_project_fork_path(project.namespace, project, namespace_key: current_user.namespace.id,
|
||||
fork_path = namespace_project_forks_path(project.namespace, project, namespace_key: current_user.namespace.id,
|
||||
continue: continue_params)
|
||||
|
||||
link_to label, fork_path, class: "btn btn-#{btn_class}", method: :post
|
||||
|
|
|
@ -116,7 +116,7 @@ module ProjectsHelper
|
|||
private
|
||||
|
||||
def get_project_nav_tabs(project, current_user)
|
||||
nav_tabs = [:home]
|
||||
nav_tabs = [:home, :forks]
|
||||
|
||||
if !project.empty_repo? && can?(current_user, :download_code, project)
|
||||
nav_tabs << [:files, :commits, :network, :graphs]
|
||||
|
|
|
@ -98,6 +98,13 @@
|
|||
%span
|
||||
Wiki
|
||||
|
||||
- if project_nav_tab? :forks
|
||||
= nav_link(controller: :forks, action: :index) do
|
||||
= link_to namespace_project_forks_path(@project.namespace, @project), title: 'Forks', class: 'shortcuts-wiki' do
|
||||
= icon('book fw')
|
||||
%span
|
||||
Forks
|
||||
|
||||
- if project_nav_tab? :snippets
|
||||
= nav_link(controller: :snippets) do
|
||||
= link_to namespace_project_snippets_path(@project.namespace, @project), title: 'Snippets', class: 'shortcuts-snippets' do
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
- continue_params = { to: namespace_project_new_blob_path(@project.namespace, @project, @project.default_branch || 'master'),
|
||||
notice: edit_in_new_fork_notice,
|
||||
notice_now: edit_in_new_fork_notice_now }
|
||||
- fork_path = namespace_project_fork_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
- fork_path = namespace_project_forks_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
continue: continue_params)
|
||||
= link_to fork_path, method: :post do
|
||||
= icon('file fw')
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
%span.count
|
||||
= @project.forks_count
|
||||
- else
|
||||
= link_to new_namespace_project_fork_path(@project.namespace, @project), title: "Fork project", class: 'btn has_tooltip' do
|
||||
= link_to new_namespace_project_forks_path(@project.namespace, @project), title: "Fork project", class: 'btn has_tooltip' do
|
||||
= icon('code-fork fw')
|
||||
Fork
|
||||
%div.count-with-arrow
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
- else
|
||||
.fork-thumbnail
|
||||
= link_to namespace_project_fork_path(@project.namespace, @project, namespace_key: namespace.id), title: "Fork here", method: "POST", class: 'has_tooltip' do
|
||||
= link_to namespace_project_forks_path(@project.namespace, @project, namespace_key: namespace.id), title: "Fork here", method: "POST", class: 'has_tooltip' do
|
||||
= image_tag namespace_icon(namespace, 100)
|
||||
.caption
|
||||
%strong
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
- continue_params = { to: namespace_project_new_blob_path(@project.namespace, @project, @id),
|
||||
notice: edit_in_new_fork_notice,
|
||||
notice_now: edit_in_new_fork_notice_now }
|
||||
- fork_path = namespace_project_fork_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
- fork_path = namespace_project_forks_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
continue: continue_params)
|
||||
= link_to fork_path, method: :post do
|
||||
= icon('pencil fw')
|
||||
|
@ -49,7 +49,7 @@
|
|||
- continue_params = { to: request.fullpath,
|
||||
notice: edit_in_new_fork_notice + " Try to upload a file again.",
|
||||
notice_now: edit_in_new_fork_notice_now }
|
||||
- fork_path = namespace_project_fork_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
- fork_path = namespace_project_forks_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
continue: continue_params)
|
||||
= link_to fork_path, method: :post do
|
||||
= icon('file fw')
|
||||
|
@ -58,7 +58,7 @@
|
|||
- continue_params = { to: request.fullpath,
|
||||
notice: edit_in_new_fork_notice + " Try to create a new directory again.",
|
||||
notice_now: edit_in_new_fork_notice_now }
|
||||
- fork_path = namespace_project_fork_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
- fork_path = namespace_project_forks_path(@project.namespace, @project, namespace_key: current_user.namespace.id,
|
||||
continue: continue_params)
|
||||
= link_to fork_path, method: :post do
|
||||
= icon('folder fw')
|
||||
|
|
|
@ -554,7 +554,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resource :fork, only: [:new, :create]
|
||||
resources :forks, only: [:index, :new, :create]
|
||||
resource :import, only: [:new, :create, :show]
|
||||
|
||||
resources :refs, only: [] do
|
||||
|
|
Loading…
Reference in New Issue