Commit 0283fff5 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'master' into extend_markdown_upload

# Conflicts:
#	app/views/projects/issues/_form.html.haml
#	app/views/projects/merge_requests/_form.html.haml
#	app/views/projects/merge_requests/_new_submit.html.haml
#	app/views/projects/milestones/_form.html.haml
#	app/views/projects/notes/_form.html.haml
#	app/views/projects/wikis/_form.html.haml
#	config/routes.rb
#	spec/controllers/projects_controller_spec.rb
parents aba12515 7561b1c2
Please view this file on the master branch, on stable branches it's out of date.
v 7.9.0 (unreleased)
- Move labels/milestones tabs to sidebar
- Upgrade Rails gem to version 4.1.9.
- Improve error messages for file edit failures
- Improve UI for commits, issues and merge request lists
- Fix commit comments on first line of diff not rendering in Merge Request Discussion view.
v 7.8.0 (unreleased)
v 7.8.0
- Fix access control and protection against XSS for note attachments and other uploads.
- Fix broken access control for note attachments (Hannes Rosenögger)
- Generalize image upload in drag and drop in markdown to all files (Hannes Rosenögger)
......
......@@ -176,9 +176,6 @@ gem 'ace-rails-ap'
# Keyboard shortcuts
gem 'mousetrap-rails'
# Semantic UI Sass for Sidebar
gem 'semantic-ui-sass', '~> 1.8.0'
gem "sass-rails", '~> 4.0.2'
gem "coffee-rails"
gem "uglifier"
......@@ -251,8 +248,8 @@ group :development, :test do
gem 'jasmine', '2.0.2'
gem "spring", '1.1.3'
gem "spring-commands-rspec", '1.0.1'
gem "spring", '1.3.1'
gem "spring-commands-rspec", '1.0.4'
gem "spring-commands-spinach", '1.0.0'
end
......
......@@ -3,31 +3,31 @@ GEM
specs:
RedCloth (4.2.9)
ace-rails-ap (2.0.1)
actionmailer (4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
mail (~> 2.5.4)
actionpack (4.1.1)
actionview (= 4.1.1)
activesupport (= 4.1.1)
actionmailer (4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.9)
actionview (= 4.1.9)
activesupport (= 4.1.9)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.1)
activesupport (= 4.1.1)
actionview (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.1)
activesupport (= 4.1.1)
activemodel (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
activerecord (4.1.1)
activemodel (= 4.1.1)
activesupport (= 4.1.1)
activerecord (4.1.9)
activemodel (= 4.1.9)
activesupport (= 4.1.9)
arel (~> 5.0.0)
activeresource (4.0.0)
activemodel (~> 4.0)
activesupport (~> 4.0)
rails-observers (~> 0.1.1)
activesupport (4.1.1)
activesupport (4.1.9)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
......@@ -81,7 +81,7 @@ GEM
json (>= 1.7)
celluloid (0.16.0)
timers (~> 4.0.0)
charlock_holmes (0.6.9.4)
charlock_holmes (0.7.3)
cliver (0.3.2)
coderay (1.1.0)
coercible (1.0.0)
......@@ -312,9 +312,8 @@ GEM
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.1)
......@@ -381,7 +380,6 @@ GEM
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
polyglot (0.3.4)
posix-spawn (0.3.9)
powerpack (0.0.9)
pry (0.9.12.4)
......@@ -412,30 +410,30 @@ GEM
rack (>= 1.1)
rack-protection (1.5.1)
rack
rack-test (0.6.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.1)
actionmailer (= 4.1.1)
actionpack (= 4.1.1)
actionview (= 4.1.1)
activemodel (= 4.1.1)
activerecord (= 4.1.1)
activesupport (= 4.1.1)
rails (4.1.9)
actionmailer (= 4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
activemodel (= 4.1.9)
activerecord (= 4.1.9)
activesupport (= 4.1.9)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.1)
railties (= 4.1.9)
sprockets-rails (~> 2.0)
rails-observers (0.1.2)
activemodel (~> 4.0)
rails_autolink (1.1.6)
rails (> 3.1)
railties (4.1.1)
actionpack (= 4.1.1)
activesupport (= 4.1.1)
railties (4.1.9)
actionpack (= 4.1.9)
activesupport (= 4.1.9)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.13.0)
rake (10.3.2)
rake (10.4.2)
raphael-rails (2.1.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
......@@ -518,8 +516,6 @@ GEM
activesupport (>= 3.1, < 4.2)
select2-rails (3.5.2)
thor (~> 0.14)
semantic-ui-sass (1.8.0.0)
sass (~> 3.2)
settingslogic (2.0.9)
shoulda-matchers (2.7.0)
activesupport (>= 3.0.0)
......@@ -552,8 +548,8 @@ GEM
capybara (>= 2.0.0)
railties (>= 3)
spinach (>= 0.4)
spring (1.1.3)
spring-commands-rspec (1.0.1)
spring (1.3.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
spring-commands-spinach (1.0.0)
spring (>= 0.9.1)
......@@ -562,10 +558,10 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sprockets (>= 2.8, < 4.0)
stamp (0.5.0)
state_machine (1.2.0)
stringex (2.5.2)
......@@ -596,9 +592,6 @@ GEM
multi_json (~> 1.7)
twitter-stream (~> 0.1)
tins (0.13.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.0.0)
coffee-rails
twitter-stream (0.1.16)
......@@ -746,7 +739,6 @@ DEPENDENCIES
sdoc
seed-fu
select2-rails
semantic-ui-sass (~> 1.8.0)
settingslogic
shoulda-matchers (~> 2.7.0)
sidekiq (~> 3.3)
......@@ -756,8 +748,8 @@ DEPENDENCIES
slack-notifier (~> 1.0.0)
slim
spinach-rails
spring (= 1.1.3)
spring-commands-rspec (= 1.0.1)
spring (= 1.3.1)
spring-commands-rspec (= 1.0.4)
spring-commands-spinach (= 1.0.0)
stamp
state_machine
......
......@@ -16,6 +16,7 @@
#= require jquery.scrollTo
#= require jquery.blockUI
#= require jquery.turbolinks
#= require jquery.sticky-kit.min
#= require turbolinks
#= require autosave
#= require bootstrap
......@@ -32,7 +33,6 @@
#= require nprogress
#= require nprogress-turbolinks
#= require dropzone
#= require semantic-ui/sidebar
#= require mousetrap
#= require mousetrap/pause
#= require shortcuts
......@@ -115,7 +115,6 @@ if location.hash
window.addEventListener "hashchange", shiftWindow
$ ->
# Click a .one_click_select field, select the contents
$(".one_click_select").on 'click', -> $(@).select()
......@@ -183,6 +182,8 @@ $ ->
form = btn.closest("form")
new ConfirmDangerModal(form, text)
new Aside()
(($) ->
# Disable an element and add the 'disabled' Bootstrap class
$.fn.extend disable: ->
......
class @Aside
constructor: ->
$(document).off "click", "a.show-aside"
$(document).on "click", 'a.show-aside', (e) ->
e.preventDefault()
btn = $(e.currentTarget)
icon = btn.find('i')
console.log('1')
if icon.hasClass('fa-angle-left')
btn.parent().find('section').hide()
btn.parent().find('aside').fadeIn()
icon.removeClass('fa-angle-left').addClass('fa-angle-right')
else
btn.parent().find('aside').hide()
btn.parent().find('section').fadeIn()
icon.removeClass('fa-angle-right').addClass('fa-angle-left')
......@@ -36,6 +36,8 @@ class @Diff
)
)
$('.diff-header').stick_in_parent(offset_top: $('.navbar').height())
lineNumbers: (line) ->
return ([0, 0]) unless line.children().length
lines = line.children().slice(0, 2)
......
......@@ -26,7 +26,7 @@ class Dispatcher
new ZenMode()
when 'projects:milestones:show'
new Milestone()
when 'projects:milestones:new'
when 'projects:milestones:new', 'projects:milestones:edit'
new ZenMode()
when 'projects:issues:new','projects:issues:edit'
GitLab.GfmAutoComplete.setup()
......@@ -54,6 +54,7 @@ class Dispatcher
when 'projects:commit:show'
new Commit()
new Diff()
new ZenMode()
shortcut_handler = new ShortcutsNavigation()
when 'projects:commits:show'
shortcut_handler = new ShortcutsNavigation()
......
responsive_resize = ->
current_width = $(window).width()
if current_width < 985
$('.responsive-side').addClass("ui right wide sidebar")
else
$('.responsive-side').removeClass("ui right wide sidebar")
$ ->
# Depending on window size, set the sidebar offscreen.
responsive_resize()
$('.sidebar-expand-button').click ->
$('.ui.sidebar')
.sidebar({overlay: true})
.sidebar('toggle')
# Hide sidebar on click outside of sidebar
$(document).mouseup (e) ->
container = $(".ui.sidebar")
container.sidebar "hide" if not container.is(e.target) and container.has(e.target).length is 0
return
# On resize, check if sidebar should be offscreen.
$(window).resize ->
responsive_resize()
return
$(document).on("click", '.toggle-nav-collapse', (e) ->
e.preventDefault()
collapsed = 'page-sidebar-collapsed'
......
......@@ -55,8 +55,3 @@
* Styles for JS behaviors.
*/
@import "behaviors.scss";
/**
* Styles for responsive sidebar
*/
@import "semantic-ui/modules/sidebar";
......@@ -35,8 +35,8 @@
&.s16 { font-size: 12px; line-height: 1.33; }
&.s24 { font-size: 14px; line-height: 1.8; }
&.s26 { font-size: 20px; line-height: 1.33; }
&.s32 { font-size: 24px; line-height: 1.33; }
&.s60 { font-size: 45px; line-height: 1.33; }
&.s90 { font-size: 68px; line-height: 1.33; }
&.s160 { font-size: 120px; line-height: 1.33; }
&.s32 { font-size: 22px; line-height: 32px; }
&.s60 { font-size: 32px; line-height: 60px; }
&.s90 { font-size: 36px; line-height: 90px; }
&.s160 { font-size: 96px; line-height: 1.33; }
}
......@@ -50,4 +50,24 @@
.issue_edited_ago, .note_edited_ago {
display: none;
}
aside {
display: none;
}
.show-aside {
display: block !important;
}
}
.show-aside {
display: none;
position: fixed;
right: 0px;
top: 30%;
padding: 5px 15px;
background: #EEE;
font-size: 20px;
color: #777;
@include box-shadow(0 1px 2px #DDD);
}
.ui.sidebar {
z-index: 1000 !important;
background: #fff;
padding: 10px;
width: 285px;
}
.ui.right.sidebar {
border-left: 1px solid #e1e1e1;
border-right: 0;
}
.sidebar-expand-button {
cursor: pointer;
transition: all 0.4s;
-moz-transition: all 0.4s;
-webkit-transition: all 0.4s;
}
.fixed.sidebar-expand-button {
background: #f9f9f9;
color: #555;
padding: 9px 12px 6px 14px;
border: 1px solid #E1E1E1;
border-right: 0;
position: fixed;
top: 108px;
right: 0px;
margin-right: 0;
&:hover {
background: #ddd;
color: #333;
padding-right: 25px;
}
}
.btn.btn-default.sidebar-expand-button {
margin-left: 12px;
display: inline-block !important;
}
@media (min-width: 767px) {
.btn.btn-default.sidebar-expand-button {
display: none!important;
}
}
......@@ -84,7 +84,6 @@
margin-left: 10px;
float: left;
margin-right: 15px;
font-size: 20px;
margin-bottom: 15px;
i {
......
......@@ -47,7 +47,7 @@
border-left: 3px solid $style_color;
&.no-highlight {
background: none;
background: none !important;
border: none;
}
......
......@@ -111,6 +111,8 @@
color: $link_color;
&.active {
background-color: #f5f5f5;
border: 1px solid rgba(0,0,0,0.195);
color: #333;
font-weight: bold;
}
......
......@@ -120,13 +120,13 @@
}
.readme-holder {
border-top: 1px dashed #CCC;
padding-top: 10px;
.readme-file-title {
font-size: 14px;
font-weight: bold;
margin-bottom: 20px;
color: #777;
border-bottom: 1px solid #DDD;
padding: 10px 0;
}
}
......
......@@ -25,13 +25,16 @@ class Admin::ProjectsController < Admin::ApplicationController
def transfer
::Projects::TransferService.new(@project, current_user, params.dup).execute
redirect_to [:admin, @project.reload]
@project.reload
redirect_to admin_namespace_project_path(@project.namespace, @project)
end
protected
def project
@project = Project.find_with_namespace(params[:id])
@project = Project.find_with_namespace(
[params[:namespace_id], '/', params[:id]].join('')
)
@project || render_404
end
......
......@@ -93,6 +93,7 @@ class ApplicationController < ActionController::Base
def project
unless @project
namespace = params[:namespace_id]
id = params[:project_id] || params[:id]
# Redirect from
......@@ -104,7 +105,7 @@ class ApplicationController < ActionController::Base
redirect_to request.original_url.gsub(/\.git\Z/, '') and return
end
@project = Project.find_with_namespace(id)
@project = Project.find_with_namespace("#{namespace}/#{id}")
if @project and can?(current_user, :read_project, @project)
@project
......@@ -121,7 +122,8 @@ class ApplicationController < ActionController::Base
def repository
@repository ||= project.repository
rescue Grit::NoSuchPathError
rescue Grit::NoSuchPathError(e)
log_exception(e)
nil
end
......
......@@ -8,7 +8,8 @@ class Projects::ApplicationController < ApplicationController
# for non-signed users
if !current_user
id = params[:project_id] || params[:id]
@project = Project.find_with_namespace(id)
project_with_namespace = "#{params[:namespace_id]}/#{id}"
@project = Project.find_with_namespace(project_with_namespace)
return if @project && @project.public?
end
......@@ -26,7 +27,10 @@ class Projects::ApplicationController < ApplicationController
def require_branch_head
unless @repository.branch_names.include?(@ref)
redirect_to project_tree_path(@project, @ref), notice: "This action is not allowed unless you are on top of a branch"
redirect_to(
namespace_project_tree_path(@project.namespace, @project, @ref),
notice: "This action is not allowed unless you are on top of a branch"
)
end
end
end
......@@ -24,6 +24,6 @@ class Projects::AvatarsController < Projects::ApplicationController
@project.save
@project.reset_events_cache
redirect_to edit_project_path(@project)
redirect_to edit_namespace_project_path(@project.namespace, @project)
end
end
......@@ -25,7 +25,7 @@ class Projects::BlobController < Projects::ApplicationController
if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed"
redirect_to project_blob_path(@project, File.join(@ref, file_path))
redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(@ref, file_path))
else
flash[:alert] = result[:message]
render :new
......@@ -70,7 +70,8 @@ class Projects::BlobController < Projects::ApplicationController
if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed"
redirect_to project_tree_path(@project, @ref)
redirect_to namespace_project_tree_path(@project.namespace, @project,
@ref)
else
flash[:alert] = result[:message]
render :show
......@@ -102,7 +103,7 @@ class Projects::BlobController < Projects::ApplicationController
else
if tree = @repository.tree(@commit.id, @path)
if tree.entries.any?
redirect_to project_tree_path(@project, File.join(@ref, @path)) and return
redirect_to namespace_project_tree_path(@project.namespace, @project, File.join(@ref, @path)) and return
end
end
......@@ -128,10 +129,10 @@ class Projects::BlobController < Projects::ApplicationController
def after_edit_path
@after_edit_path ||=
if from_merge_request
diffs_project_merge_request_path(from_merge_request.target_project, from_merge_request) +
diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) +
"#file-path-#{hexdigest(@path)}"
else
project_blob_path(@project, @id)
namespace_project_blob_path(@project.namespace, @project, @id)
end
end
......
......@@ -23,7 +23,8 @@ class Projects::BranchesController < Projects::ApplicationController
if result[:status] == :success
@branch = result[:branch]
redirect_to project_tree_path(@project, @branch.name)
redirect_to namespace_project_tree_path(@project.namespace, @project,
@branch.name)
else
@error = result[:message]
render action: 'new'
......@@ -35,7 +36,10 @@ class Projects::BranchesController < Projects::ApplicationController
@branch_name = params[:id]
respond_to do |format|
format.html { redirect_to project_branches_path(@project) }
format.html do
redirect_to namespace_project_branches_path(@project.namespace,
@project)
end
format.js
end
end
......
......@@ -25,6 +25,7 @@ class Projects::CompareController < Projects::ApplicationController
end
def create
redirect_to project_compare_path(@project, params[:from], params[:to])
redirect_to namespace_project_compare_path(@project.namespace, @project,
params[:from], params[:to])
end
end
......@@ -25,7 +25,8 @@ class Projects::DeployKeysController < Projects::ApplicationController
@key = DeployKey.new(deploy_key_params)
if @key.valid? && @project.deploy_keys << @key
redirect_to project_deploy_keys_path(@project)
redirect_to namespace_project_deploy_keys_path(@project.namespace,
@project)
else
render "new"
end
......@@ -44,13 +45,15 @@ class Projects::DeployKeysController < Projects::ApplicationController
def enable
@project.deploy_keys << available_keys.find(params[:id])
redirect_to project_deploy_keys_path(@project)
redirect_to namespace_project_deploy_keys_path(@project.namespace,
@project)
end
def disable
@project.deploy_keys_projects.where(deploy_key_id: params[:id]).last.destroy
redirect_to project_deploy_keys_path(@project)
redirect_to namespace_project_deploy_keys_path(@project.namespace,
@project)
end
protected
......
......@@ -9,11 +9,14 @@ class Projects::ForksController < Projects::ApplicationController
end
def create
namespace = Namespace.find(params[:namespace_id])
namespace = Namespace.find(params[:namespace_key])
@forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
if @forked_project.saved? && @forked_project.forked?
redirect_to(@forked_project, notice: 'Project was successfully forked.')
redirect_to(
namespace_project_path(@forked_project.namespace, @forked_project),
notice: 'Project was successfully forked.'
)
else
@title = 'Fork project'
render :error
......
......@@ -16,7 +16,7 @@ class Projects::HooksController < Projects::ApplicationController
@hook.save
if @hook.valid?
redirect_to project_hooks_path(@project)
redirect_to namespace_project_hooks_path(@project.namespace, @project)
else
@hooks = @project.hooks.select(&:persisted?)
render :index
......@@ -43,7 +43,7 @@ class Projects::HooksController < Projects::ApplicationController
def destroy
hook.destroy
redirect_to project_hooks_path(@project)
redirect_to namespace_project_hooks_path(@project.namespace, @project)
end
private
......
......@@ -20,7 +20,7 @@ class Projects::ImportsController < Projects::ApplicationController
end
end
redirect_to project_import_path(@project)
redirect_to namespace_project_import_path(@project.namespace, @project)
end
def show
......@@ -28,7 +28,8 @@ class Projects::ImportsController < Projects::ApplicationController
if @project.import_finished?
redirect_to(@project) and return
else
redirect_to new_project_import_path(@project) and return
redirect_to new_namespace_project_import_path(@project.namespace,
@project) && return
end
end
end
......@@ -37,13 +38,14 @@ class Projects::ImportsController < Projects::ApplicationController
def require_no_repo
if @project.repository_exists?
redirect_to(@project) and return
redirect_to(namespace_project_path(@project.namespace, @project)) and return
end
end
def redirect_if_progress
if @project.import_in_progress?
redirect_to project_import_path(@project) and return
redirect_to namespace_project_import_path(@project.namespace, @project) &&
return
end
end
end
......@@ -60,7 +60,8 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to do |format|
format.html do
if @issue.valid?
redirect_to project_issue_path(@project, @issue)
redirect_to namespace_project_issue_path(@project.namespace,
@project, @issue)
else
render :new
end
......@@ -78,7 +79,7 @@ class Projects::IssuesController < Projects::ApplicationController
format.js
format.html do
if @issue.valid?
redirect_to [@project, @issue]
redirect_to [@project.namespace.becomes(Namespace), @project, @issue]
else
render :edit
end
......@@ -128,7 +129,8 @@ class Projects::IssuesController < Projects::ApplicationController
issue = @project.issues.find_by(id: params[:id])
if issue
redirect_to project_issue_path(@project, issue)
redirect_to namespace_project_issue_path(@project.namespace, @project,
issue)
return
else
raise ActiveRecord::RecordNotFound.new
......
......@@ -18,7 +18,7 @@ class Projects::LabelsController < Projects::ApplicationController
@label = @project.labels.create(label_params)
if @label.valid?
redirect_to project_labels_path(@project)
redirect_to namespace_project_labels_path(@project.namespace, @project)
else
render 'new'
end
......@@ -29,7 +29,7 @@ class Projects::LabelsController < Projects::ApplicationController
def update
if @label.update_attributes(label_params)
redirect_to project_labels_path(@project)
redirect_to namespace_project_labels_path(@project.namespace, @project)
else
render 'edit'
end
......@@ -39,11 +39,12 @@ class Projects::LabelsController < Projects::ApplicationController
Gitlab::IssuesLabels.generate(@project)
if params[:redirect] == 'issues'
redirect_to project_issues_path(@project)
redirect_to namespace_project_issues_path(@project.namespace, @project)
elsif params[:redirect] == 'merge_requests'
redirect_to project_merge_requests_path(@project)
redirect_to namespace_project_merge_requests_path(@project.namespace,
@project)
else
redirect_to project_labels_path(@project)
redirect_to namespace_project_labels_path(@project.namespace, @project)
end
end
......@@ -51,7 +52,10 @@ class Projects::LabelsController < Projects::ApplicationController
@label.destroy
respond_to do |format|
format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
format.html do
redirect_to(namespace_project_labels_path(@project.namespace, @project),
notice: 'Label was removed')
end
format.js
end
end
......
......@@ -78,7 +78,12 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request = MergeRequests::CreateService.new(project, current_user, merge_request_params).execute
if @merge_request.valid?
redirect_to project_merge_request_path(@merge_request.target_project, @merge_request), notice: 'Merge request was successfully created.'
redirect_to(
namespace_project_merge_request_path(@merge_request.target_project.namespace,
@merge_request.target_project,
@merge_request),
notice: 'Merge request was successfully created.'
)
else
@source_project = @merge_request.source_project
@target_project = @merge_request.target_project
......@@ -93,7 +98,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to do |format|
format.js
format.html do
redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully updated.'
redirect_to([@merge_request.target_project.namespace.becomes(Namespace),
@merge_request.target_project, @merge_request],
notice: 'Merge request was successfully updated.')
end
end
else
......
......@@ -40,7 +40,8 @@ class Projects::MilestonesController < Projects::ApplicationController
@milestone = Milestones::CreateService.new(project, current_user, milestone_params).execute
if @milestone.save
redirect_to project_milestone_path(@project, @milestone)
redirect_to namespace_project_milestone_path(@project.namespace,
@project, @milestone)
else
render "new"
end
......@@ -67,7 +68,7 @@ class Projects::MilestonesController < Projects::ApplicationController
@milestone.destroy
respond_to do |format|
format.html { redirect_to project_milestones_path }
format.html { redirect_to namespace_project_milestones_path }
format.js { render nothing: true }
end
end
......
......@@ -12,7 +12,8 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
def create
@project.protected_branches.create(protected_branch_params)
redirect_to project_protected_branches_path(@project)
redirect_to namespace_project_protected_branches_path(@project.namespace,
@project)
end
def update
......@@ -37,7 +38,7 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
@project.protected_branches.find(params[:id]).destroy
respond_to do |format|
format.html { redirect_to project_protected_branches_path }
format.html { redirect_to namespace_project_protected_branches_path }
format.js { render nothing: true }
end
end
......
......@@ -9,13 +9,15 @@ class Projects::RefsController < Projects::ApplicationController
respond_to do |format|
format.html do
new_path = if params[:destination] == "tree"
project_tree_path(@project, (@id))
namespace_project_tree_path(@project.namespace, @project,
(@id))
elsif params[:destination] == "blob"
project_blob_path(@project, (@id))
namespace_project_blob_path(@project.namespace, @project,
(@id))
elsif params[:destination] == "graph"
project_network_path(@project, @id, @options)
namespace_project_network_path(@project.namespace, @project, @id, @options)
else
project_commits_path(@project, @id)
namespace_project_commits_path(@project.namespace, @project, @id)
end
redirect_to new_path
......
......@@ -7,7 +7,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
def create
@project.create_repository
redirect_to @project
redirect_to namespace_project_path(@project.namespace, @project)
end
def archive
......
......@@ -17,8 +17,11 @@ class Projects::ServicesController < Projects::ApplicationController
def update
if @service.update_attributes(service_params)
redirect_to edit_project_service_path(@project, @service.to_param),
notice: 'Successfully updated.'
redirect_to(
edit_namespace_project_service_path(@project.namespace, @project,
@service.to_param, notice:
'Successfully updated.')
)
else
render 'edit'
end
......
......@@ -32,7 +32,8 @@ class Projects::SnippetsController < Projects::ApplicationController
@snippet.author = current_user
if @snippet.save
redirect_to project_snippet_path(@project, @snippet)
redirect_to namespace_project_snippet_path(@project.namespace, @project,
@snippet)
else
respond_with(@snippet)
end
......@@ -43,7 +44,7 @@ class Projects::SnippetsController < Projects::ApplicationController
def update
if @snippet.update_attributes(snippet_params)
redirect_to project_snippet_path(@project, @snippet)
redirect_to namespace_project_snippet_path(@project.namespace, @project, @snippet)
else
respond_with(@snippet)
end
......@@ -60,7 +61,7 @@ class Projects::SnippetsController < Projects::ApplicationController
@snippet.destroy
redirect_to project_snippets_path(@project)
redirect_to namespace_project_snippets_path(@project.namespace, @project)
end
def raw
......
......@@ -16,7 +16,7 @@ class Projects::TagsController < Projects::ApplicationController
if result[:status] == :success
@tag = result[:tag]
redirect_to project_tags_path(@project)
redirect_to namespace_project_tags_path(@project.namespace, @project)
else
@error = result[:message]
render action: 'new'
......@@ -31,7 +31,7 @@ class Projects::TagsController < Projects::ApplicationController
end
respond_to do |format|
format.html { redirect_to project_tags_path }
format.html { redirect_to namespace_project_tags_path }
format.js
end
end
......
......@@ -21,7 +21,8 @@ class Projects::TeamMembersController < Projects::ApplicationController
if params[:redirect_to]
redirect_to params[:redirect_to]
else
redirect_to project_team_index_path(@project)
redirect_to namespace_project_team_index_path(@project.namespace,
@project)
end
end
......@@ -32,7 +33,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
unless @user_project_relation.valid?
flash[:alert] = "User should have at least one role"
end
redirect_to project_team_index_path(@project)
redirect_to namespace_project_team_index_path(@project.namespace, @project)
end
def destroy
......@@ -40,7 +41,10 @@ class Projects::TeamMembersController < Projects::ApplicationController
@user_project_relation.destroy
respond_to do |format|
format.html { redirect_to project_team_index_path(@project) }
format.html do
redirect_to namespace_project_team_index_path(@project.namespace,
@project)
end
format.js { render nothing: true }
end
end
......@@ -59,7 +63,8 @@ class Projects::TeamMembersController < Projects::ApplicationController
status = @project.team.import(giver)
notice = status ? "Successfully imported" : "Import failed"
redirect_to project_team_index_path(project), notice: notice
redirect_to(namespace_project_team_index_path(project.namespace, project),
notice: notice)
end
protected
......
......@@ -9,7 +9,10 @@ class Projects::TreeController < Projects::ApplicationController
def show
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
redirect_to project_blob_path(@project, File.join(@ref, @path)) and return
redirect_to(
namespace_project_blob_path(@project.namespace, @project,
File.join(@ref, @path))
) and return
else
return not_found!
end
......
......@@ -45,7 +45,7 @@ class Projects::WikisController < Projects::ApplicationController
return render('empty') unless can?(current_user, :write_wiki, @project)
if @page.update(content, format, message)
redirect_to [@project, @page], notice: 'Wiki was successfully updated.'
redirect_to [@project.namespace.becomes(Namespace), @project, @page], notice: 'Wiki was successfully updated.'
else
render 'edit'
end
......@@ -55,7 +55,10 @@ class Projects::WikisController < Projects::ApplicationController
@page = WikiPage.new(@project_wiki)
if @page.create(wiki_params)
redirect_to project_wiki_path(@project, @page), notice: 'Wiki was successfully updated.'
redirect_to(
namespace_project_wiki_path(@project.namespace, @project, @page),
notice: 'Wiki was successfully updated.'
)
else
render action: "edit"
end
......@@ -65,7 +68,10 @@ class Projects::WikisController < Projects::ApplicationController
@page = @project_wiki.find_page(params[:id])
unless @page
redirect_to(project_wiki_path(@project, :home), notice: "Page not found")
redirect_to(
namespace_project_wiki_path(@project.namespace, @project, :home),
notice: "Page not found"
)
end
end
......@@ -73,7 +79,10 @@ class Projects::WikisController < Projects::ApplicationController
@page = @project_wiki.find_page(params[:id])
@page.delete if @page
redirect_to project_wiki_path(@project, :home), notice: "Page was successfully deleted"
redirect_to(
namespace_project_wiki_path(@project.namespace, @project, :home),
notice: "Page was successfully deleted"
)
end
def git_access
......
......@@ -22,7 +22,10 @@ class ProjectsController < ApplicationController
@project = ::Projects::CreateService.new(current_user, project_params).execute
if @project.saved?
redirect_to project_path(@project), notice: 'Project was successfully created.'
redirect_to(
namespace_project_path(@project.namespace, @project),
notice: 'Project was successfully created.'
)
else
render 'new'
end
......@@ -34,7 +37,12 @@ class ProjectsController < ApplicationController
respond_to do |format|
if status
flash[:notice] = 'Project was successfully updated.'
format.html { redirect_to edit_project_path(@project), notice: 'Project was successfully updated.' }
format.html do
redirect_to(
edit_namespace_project_path(@project.namespace, @project),
notice: 'Project was successfully updated.'
)
end
format.js
else
format.html { render 'edit', layout: 'project_settings' }
......@@ -44,7 +52,8 @@ class ProjectsController < ApplicationController
end
def transfer
::Projects::TransferService.new(project, current_user, project_params).execute
transfer_params = params.permit(:new_namespace_id)
::Projects::TransferService.new(project, current_user, transfer_params).execute
if @project.errors[:namespace_id].present?
flash[:alert] = @project.errors[:namespace_id].first
end
......@@ -52,7 +61,7 @@ class ProjectsController < ApplicationController
def show
if @project.import_in_progress?
redirect_to project_import_path(@project)
redirect_to namespace_project_import_path(@project.namespace, @project)
return
end
......@@ -93,7 +102,7 @@ class ProjectsController < ApplicationController
flash[:alert] = 'Project deleted.'
if request.referer.include?('/admin')
redirect_to admin_projects_path
redirect_to admin_namespace_projects_path
else
redirect_to projects_dashboard_path
end
......@@ -124,7 +133,7 @@ class ProjectsController < ApplicationController
@project.archive!
respond_to do |format|
format.html { redirect_to @project }
format.html { redirect_to namespace_project_path(@project.namespace, @project) }
end
end
......@@ -133,7 +142,7 @@ class ProjectsController < ApplicationController
@project.unarchive!
respond_to do |format|
format.html { redirect_to @project }
format.html { redirect_to namespace_project_path(@project.namespace, @project) }
end
end
......
class UploadsController < ApplicationController
skip_before_filter :authenticate_user!, :reject_blocked!
before_filter :authorize_access
def show
model = params[:model].camelize.constantize.find(params[:id])
uploader = model.send(params[:mounted_as])
......@@ -12,4 +15,10 @@ class UploadsController < ApplicationController
disposition = uploader.image? ? 'inline' : 'attachment'
send_file uploader.file.path, disposition: disposition
end
def authorize_access
unless params[:mounted_as] == 'avatar'
authenticate_user! && reject_blocked!
end
end
end
......@@ -61,7 +61,7 @@ module ApplicationHelper
if project.avatar.present?
image_tag project.avatar.url, options
elsif project.avatar_in_git
image_tag project_avatar_path(project), options
image_tag namespace_project_avatar_path(project.namespace, project), options
else # generated icon
project_identicon(project, options)
end
......
......@@ -36,8 +36,12 @@ module BlobHelper
link_opts[:from_merge_request_id] = from_mr if from_mr
cls = 'btn btn-small'
if allowed_tree_edit?(project, ref)
link_to text, project_edit_blob_path(project, tree_join(ref, path),
link_opts), class: cls
link_to(text,
namespace_project_edit_blob_path(project.namespace, project,
tree_join(ref, path),
link_opts),
class: cls
)
else
content_tag :span, text, class: cls + ' disabled'
end + after.html_safe
......
......@@ -37,7 +37,10 @@ module CommitsHelper
# Add the root project link and the arrow icon
crumbs = content_tag(:li) do
link_to(@project.path, project_commits_path(@project, @ref))
link_to(
@project.path,
namespace_project_commits_path(@project.namespace, @project, @ref)
)
end
if @path
......@@ -46,7 +49,14 @@ module CommitsHelper
parts.each_with_index do |part, i|
crumbs << content_tag(:li) do
# The text is just the individual part, but the link needs all the parts before it
link_to part, project_commits_path(@project, tree_join(@ref, parts[0..i].join('/')))
link_to(
part,
namespace_project_commits_path(
@project.namespace,
@project,
tree_join(@ref, parts[0..i].join('/'))
)
)
end
end
end
......@@ -63,7 +73,9 @@ module CommitsHelper
# Returns the sorted alphabetically links to branches, separated by a comma
def commit_branches_links(project, branches)
branches.sort.map do |branch|
link_to(project_tree_path(project, branch)) do
link_to(
namespace_project_tree_path(project.namespace, project, branch)
) do
content_tag :span, class: 'label label-gray' do
icon('code-fork') + ' ' + branch
end
......@@ -75,7 +87,10 @@ module CommitsHelper
def commit_tags_links(project, tags)
sorted = VersionSorter.rsort(tags)
sorted.map do |tag|
link_to(project_commits_path(project, project.repository.find_tag(tag).name)) do
link_to(
namespace_project_commits_path(project.namespace, project,
project.repository.find_tag(tag).name)
) do
content_tag :span, class: 'label label-gray' do
icon('tag') + ' ' + tag
end
......@@ -86,12 +101,26 @@ module CommitsHelper
def link_to_browse_code(project, commit)
if current_controller?(:projects, :commits)
if @repo.blob_at(commit.id, @path)
return link_to "Browse File »", project_blob_path(project, tree_join(commit.id, @path)), class: "pull-right"
return link_to(
"Browse File »",
namespace_project_blob_path(project.namespace, project,
tree_join(commit.id, @path)),
class: "pull-right"
)
elsif @path.present?
return link_to "Browse Dir »", project_tree_path(project, tree_join(commit.id, @path)), class: "pull-right"
return link_to(
"Browse Dir »",
namespace_project_tree_path(project.namespace, project,
tree_join(commit.id, @path)),
class: "pull-right"
)
end
end
link_to "Browse Code »", project_tree_path(project, commit), class: "pull-right"
link_to(
"Browse Code »",
namespace_project_tree_path(project.namespace, project, commit),
class: "pull-right"
)
end
protected
......@@ -133,8 +162,11 @@ module CommitsHelper
end
def view_file_btn(commit_sha, diff, project)
link_to project_blob_path(project, tree_join(commit_sha, diff.new_path)),
class: 'btn btn-small view-file js-view-file' do
link_to(
namespace_project_blob_path(project.namespace, project,
tree_join(commit_sha, diff.new_path)),
class: 'btn btn-small view-file js-view-file'
) do
raw('View file @') + content_tag(:span, commit_sha[0..6],
class: 'commit-short-id')
end
......
......@@ -10,6 +10,13 @@ module CompareHelper
end
def compare_mr_path
new_project_merge_request_path(@project, merge_request: { source_branch: params[:to], target_branch: params[:from] })
new_namespace_project_merge_request_path(
@project.namespace,
@project,
merge_request: {
source_branch: params[:to],
target_branch: params[:from]
}
)
end
end
......@@ -74,17 +74,23 @@ module EventsHelper
def event_feed_url(event)
if event.issue?
project_issue_url(event.project, event.issue)
namespace_project_issue_url(event.project.namespace, event.project,
event.issue)
elsif event.merge_request?
project_merge_request_url(event.project, event.merge_request)
namespace_project_merge_request_url(event.project.namespace,
event.project, event.merge_request)
elsif event.note? && event.note_commit?
project_commit_url(event.project, event.note_target)
namespace_project_commit_url(event.project.namespace, event.project,
event.note_target)
elsif event.note?
if event.note_target
if event.note_commit?
project_commit_path(event.project, event.note_commit_id, anchor: dom_id(event.target))
namespace_project_commit_path(event.project.namespace, event.project,
event.note_commit_id,
anchor: dom_id(event.target))
elsif event.note_project_snippet?
project_snippet_path(event.project, event.note_target)
namespace_project_snippet_path(event.project.namespace,
event.project, event.note_target)
else
event_note_target_path(event)
end
......@@ -92,12 +98,16 @@ module EventsHelper
elsif event.push?
if event.push_with_commits?
if event.commits_count > 1
project_compare_url(event.project, from: event.commit_from, to: event.commit_to)
namespace_project_compare_url(event.project.namespace, event.project,
from: event.commit_from, to:
event.commit_to)
else
project_commit_url(event.project, id: event.commit_to)
namespace_project_commit_url(event.project.namespace, event.project,
id: event.commit_to)
end
else
project_commits_url(event.project, event.ref_name)
namespace_project_commits_url(event.project.namespace, event.project,
event.ref_name)
end
end
end
......@@ -116,20 +126,30 @@ module EventsHelper
def event_note_target_path(event)
if event.note? && event.note_commit?
project_commit_path(event.project, event.note_target)
namespace_project_commit_path(event.project.namespace, event.project,
event.note_target)
else
polymorphic_path([event.project, event.note_target], anchor: dom_id(event.target))
polymorphic_path([event.project.namespace.becomes(Namespace),
event.project, event.note_target],
anchor: dom_id(event.target))
end
end
def event_note_title_html(event)
if event.note_target
if event.note_commit?
link_to project_commit_path(event.project, event.note_commit_id, anchor: dom_id(event.target)), class: "commit_short_id" do
link_to(
namespace_project_commit_path(event.project.namespace, event.project,
event.note_commit_id,
anchor: dom_id(event.target)),
class: "commit_short_id"
) do
"#{event.note_target_type} #{event.note_short_commit_id}"
end
elsif event.note_project_snippet?
link_to(project_snippet_path(event.project, event.note_target)) do
link_to(namespace_project_snippet_path(event.project.namespace,
event.project,
event.note_target)) do
"#{event.note_target_type} ##{truncate event.note_target_id}"
end
else
......
......@@ -93,8 +93,10 @@ module IssuesHelper
def issue_to_atom(xml, issue)
xml.entry do
xml.id project_issue_url(issue.project, issue)
xml.link href: project_issue_url(issue.project, issue)
xml.id namespace_project_issue_url(issue.project.namespace,
issue.project, issue)
xml.link href: namespace_project_issue_url(issue.project.namespace,
issue.project, issue)
xml.title truncate(issue.title, length: 80)
xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
xml.media :thumbnail, width: "40", height: "40", url: avatar_icon(issue.author_email)
......
module MergeRequestsHelper
def new_mr_path_from_push_event(event)
target_project = event.project.forked_from_project || event.project
new_project_merge_request_path(
new_namespace_project_merge_request_path(
event.project.namespace,
event.project,
new_mr_from_push_event(event, target_project)
)
end
def new_mr_path_for_fork_from_push_event(event)
new_project_merge_request_path(
new_namespace_project_merge_request_path(
event.project.namespace,
event.project,
new_mr_from_push_event(event, event.project.forked_from_project)
)
......
module MilestonesHelper
def milestones_filter_path(opts = {})
if @project
project_milestones_path(@project, opts)
namespace_project_milestones_path(@project.namespace, @project, opts)
elsif @group
group_milestones_path(@group, opts)
end
......
......@@ -11,7 +11,11 @@ module NotesHelper
def link_to_commit_diff_line_note(note)
if note.for_commit_diff_line?
link_to "#{note.diff_file_name}:L#{note.diff_new_line}", project_commit_path(@project, note.noteable, anchor: note.line_code)
link_to(
"#{note.diff_file_name}:L#{note.diff_new_line}",
namespace_project_commit_path(@project.namespace, @project,
note.noteable, anchor: note.line_code)
)
end
end
......
......@@ -4,7 +4,7 @@ module ProjectsHelper
end
def link_to_project(project)
link_to project do
link_to [project.namespace.becomes(Namespace), project] do
title = content_tag(:span, project.name, class: 'project-name')
if project.namespace
......@@ -42,12 +42,20 @@ module ProjectsHelper
def project_title(project)
if project.group
content_tag :span do
link_to(simple_sanitize(project.group.name), group_path(project.group)) + ' / ' + link_to(simple_sanitize(project.name), project_path(project))
link_to(
simple_sanitize(project.group.name), group_path(project.group)
) + ' / ' +
link_to(simple_sanitize(project.name),
namespace_project_path(project.namespace, project))
end
else
owner = project.namespace.owner
content_tag :span do
link_to(simple_sanitize(owner.name), user_path(owner)) + ' / ' + link_to(simple_sanitize(project.name), project_path(project))
link_to(
simple_sanitize(owner.name), user_path(owner)
) + ' / ' +
link_to(simple_sanitize(project.name),
namespace_project_path(project.namespace, project))
end
end
end
......@@ -100,7 +108,10 @@ module ProjectsHelper
content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do
link_to toggle_star_project_path(@project), link_opts do
link_to(
toggle_star_namespace_project_path(@project.namespace, @project),
link_opts
) do
toggle_html + ' ' + count_html
end
end
......@@ -222,7 +233,12 @@ module ProjectsHelper
def contribution_guide_url(project)
if project && project.repository.contribution_guide
project_blob_path(project, tree_join(project.default_branch, project.repository.contribution_guide.name))
namespace_project_blob_path(
project.namespace,
project,
tree_join(project.default_branch,
project.repository.contribution_guide.name)
)
end
end
......@@ -236,7 +252,7 @@ module ProjectsHelper
def project_wiki_path_with_version(proj, page, version, is_newest)
url_params = is_newest ? {} : { version_id: version }
project_wiki_path(proj, page, url_params)
namespace_project_wiki_path(proj.namespace, proj, page, url_params)
end
def project_status_css_class(status)
......
......@@ -52,16 +52,16 @@ module SearchHelper
ref = @ref || @project.repository.root_ref
[
{ label: "#{prefix} - Files", url: project_tree_path(@project, ref) },
{ label: "#{prefix} - Commits", url: project_commits_path(@project, ref) },
{ label: "#{prefix} - Network", url: project_network_path(@project, ref) },
{ label: "#{prefix} - Graph", url: project_graph_path(@project, ref) },
{ label: "#{prefix} - Issues", url: project_issues_path(@project) },
{ label: "#{prefix} - Merge Requests", url: project_merge_requests_path(@project) },
{ label: "#{prefix} - Milestones", url: project_milestones_path(@project) },
{ label: "#{prefix} - Snippets", url: project_snippets_path(@project) },
{ label: "#{prefix} - Team", url: project_team_index_path(@project) },
{ label: "#{prefix} - Wiki", url: project_wikis_path(@project) },
{ label: "#{prefix} - Files", url: namespace_project_tree_path(@project.namespace, @project, ref) },
{ label: "#{prefix} - Commits", url: namespace_project_commits_path(@project.namespace, @project, ref) },
{ label: "#{prefix} - Network", url: namespace_project_network_path(@project.namespace, @project, ref) },
{ label: "#{prefix} - Graph", url: namespace_project_graph_path(@project.namespace, @project, ref) },
{ label: "#{prefix} - Issues", url: namespace_project_issues_path(@project.namespace, @project) },
{ label: "#{prefix} - Merge Requests", url: namespace_project_merge_requests_path(@project.namespace, @project) },
{ label: "#{prefix} - Milestones", url: namespace_project_milestones_path(@project.namespace, @project) },
{ label: "#{prefix} - Snippets", url: namespace_project_snippets_path(@project.namespace, @project) },
{ label: "#{prefix} - Team", url: namespace_project_team_index_path(@project.namespace, @project) },
{ label: "#{prefix} - Wiki", url: namespace_project_wikis_path(@project.namespace, @project) },
]
else
[]
......@@ -84,7 +84,7 @@ module SearchHelper
sorted_by_stars.non_archived.limit(limit).map do |p|
{
label: "project: #{search_result_sanitize(p.name_with_namespace)}",
url: project_path(p)
url: namespace_project_path(p.namespace, p)
}
end
end
......
......@@ -11,7 +11,8 @@ module SnippetsHelper
def reliable_snippet_path(snippet)
if snippet.project_id?
project_snippet_path(snippet.project, snippet)
namespace_project_snippet_path(snippet.project.namespace,
snippet.project, snippet)
else
snippet_path(snippet)
end
......
......@@ -5,19 +5,22 @@ module SubmoduleHelper
def submodule_links(submodule_item, ref = nil)
url = @repository.submodule_url_for(ref, submodule_item.path)
return url, nil unless url =~ /([^\/:]+\/[^\/]+\.git)\Z/
return url, nil unless url =~ /([^\/:]+)\/([^\/]+\.git)\Z/
project = $1
namespace = $1
project = $2
project.chomp!('.git')
if self_url?(url, project)
return project_path(project), project_tree_path(project, submodule_item.id)
if self_url?(url, namespace, project)
return namespace_project_path(namespace, project),
namespace_project_tree_path(namespace, project,
submodule_item.id)
elsif relative_self_url?(url)
relative_self_links(url, submodule_item.id)
elsif github_dot_com_url?(url)
standard_links('github.com', project, submodule_item.id)
standard_links('github.com', namespace, project, submodule_item.id)
elsif gitlab_dot_com_url?(url)
standard_links('gitlab.com', project, submodule_item.id)
standard_links('gitlab.com', namespace, project, submodule_item.id)
else
return url, nil
end
......@@ -33,9 +36,10 @@ module SubmoduleHelper
url =~ /gitlab\.com[\/:][^\/]+\/[^\/]+\Z/
end
def self_url?(url, project)
return true if url == [ Gitlab.config.gitlab.url, '/', project, '.git' ].join('')
url == gitlab_shell.url_to_repo(project)
def self_url?(url, namespace, project)
return true if url == [ Gitlab.config.gitlab.url, '/', namespace, '/',
project, '.git' ].join('')
url == gitlab_shell.url_to_repo([namespace, '/', project].join(''))
end
def relative_self_url?(url)
......@@ -43,8 +47,8 @@ module SubmoduleHelper
url =~ /^((\.\/)?(\.\.\/))(?!(\.\.)|(.*\/)).*\.git\Z/ || url =~ /^((\.\/)?(\.\.\/){2})(?!(\.\.))([^\/]*)\/(?!(\.\.)|(.*\/)).*\.git\Z/
end
def standard_links(host, project, commit)
base = [ 'https://', host, '/', project ].join('')
def standard_links(host, namespace, project, commit)
base = [ 'https://', host, '/', namespace, '/', project ].join('')
return base, [ base, '/tree/', commit ].join('')
end
......@@ -54,6 +58,7 @@ module SubmoduleHelper
else
base = [ @project.group.path, '/', url[/([^\/]*)\.git/, 1] ].join('')
end
return project_path(base), project_tree_path(base, commit)
return namespace_project_path(base.namespace, base),
namespace_project_tree_path(base.namespace, base, commit)
end
end
......@@ -97,7 +97,8 @@ module TabHelper
def branches_tab_class
if current_controller?(:protected_branches) ||
current_controller?(:branches) ||
current_page?(project_repository_path(@project))
current_page?(namespace_project_repository_path(@project.namespace,
@project))
'active'
end
end
......
......@@ -3,7 +3,7 @@ module Emails
def new_issue_email(recipient_id, issue_id)
@issue = Issue.find(issue_id)
@project = @issue.project
@target_url = project_issue_url(@project, @issue)
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
mail_new_thread(@issue,
from: sender(@issue.author_id),
to: recipient(recipient_id),
......@@ -14,7 +14,7 @@ module Emails
@issue = Issue.find(issue_id)
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
@project = @issue.project
@target_url = project_issue_url(@project, @issue)
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
mail_answer_thread(@issue,
from: sender(updated_by_user_id),
to: recipient(recipient_id),
......@@ -25,7 +25,7 @@ module Emails
@issue = Issue.find issue_id
@project = @issue.project
@updated_by = User.find updated_by_user_id
@target_url = project_issue_url(@project, @issue)
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
mail_answer_thread(@issue,
from: sender(updated_by_user_id),
to: recipient(recipient_id),
......@@ -37,7 +37,7 @@ module Emails
@issue_status = status
@project = @issue.project
@updated_by = User.find updated_by_user_id
@target_url = project_issue_url(@project, @issue)
@target_url = namespace_project_issue_url(@project.namespace, @project, @issue)
mail_answer_thread(@issue,
from: sender(updated_by_user_id),
to: recipient(recipient_id),
......
......@@ -3,7 +3,9 @@ module Emails
def new_merge_request_email(recipient_id, merge_request_id)
@merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
@target_url = namespace_project_merge_request_url(@project.namespace,
@project,
@merge_request)
mail_new_thread(@merge_request,
from: sender(@merge_request.author_id),
to: recipient(recipient_id),
......@@ -14,7 +16,9 @@ module Emails
@merge_request = MergeRequest.find(merge_request_id)
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
@target_url = namespace_project_merge_request_url(@project.namespace,
@project,
@merge_request)
mail_answer_thread(@merge_request,
from: sender(updated_by_user_id),
to: recipient(recipient_id),
......@@ -25,7 +29,9 @@ module Emails
@merge_request = MergeRequest.find(merge_request_id)
@updated_by = User.find updated_by_user_id
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
@target_url = namespace_project_merge_request_url(@project.namespace,
@project,
@merge_request)
mail_answer_thread(@merge_request,
from: sender(updated_by_user_id),
to: recipient(recipient_id),
......@@ -35,7 +41,9 @@ module Emails
def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id)
@merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request)
@target_url = namespace_project_merge_request_url(@project.namespace,
@project,
@merge_request)
mail_answer_thread(@merge_request,
from: sender(updated_by_user_id),
to: recipient(recipient_id),
......@@ -47,7 +55,9 @@ module Emails
@mr_status = status
@project = @merge_request.project
@updated_by = User.find updated_by_user_id
@target_url = project_merge_request_url(@project, @merge_request)
@target_url = namespace_project_merge_request_url(@project.namespace,
@project,
@merge_request)
set_reference("merge_request_#{merge_request_id}")
mail_answer_thread(@merge_request,
from: sender(updated_by_user_id),
......
......@@ -4,7 +4,9 @@ module Emails
@note = Note.find(note_id)
@commit = @note.noteable
@project = @note.project
@target_url = project_commit_url(@project, @commit, anchor: "note_#{@note.id}")
@target_url = namespace_project_commit_url(@project.namespace, @project,
@commit, anchor:
"note_#{@note.id}")
mail_answer_thread(@commit,
from: sender(@note.author_id),
to: recipient(recipient_id),
......@@ -15,7 +17,9 @@ module Emails
@note = Note.find(note_id)
@issue = @note.noteable
@project = @note.project
@target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}")
@target_url = namespace_project_issue_url(@project.namespace, @project,
@issue, anchor:
"note_#{@note.id}")
mail_answer_thread(@issue,
from: sender(@note.author_id),
to: recipient(recipient_id),
......@@ -26,7 +30,10 @@ module Emails
@note = Note.find(note_id)
@merge_request = @note.noteable
@project = @note.project
@target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}")
@target_url = namespace_project_merge_request_url(@project.namespace,
@project,
@merge_request, anchor:
"note_#{@note.id}")
mail_answer_thread(@merge_request,
from: sender(@note.author_id),
to: recipient(recipient_id),
......
......@@ -3,7 +3,7 @@ module Emails
def project_access_granted_email(user_project_id)
@project_member = ProjectMember.find user_project_id
@project = @project_member.project
@target_url = project_url(@project)
@target_url = namespace_project_url(@project.namespace, @project)
mail(to: @project_member.user.email,
subject: subject("Access to project was granted"))
end
......@@ -11,7 +11,7 @@ module Emails
def project_was_moved_email(project_id, user_id)
@user = User.find user_id
@project = Project.find project_id
@target_url = project_url(@project)
@target_url = namespace_project_url(@project.namespace, @project)
mail(to: @user.notification_email,
subject: subject("Project was moved"))
end
......@@ -24,10 +24,14 @@ module Emails
@diffs = compare.diffs
@branch = branch
if @commits.length > 1
@target_url = project_compare_url(@project, from: @commits.first, to: @commits.last)
@target_url = namespace_project_compare_url(@project.namespace,
@project,
from: @commits.first,
to: @commits.last)
@subject = "#{@commits.length} new commits pushed to repository"
else
@target_url = project_commit_url(@project, @commits.first)
@target_url = namespace_project_commit_url(@project.namespace,
@project, @commits.first)
@subject = @commits.first.title
end
......
......@@ -285,7 +285,7 @@ class Project < ActiveRecord::Base
end
def to_param
namespace.path + '/' + path
path
end
def web_url
......
......@@ -27,14 +27,20 @@ class GitlabIssueTrackerService < IssueTrackerService
end
def project_url
project_issues_path(project)
"#{gitlab_url}#{namespace_project_issues_path(project.namespace, project)}"
end
def new_issue_url
new_project_issue_path project_id: project
"#{gitlab_url}#{new_namespace_project_issue_path(namespace_id: project.namespace, project_id: project)}"
end
def issue_url(iid)
"#{Gitlab.config.gitlab.url}#{project_issue_path(project_id: project, id: iid)}"
"#{gitlab_url}#{namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: iid)}"
end
private
def gitlab_url
Gitlab.config.gitlab.relative_url_root.chomp("/") if Gitlab.config.gitlab.relative_url_root
end
end
......@@ -45,6 +45,7 @@
# last_credential_check_at :datetime
# github_access_token :string(255)
# notification_email :string(255)
# password_automatically_set :boolean default(FALSE)
#
require 'carrierwave/orm/activerecord'
......@@ -350,6 +351,10 @@ class User < ActiveRecord::Base
keys.count == 0
end
def require_password?
password_automatically_set? && !ldap_user?
end
def can_change_username?
gitlab_config.username_changing_enabled
end
......
......@@ -37,11 +37,14 @@ class BaseService
private
def error(message)
{
def error(message, http_status = nil)
result = {
message: message,
status: :error
}
result[:http_status] = http_status if http_status
result
end
def success
......
......@@ -20,17 +20,19 @@ module Files
end
edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, project, ref, path)
created_successfully = edit_file_action.commit!(
edit_file_action.commit!(
params[:content],
params[:commit_message],
params[:encoding]
)
if created_successfully
success
else
error("Your changes could not be committed. Maybe the file was changed by another process or there was nothing to commit?")
end
success
rescue Gitlab::Satellite::CheckoutFailed => ex
error("Your changes could not be committed because ref '#{ref}' could not be checked out", 400)
rescue Gitlab::Satellite::CommitFailed => ex
error("Your changes could not be committed. Maybe there was nothing to commit?", 409)
rescue Gitlab::Satellite::PushFailed => ex
error("Your changes could not be committed. Maybe the file was changed by another process?", 409)
end
end
end
......@@ -53,7 +53,7 @@ module MergeRequests
if merge_request.source_branch == @branch_name || force_push?
merge_request.reload_code
merge_request.mark_as_unchecked
update_merge_request(merge_request)
else
mr_commit_ids = merge_request.commits.map(&:id)
push_commit_ids = @commits.map(&:id)
......@@ -61,14 +61,20 @@ module MergeRequests
if matches.any?
merge_request.reload_code
merge_request.mark_as_unchecked
update_merge_request(merge_request)
else
merge_request.mark_as_unchecked
update_merge_request(merge_request)
end
end
end
end
def update_merge_request(merge_request)
MergeRequests::UpdateService.new(
merge_request.target_project,
@current_user, merge_status: 'unchecked').execute(merge_request)
end
# Add comment about pushing new commits to merge requests
def comment_mr_with_commits
merge_requests = @project.origin_merge_requests.opened.where(source_branch: @branch_name).to_a
......
......@@ -12,7 +12,7 @@ module Projects
class TransferError < StandardError; end
def execute
namespace_id = params[:namespace_id]
namespace_id = params[:new_namespace_id]
namespace = Namespace.find_by(id: namespace_id)
if allowed_transfer?(current_user, project, namespace)
......
......@@ -85,10 +85,10 @@
.light-well
%h4 Projects
.data
= link_to admin_projects_path do
= link_to admin_namespaces_projects_path do
%h1= Project.count
%hr
= link_to 'New Project', new_project_path, class: "btn btn-new"
= link_to('New Project', new_project_path, class: "btn btn-new")
.col-sm-4
.light-well
%h4 Users
......@@ -112,7 +112,7 @@
%hr
- @projects.each do |project|
%p
= link_to project.name_with_namespace, [:admin, project], class: 'str-truncated'
= link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project], class: 'str-truncated'
%span.light.pull-right
#{time_ago_with_tooltip(project.created_at)}
......
......@@ -41,7 +41,7 @@
- @projects.each do |project|
%li
%strong
= link_to project.name_with_namespace, [:admin, project]
= link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project]
%span.label.label-gray
= repository_size(project)
%span.pull-right.light
......
.row
.col-md-3
.admin-filter
= form_tag admin_projects_path, method: :get, class: '' do
= form_tag admin_namespaces_projects_path, method: :get, class: '' do
.form-group
= label_tag :name, 'Name:'
= text_field_tag :name, params[:name], class: "form-control"
......@@ -34,7 +34,7 @@
%hr
= hidden_field_tag :sort, params[:sort]
= button_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_projects_path, class: "btn btn-cancel"
= link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel"
.col-md-9
.panel.panel-default
......@@ -51,15 +51,15 @@
%b.caret
%ul.dropdown-menu
%li
= link_to admin_projects_path(sort: sort_value_recently_created) do
= link_to admin_namespaces_projects_path(sort: sort_value_recently_created) do
= sort_title_recently_created
= link_to admin_projects_path(sort: sort_value_oldest_created) do
= link_to admin_namespaces_projects_path(sort: sort_value_oldest_created) do
= sort_title_oldest_created
= link_to admin_projects_path(sort: sort_value_recently_updated) do
= link_to admin_namespaces_projects_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to admin_projects_path(sort: sort_value_oldest_updated) do
= link_to admin_namespaces_projects_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated
= link_to admin_projects_path(sort: sort_value_largest_repo) do
= link_to admin_namespaces_projects_path(sort: sort_value_largest_repo) do
= sort_title_largest_repo
= link_to 'New Project', new_project_path, class: "btn btn-new"
%ul.well-list
......@@ -68,12 +68,12 @@
.list-item-name
%span{ class: visibility_level_color(project.visibility_level) }
= visibility_level_icon(project.visibility_level)
= link_to project.name_with_namespace, [:admin, project]
= link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project]
.pull-right
%span.label.label-gray
= repository_size(project)
= link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Destroy', [project], data: { confirm: remove_project_message(project) }, method: :delete, class: "btn btn-small btn-remove"
= link_to 'Edit', edit_namespace_project_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Destroy', [project.namespace.becomes(Namespace), project], data: { confirm: remove_project_message(project) }, method: :delete, class: "btn btn-small btn-remove"
- if @projects.blank?
.nothing-here-block 0 projects matches
= paginate @projects, theme: "gitlab"
%h3.page-title
Project: #{@project.name_with_namespace}
= link_to edit_project_path(@project), class: "btn pull-right" do
= link_to edit_namespace_project_path(@project.namespace, @project), class: "btn pull-right" do
%i.fa.fa-pencil-square-o
Edit
%hr
......@@ -13,7 +13,7 @@
%li
%span.light Name:
%strong
= link_to @project.name, project_path(@project)
= link_to @project.name, namespace_project_path(@project.namespace, @project)
%li
%span.light Namespace:
%strong
......@@ -79,11 +79,11 @@
.panel-heading
Transfer project
.panel-body
= form_for @project, url: transfer_admin_project_path(@project), method: :put, html: { class: 'form-horizontal' } do |f|
= form_for @project, url: transfer_admin_namespace_project_path(@project.namespace, @project), method: :put, html: { class: 'form-horizontal' } do |f|
.form-group
= f.label :namespace_id, "Namespace", class: 'control-label'
= f.label :new_namespace_id, "Namespace", class: 'control-label'
.col-sm-10
= namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large'
= namespace_select_tag :new_namespace_id, selected: params[:namespace_id], class: 'input-large'
.form-group
.col-sm-2
......@@ -111,7 +111,7 @@
%small
(#{@project.users.count})
.pull-right
= link_to project_team_index_path(@project), class: "btn btn-tiny" do
= link_to namespace_project_team_index_path(@project.namespace, @project), class: "btn btn-tiny" do
%i.fa.fa-pencil-square-o
Manage Access
%ul.well-list.team_members
......@@ -126,7 +126,7 @@
%span.light Owner
- else
%span.light= project_member.human_access
= link_to project_team_member_path(@project, user), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, remote: true, class: "btn btn-small btn-remove" do
= link_to namespace_project_team_member_path(@project.namespace, @project, user), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, remote: true, class: "btn btn-small btn-remove" do
%i.fa.fa-times
.panel-footer
= paginate @project_members, param_name: 'project_members_page', theme: 'gitlab'
......@@ -206,7 +206,7 @@
- tm = project.team.find_tm(@user.id)
%li.project_member
.list-item-name
= link_to admin_project_path(project), class: dom_class(project) do
= link_to admin_namespace_project_path(project.namespace, project), class: dom_class(project) do
= project.name_with_namespace
- if tm
......@@ -217,7 +217,7 @@
%span.light= tm.human_access
- if tm.respond_to? :project
= link_to project_team_member_path(project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do
= link_to namespace_project_team_member_path(project.namespace, project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do
%i.fa.fa-times
#ssh-keys.tab-pane
= render 'profiles/keys/key_table', admin: true
= link_to project_path(project), class: dom_class(project) do
= link_to namespace_project_path(project.namespace, project), class: dom_class(project) do
.dash-project-avatar
= project_icon(project, alt: '', class: 'avatar project-avatar s40')
.dash-project-access-icon
......
.dash-projects-filters.append-bottom-20
.pull-left.append-right-20
%ul.nav.nav-pills.nav-compact
.append-right-20
%ul.nav.nav-tabs
= nav_tab :scope, nil do
= link_to projects_dashboard_filter_path(scope: nil) do
All
......
......@@ -16,22 +16,22 @@
%li.my-project-row
%h4.project-title
.pull-left
= project_icon(project.to_param, alt: '', class: 'avatar project-avatar s60')
= project_icon("#{project.namespace.to_param}/#{project.to_param}", alt: '', class: 'avatar project-avatar s60')
.project-access-icon
= visibility_level_icon(project.visibility_level)
= link_to project_path(project), class: dom_class(project) do
= project.name_with_namespace
= link_to namespace_project_path(project.namespace, project), class: dom_class(project) do
%strong= project.name_with_namespace
- if project.forked_from_project
&nbsp;
%small
%i.fa.fa-code-fork
Forked from:
= link_to project.forked_from_project.name_with_namespace, project_path(project.forked_from_project)
= link_to project.forked_from_project.name_with_namespace, namespace_project_path(project.namespace, project.forked_from_project)
- if current_user.can_leave_project?(project)
.pull-right
= link_to leave_project_team_members_path(project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
= link_to leave_namespace_project_team_members_path(project.namespace, project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
%i.fa.fa-sign-out
Leave
......
......@@ -2,11 +2,10 @@
.dashboard.row
%section.activities.col-md-8
= render 'activities'
%aside.side.col-md-4.left.responsive-side
%aside.col-md-4
= render 'sidebar'
.fixed.sidebar-expand-button.hidden-lg.hidden-md
%i.fa.fa-list.fa-2x
= link_to '#aside', class: 'show-aside' do
%i.fa.fa-angle-left
- else
= render "zero_authorized_projects"
%li.commit
.commit-row-title
= link_to truncate_sha(commit[:id]), project_commit_path(project, commit[:id]), class: "commit_short_id", alt: ''
= link_to truncate_sha(commit[:id]), namespace_project_commit_path(project.namespace, project, commit[:id]), class: "commit_short_id", alt: ''
&nbsp;
= gfm event_commit_title(commit[:message]), project
......@@ -2,7 +2,7 @@
.event-last-push
.event-last-push-text
%span You pushed to
= link_to project_commits_path(event.project, event.ref_name) do
= link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do
%strong= event.ref_name
at
%strong= link_to_project event.project
......
......@@ -2,7 +2,7 @@
- event.commits.first(15).each do |commit|
%p
%strong= commit[:author][:name]
= link_to "(##{truncate_sha(commit[:id])})", project_commit_path(event.project, id: commit[:id])
= link_to "(##{truncate_sha(commit[:id])})", namespace_project_commit_path(event.project.namespace, event.project, id: commit[:id])
%i
at
= commit[:timestamp].to_time.to_s(:short)
......
......@@ -4,7 +4,7 @@
= event_action_name(event)
- if event.target
%strong= link_to "##{event.target_iid}", [event.project, event.target]
%strong= link_to "##{event.target_iid}", [event.project.namespace.becomes(Namespace), event.project, event.target]
at
- if event.project
......
......@@ -4,7 +4,7 @@
- if event.rm_ref?
%strong= event.ref_name
- else
= link_to project_commits_path(event.project, event.ref_name) do
= link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do
%strong= event.ref_name
at
= link_to_project event.project
......@@ -21,5 +21,5 @@
%li.commits-stat
- if event.commits_count > 2
%span ... and #{event.commits_count - 2} more commits.
= link_to project_compare_path(event.project, from: event.commit_from, to: event.commit_to) do
= link_to namespace_project_compare_path(event.project.namespace, event.project, from: event.commit_from, to: event.commit_to) do
%strong Compare &rarr; #{truncate_sha(event.commit_from)}...#{truncate_sha(event.commit_to)}
......@@ -2,7 +2,7 @@
%h4.project-title
.project-access-icon
= visibility_level_icon(project.visibility_level)
= link_to project.name_with_namespace, project
= link_to project.name_with_namespace, [project.namespace.becomes(Namespace), project]
%span.pull-right
%i.fa.fa-star
= project.star_count
......@@ -14,11 +14,11 @@
.repo-info
- unless project.empty_repo?
= link_to pluralize(project.repository.round_commit_count, 'commit'), project_commits_path(project, project.default_branch)
= link_to pluralize(project.repository.round_commit_count, 'commit'), namespace_project_commits_path(project.namespace, project, project.default_branch)
&middot;
= link_to pluralize(project.repository.branch_names.count, 'branch'), project_branches_path(project)
= link_to pluralize(project.repository.branch_names.count, 'branch'), namespace_project_branches_path(project.namespace, project)
&middot;
= link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project)
= link_to pluralize(project.repository.tag_names.count, 'tag'), namespace_project_tags_path(project.namespace, project)
- else
%i.fa.fa-exclamation-triangle
Empty repository
......@@ -11,7 +11,7 @@
.nothing-here-block This group has no projects yet
- projects.each do |project|
%li.project-row
= link_to project_path(project), class: dom_class(project) do
= link_to namespace_project_path(project.namespace, project), class: dom_class(project) do
.dash-project-avatar
= project_icon(project, alt: '', class: 'avatar s40')
.dash-project-access-icon
......
......@@ -2,9 +2,9 @@
%span.milestone-row
- project = issue.project
%strong #{project.name} &middot;
= link_to [project, issue] do
= link_to [project.namespace.becomes(Namespace), project, issue] do
%span.cgray ##{issue.iid}
= link_to_gfm issue.title, [project, issue], title: issue.title
= link_to_gfm issue.title, [project.namespace.becomes(Namespace), project, issue], title: issue.title
.pull-right.assignee-icon
- if issue.assignee
= image_tag avatar_icon(issue.assignee.email, 16), class: "avatar s16"
......@@ -2,9 +2,9 @@
%span.milestone-row
- project = merge_request.project
%strong #{project.name} &middot;
= link_to [project, merge_request] do
= link_to [project.namespace.becomes(Namespace), project, merge_request] do
%span.cgray ##{merge_request.iid}
= link_to_gfm merge_request.title, [project, merge_request], title: merge_request.title
= link_to_gfm merge_request.title, [project.namespace.becomes(Namespace), project, merge_request], title: merge_request.title
.pull-right.assignee-icon
- if merge_request.assignee
= image_tag avatar_icon(merge_request.assignee.email, 16), class: "avatar s16"
......@@ -28,7 +28,7 @@
- @group_milestone.milestones.each do |milestone|
%tr
%td
= link_to "#{milestone.project.name}", project_milestone_path(milestone.project, milestone)
= link_to "#{milestone.project.name}", namespace_project_milestone_path(milestone.project.namespace, milestone.project, milestone)
%td
= milestone.issues.opened.count
%td
......
......@@ -16,8 +16,8 @@
%span.label.label-gray
= repository_size(project)
.pull-right
= link_to 'Members', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Members', namespace_project_team_index_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Edit', edit_namespace_project_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Remove', project, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove"
- if @projects.blank?
.nothing-here-block This group has no projects yet
......
......@@ -9,7 +9,7 @@
= escaped_autolink(@group.description)
%hr
.row
%section.activities.col-md-8.hidden-sm.hidden-xs
%section.activities.col-md-8
- if current_user
= render "events/event_last_push", event: @last_push
= render 'shared/event_filter'
......@@ -17,3 +17,5 @@
= spinner
%aside.side.col-md-4
= render "projects", projects: @projects
= link_to '#aside', class: 'show-aside' do
%i.fa.fa-angle-left
......@@ -23,6 +23,6 @@
= auto_discovery_link_tag :atom, projects_url(:atom, private_token: current_user.private_token), title: "Dashboard feed"
- if @project && !@project.new_record?
- if current_controller?(:tree, :commits)
= auto_discovery_link_tag(:atom, project_commits_url(@project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}")
= auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "Recent commits to #{@project.name}:#{@ref}")
- if current_controller?(:issues)
= auto_discovery_link_tag(:atom, project_issues_url(@project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
= auto_discovery_link_tag(:atom, namespace_project_issues_url(@project.namespace, @project, :atom, private_token: current_user.private_token), title: "#{@project.name} issues")
......@@ -42,7 +42,7 @@
= link_to destroy_user_session_path, class: "logout", method: :delete, title: "Logout", class: 'has_bottom_tooltip', 'data-original-title' => 'Logout' do
%i.fa.fa-sign-out
%li.hidden-xs
= link_to current_user, class: "profile-pic", id: 'profile-pic' do
= link_to current_user, class: "profile-pic has_bottom_tooltip", id: 'profile-pic', 'data-original-title' => 'Your profile' do
= image_tag avatar_icon(current_user.email, 60), alt: 'User activity'
= render 'shared/outdated_browser'
:javascript
GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_project_path(@project, type: @noteable.class, type_id: params[:id])}"
GitLab.GfmAutoComplete.dataSource = "#{autocomplete_sources_namespace_project_path(@project.namespace, @project, type: @noteable.class, type_id: params[:id])}"
GitLab.GfmAutoComplete.setup();
......@@ -5,7 +5,7 @@
%span
Overview
= nav_link(controller: :projects) do
= link_to admin_projects_path, title: 'Projects' do
= link_to admin_namespaces_projects_path, title: 'Projects' do
%i.fa.fa-cube
%span
Projects
......
%ul.project-navigation.nav.nav-sidebar
- if @project_settings_nav
= nav_link do
= link_to project_path(@project), title: 'Back to project', class: "" do
= link_to namespace_project_path(@project.namespace, @project), title: 'Back to project', class: "" do
%i.fa.fa-angle-left
%span
Back to project
= nav_link(html_options: {class: "#{project_tab_class} separate-item"}) do
= link_to edit_project_path(@project), title: 'Settings', class: "stat-tab tab no-highlight" do
%i.fa.fa-cogs
%span
Settings
%i.fa.fa-angle-down
%li.separate-item
= render 'projects/settings_nav'
- else
= nav_link(path: 'projects#show', html_options: {class: "home"}) do
= link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do
= link_to namespace_project_path(@project.namespace, @project), title: 'Project', class: 'shortcuts-project' do
%i.fa.fa-dashboard
%span
Project
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
= link_to project_tree_path(@project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree' do
= link_to namespace_project_tree_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree' do
%i.fa.fa-files-o
%span
Files
- if project_nav_tab? :commits
= nav_link(controller: %w(commit commits compare repositories tags branches)) do
= link_to project_commits_path(@project, @ref || @repository.root_ref), title: 'Commits', class: 'shortcuts-commits' do
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Commits', class: 'shortcuts-commits' do
%i.fa.fa-history
%span
Commits
- if project_nav_tab? :network
= nav_link(controller: %w(network)) do
= link_to project_network_path(@project, @ref || @repository.root_ref), title: 'Network', class: 'shortcuts-network' do
= link_to namespace_project_network_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Network', class: 'shortcuts-network' do
%i.fa.fa-code-fork
%span
Network
- if project_nav_tab? :graphs
= nav_link(controller: %w(graphs)) do
= link_to project_graph_path(@project, @ref || @repository.root_ref), title: 'Graphs', class: 'shortcuts-graphs' do
= link_to namespace_project_graph_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Graphs', class: 'shortcuts-graphs' do
%i.fa.fa-area-chart
%span
Graphs
= nav_link(controller: :milestones) do
= link_to project_milestones_path(@project), title: 'Milestones' do
= link_to namespace_project_milestones_path(@project.namespace, @project), title: 'Milestones' do
%i.fa.fa-clock-o
%span
Milestones
......@@ -66,36 +61,35 @@
- if project_nav_tab? :merge_requests
= nav_link(controller: :merge_requests) do
= link_to project_merge_requests_path(@project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do
= link_to namespace_project_merge_requests_path(@project.namespace, @project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do
%i.fa.fa-tasks
%span
Merge Requests
%span.count.merge_counter= @project.merge_requests.opened.count
= nav_link(controller: :labels) do
= link_to project_labels_path(@project), title: 'Labels' do
= link_to namespace_project_labels_path(@project.namespace, @project), title: 'Labels' do
%i.fa.fa-tags
%span
Labels
- if project_nav_tab? :wiki
= nav_link(controller: :wikis) do
= link_to project_wiki_path(@project, :home), title: 'Wiki', class: 'shortcuts-wiki' do
= link_to namespace_project_wiki_path(@project.namespace, @project, :home), title: 'Wiki', class: 'shortcuts-wiki' do
%i.fa.fa-book
%span
Wiki
- if project_nav_tab? :snippets
= nav_link(controller: :snippets) do
= link_to project_snippets_path(@project), title: 'Snippets', class: 'shortcuts-snippets' do
= link_to namespace_project_snippets_path(@project.namespace, @project), title: 'Snippets', class: 'shortcuts-snippets' do
%i.fa.fa-file-text-o
%span
Snippets
- if project_nav_tab? :settings
= nav_link(html_options: {class: "#{project_tab_class} separate-item"}) do
= link_to edit_project_path(@project), title: 'Settings', class: "stat-tab tab no-highlight" do
= link_to edit_namespace_project_path(@project.namespace, @project), title: 'Settings', class: "stat-tab tab no-highlight" do
%i.fa.fa-cogs
%span
Settings
%i.fa.fa-angle-down
......@@ -28,4 +28,4 @@
#{link_to "View it on GitLab", @target_url}
= email_action @target_url
- if @project
You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, project_url(@project)} project team.
You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, namespace_project_url(@project.namespace, @project)} project team.
Reassigned <%= issuable.class.model_name.human.titleize %> <%= issuable.iid %>
<%= url_for([issuable.project, issuable, {only_path: false}]) %>
<%= url_for([issuable.project.namespace.becomes(Namespace), issuable.project, issuable, {only_path: false}]) %>
Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee -%>
to <%= "#{issuable.assignee_id ? issuable.assignee_name : 'Unassigned'}" %>
= "Issue was closed by #{@updated_by.name}"
Issue ##{@issue.iid}: #{project_issue_url(@issue.project, @issue)}
Issue ##{@issue.iid}: #{namespace_project_issue_url(@issue.project.namespace, @issue.project, @issue)}
= "Merge Request ##{@merge_request.iid} was closed by #{@updated_by.name}"
Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)}
Merge Request url: #{namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request)}
= merge_path_description(@merge_request, 'to')
......
Issue was <%= @issue_status %> by <%= @updated_by.name %>
Issue <%= @issue.iid %>: <%= url_for(project_issue_url(@issue.project, @issue)) %>
Issue <%= @issue.iid %>: <%= url_for(namespace_project_issue_url(@issue.project.namespace, @issue.project, @issue)) %>
= "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}"
Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)}
Merge Request url: #{namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request)}
= merge_path_description(@merge_request, 'to')
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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