Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/application.js.coffee33
-rw-r--r--app/assets/javascripts/diff.js.coffee46
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee12
-rw-r--r--app/assets/javascripts/labels.js.coffee35
-rw-r--r--app/assets/javascripts/pager.js.coffee22
-rw-r--r--app/assets/stylesheets/sections/commits.scss1
-rw-r--r--app/assets/stylesheets/sections/diff.scss3
-rw-r--r--app/assets/stylesheets/sections/login.scss4
-rw-r--r--app/controllers/application_controller.rb13
-rw-r--r--app/controllers/omniauth_callbacks_controller.rb13
-rw-r--r--app/controllers/projects/blob_controller.rb15
-rw-r--r--app/controllers/projects/labels_controller.rb5
-rw-r--r--app/controllers/projects/repositories_controller.rb6
-rw-r--r--app/helpers/commits_helper.rb12
-rw-r--r--app/helpers/labels_helper.rb2
-rw-r--r--app/models/concerns/issuable.rb3
-rw-r--r--app/models/label.rb13
-rw-r--r--app/models/project_services/hipchat_service.rb8
-rw-r--r--app/models/user.rb4
-rw-r--r--app/services/archive_repository_service.rb14
-rw-r--r--app/views/layouts/devise.html.haml2
-rw-r--r--app/views/projects/blob/diff.html.haml19
-rw-r--r--app/views/projects/commit/_commit_box.html.haml2
-rw-r--r--app/views/projects/commits/_commit.html.haml2
-rw-r--r--app/views/projects/commits/_diff_file.html.haml13
-rw-r--r--app/views/projects/commits/_text_file.html.haml14
-rw-r--r--app/views/projects/commits/diffs/_match_line.html.haml7
-rw-r--r--app/views/projects/labels/_form.html.haml18
-rw-r--r--app/views/projects/labels/_label.html.haml2
-rw-r--r--app/views/projects/milestones/_form.html.haml2
-rw-r--r--app/workers/post_receive.rb2
31 files changed, 265 insertions, 82 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index a28f76ddd15..1960479321c 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -53,15 +53,40 @@ window.split = (val) ->
window.extractLast = (term) ->
return split( term ).pop()
+window.rstrip = (val) ->
+ return val.replace(/\s+$/, '')
+
# Disable button if text field is empty
window.disableButtonIfEmptyField = (field_selector, button_selector) ->
field = $(field_selector)
- closest_submit = field.closest("form").find(button_selector)
+ closest_submit = field.closest('form').find(button_selector)
+
+ closest_submit.disable() if rstrip(field.val()) is ""
+
+ field.on 'input', ->
+ if rstrip($(@).val()) is ""
+ closest_submit.disable()
+ else
+ closest_submit.enable()
+
+# Disable button if any input field with given selector is empty
+window.disableButtonIfAnyEmptyField = (form, form_selector, button_selector) ->
+ closest_submit = form.find(button_selector)
+ empty = false
+ form.find('input').filter(form_selector).each ->
+ empty = true if rstrip($(this).val()) is ""
+
+ if empty
+ closest_submit.disable()
+ else
+ closest_submit.enable()
- closest_submit.disable() if field.val() is ""
+ form.keyup ->
+ empty = false
+ form.find('input').filter(form_selector).each ->
+ empty = true if rstrip($(this).val()) is ""
- field.on "input", ->
- if $(@).val() is ""
+ if empty
closest_submit.disable()
else
closest_submit.enable()
diff --git a/app/assets/javascripts/diff.js.coffee b/app/assets/javascripts/diff.js.coffee
new file mode 100644
index 00000000000..dbe00c487dc
--- /dev/null
+++ b/app/assets/javascripts/diff.js.coffee
@@ -0,0 +1,46 @@
+class Diff
+ UNFOLD_COUNT = 20
+ constructor: ->
+ $(document).on('click', '.js-unfold', (event) =>
+ target = $(event.target)
+ unfoldBottom = target.hasClass('js-unfold-bottom')
+ unfold = true
+
+ [old_line, line_number] = @lineNumbers(target.parent())
+ offset = line_number - old_line
+
+ if unfoldBottom
+ line_number += 1
+ since = line_number
+ to = line_number + UNFOLD_COUNT
+ else
+ [prev_old_line, prev_new_line] = @lineNumbers(target.parent().prev())
+ line_number -= 1
+ to = line_number
+ if line_number - UNFOLD_COUNT > prev_new_line + 1
+ since = line_number - UNFOLD_COUNT
+ else
+ since = prev_new_line + 1
+ unfold = false
+
+ link = target.parents('.diff-file').attr('data-blob-diff-path')
+ params =
+ since: since
+ to: to
+ bottom: unfoldBottom
+ offset: offset
+ unfold: unfold
+
+ $.get(link, params, (response) =>
+ target.parent().replaceWith(response)
+ )
+ )
+
+ lineNumbers: (line) ->
+ return ([0, 0]) unless line.children().length
+ lines = line.children().slice(0, 2)
+ line_numbers = ($(l).attr('data-linenumber') for l in lines)
+ (parseInt(line_number) for line_number in line_numbers)
+
+
+@Diff = Diff
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index ff68b520ad6..a463a2eb194 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -23,13 +23,21 @@ class Dispatcher
new Issue()
when 'projects:milestones:show'
new Milestone()
- when 'projects:issues:new', 'projects:merge_requests:new'
+ when 'projects:issues:new'
GitLab.GfmAutoComplete.setup()
+ when 'projects:merge_requests:new'
+ GitLab.GfmAutoComplete.setup()
+ new Diff()
+ when 'projects:merge_requests:show'
+ new Diff()
+ when "projects:merge_requests:diffs"
+ new Diff()
when 'dashboard:show'
new Dashboard()
new Activities()
when 'projects:commit:show'
new Commit()
+ new Diff()
when 'groups:show', 'projects:show'
new Activities()
when 'projects:new', 'projects:edit'
@@ -42,6 +50,8 @@ class Dispatcher
new TreeView()
when 'projects:blob:show'
new BlobView()
+ when 'projects:labels:new'
+ new Labels()
switch path.first()
when 'admin' then new Admin()
diff --git a/app/assets/javascripts/labels.js.coffee b/app/assets/javascripts/labels.js.coffee
new file mode 100644
index 00000000000..8e53d6929df
--- /dev/null
+++ b/app/assets/javascripts/labels.js.coffee
@@ -0,0 +1,35 @@
+class Labels
+ constructor: ->
+ form = $('.label-form')
+ @setupLabelForm(form)
+ @cleanBinding()
+ @addBinding()
+ @updateColorPreview
+
+ addBinding: ->
+ $(document).on 'click', '.suggest-colors a', @setSuggestedColor
+ $(document).on 'input', 'input#label_color', @updateColorPreview
+
+ cleanBinding: ->
+ $(document).off 'click', '.suggest-colors a'
+ $(document).off 'input', 'input#label_color'
+
+ # Initializes the form to disable the save button if no color or title is entered
+ setupLabelForm: (form) ->
+ disableButtonIfAnyEmptyField form, '.form-control', form.find('.js-save-button')
+
+ # Updates the the preview color with the hex-color input
+ updateColorPreview: =>
+ previewColor = $('input#label_color').val()
+ $('div.label-color-preview').css('background-color', previewColor)
+
+ # Updates the preview color with a click on a suggested color
+ setSuggestedColor: (e) =>
+ color = $(e.currentTarget).data('color')
+ $('input#label_color').val(color)
+ @updateColorPreview()
+ # Notify the form, that color has changed
+ $('.label-form').trigger('keyup')
+ e.preventDefault()
+
+@Labels = Labels
diff --git a/app/assets/javascripts/pager.js.coffee b/app/assets/javascripts/pager.js.coffee
index 1f763e8b956..fe83dc0410e 100644
--- a/app/assets/javascripts/pager.js.coffee
+++ b/app/assets/javascripts/pager.js.coffee
@@ -1,24 +1,21 @@
@Pager =
- limit: 0
- offset: 0
- disable: false
- init: (limit, preload) ->
- @limit = limit
+ init: (@limit = 0, preload, @disable = false) ->
+ @loading = $(".loading")
if preload
@offset = 0
@getOld()
else
- @offset = limit
+ @offset = @limit
@initLoadMore()
getOld: ->
- $(".loading").show()
+ @loading.show()
$.ajax
type: "GET"
url: location.href
data: "limit=" + @limit + "&offset=" + @offset
- complete: ->
- $(".loading").hide()
+ complete: =>
+ @loading.hide()
success: (data) ->
Pager.append(data.count, data.html)
dataType: "json"
@@ -39,6 +36,7 @@
ceaseFire: ->
Pager.disable
- callback: (i) ->
- $(".loading").show()
- Pager.getOld()
+ callback: (i) =>
+ unless @loading.is(':visible')
+ @loading.show()
+ Pager.getOld()
diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss
index 684e8377a7b..0083d01c460 100644
--- a/app/assets/stylesheets/sections/commits.scss
+++ b/app/assets/stylesheets/sections/commits.scss
@@ -244,6 +244,7 @@ li.commit {
font-family: inherit;
padding-left: $left;
position: relative;
+ resize: vertical;
z-index: 2;
}
}
diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss
index 88b188dbe8d..488d06919b0 100644
--- a/app/assets/stylesheets/sections/diff.scss
+++ b/app/assets/stylesheets/sections/diff.scss
@@ -48,6 +48,9 @@
background-color: #8F8;
}
}
+ .unfold {
+ cursor: pointer;
+ }
.file-mode-changed {
padding: 10px;
diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss
index 54887b7c401..77ebef690c3 100644
--- a/app/assets/stylesheets/sections/login.scss
+++ b/app/assets/stylesheets/sections/login.scss
@@ -13,6 +13,10 @@
max-width: 100%;
margin-bottom: 20px;
}
+
+ &.default-brand-image {
+ margin: 0 80px;
+ }
}
.login-logo{
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d0546a441e1..5ffec7f75bf 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -201,15 +201,10 @@ class ApplicationController < ActionController::Base
def ldap_security_check
if current_user && current_user.requires_ldap_check?
- gitlab_ldap_access do |access|
- if access.allowed?(current_user)
- current_user.last_credential_check_at = Time.now
- current_user.save
- else
- sign_out current_user
- flash[:alert] = "Access denied for your LDAP account."
- redirect_to new_user_session_path
- end
+ unless Gitlab::LDAP::Access.allowed?(current_user)
+ sign_out current_user
+ flash[:alert] = "Access denied for your LDAP account."
+ redirect_to new_user_session_path
end
end
end
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index ef2afec52dc..3ed6a69c2d8 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -21,13 +21,12 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
@user = Gitlab::LDAP::User.find_or_create(oauth)
@user.remember_me = true if @user.persisted?
- gitlab_ldap_access do |access|
- if access.allowed?(@user)
- sign_in_and_redirect(@user)
- else
- flash[:alert] = "Access denied for your LDAP account."
- redirect_to new_user_session_path
- end
+ # Do additional LDAP checks for the user filter and EE features
+ if Gitlab::LDAP::Access.allowed?(@user)
+ sign_in_and_redirect(@user)
+ else
+ flash[:alert] = "Access denied for your LDAP account."
+ redirect_to new_user_session_path
end
end
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index db3d173b98d..7009e3b1bc8 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -25,6 +25,21 @@ class Projects::BlobController < Projects::ApplicationController
end
end
+ def diff
+ @form = UnfoldForm.new(params)
+ @lines = @blob.data.lines[@form.since - 1..@form.to - 1]
+
+ if @form.bottom?
+ @match_line = ''
+ else
+ lines_length = @lines.length - 1
+ line = [@form.since, lines_length].join(',')
+ @match_line = "@@ -#{line}+#{line} @@"
+ end
+
+ render layout: false
+ end
+
private
def blob
diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb
index d049012f6d8..87d1c942034 100644
--- a/app/controllers/projects/labels_controller.rb
+++ b/app/controllers/projects/labels_controller.rb
@@ -50,7 +50,10 @@ class Projects::LabelsController < Projects::ApplicationController
def destroy
@label.destroy
- redirect_to project_labels_path(@project), notice: 'Label was removed'
+ respond_to do |format|
+ format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
+ format.js { render nothing: true }
+ end
end
protected
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb
index f76ddb34bc4..f30eaadd928 100644
--- a/app/controllers/projects/repositories_controller.rb
+++ b/app/controllers/projects/repositories_controller.rb
@@ -14,11 +14,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
render_404 and return
end
- storage_path = Gitlab.config.gitlab.repository_downloads_path
-
- @repository.clean_old_archives
-
- file_path = @repository.archive_repo(params[:ref], storage_path, params[:format].downcase)
+ file_path = ArchiveRepositoryService.new.execute(@project, params[:ref], params[:format])
if file_path
# Send file to user
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index 9a8b3928bf4..f61aa259154 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -232,4 +232,16 @@ module CommitsHelper
def diff_file_mode_changed?(diff)
diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
end
+
+ def unfold_bottom_class(bottom)
+ (bottom) ? 'js-unfold-bottom' : ''
+ 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
+ raw('View file @') + content_tag(:span, commit_sha[0..6],
+ class: 'commit-short-id')
+ end
+ end
end
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 37f3832e54f..5bfba4f14f2 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -4,7 +4,7 @@ module LabelsHelper
end
def render_colored_label(label)
- label_color = label.color || "#428bca"
+ label_color = label.color || Label::DEFAULT_COLOR
text_color = text_color_for_bg(label_color)
content_tag :span, class: 'label color-label', style: "background:#{label_color};color:#{text_color}" do
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 517e4548624..0a5fe24b5af 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -140,7 +140,8 @@ module Issuable
def add_labels_by_names(label_names)
label_names.each do |label_name|
- label = project.labels.find_or_create_by(title: label_name.strip)
+ label = project.labels.create_with(
+ color: Label::DEFAULT_COLOR).find_or_create_by(title: label_name.strip)
self.labels << label
end
end
diff --git a/app/models/label.rb b/app/models/label.rb
index 67932211ac5..819d6cefa41 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -1,13 +1,20 @@
class Label < ActiveRecord::Base
+ DEFAULT_COLOR = '#428bca'
+
belongs_to :project
has_many :label_links, dependent: :destroy
has_many :issues, through: :label_links, source: :target, source_type: 'Issue'
- validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true
+ validates :color,
+ format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ },
+ allow_blank: false
validates :project, presence: true
- # Dont allow '?', '&', and ',' for label titles
- validates :title, presence: true, format: { with: /\A[^&\?,&]*\z/ }
+ # Don't allow '?', '&', and ',' for label titles
+ validates :title,
+ presence: true,
+ format: { with: /\A[^&\?,&]*\z/ },
+ uniqueness: { scope: :project_id }
scope :order_by_name, -> { reorder("labels.title ASC") }
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index 48fe365760b..256debffc51 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -59,11 +59,15 @@ class HipchatService < Service
message = ""
message << "#{push[:user_name]} "
if before =~ /000000/
- message << "pushed new branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> to <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a>\n"
+ message << "pushed new branch <a href=\""\
+ "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\
+ " to <a href=\"#{project.web_url}\">"\
+ "#{project.name_with_namespace.gsub!(/\s/, "")}</a>\n"
elsif after =~ /000000/
message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n"
else
- message << "pushed to branch <a href=\"#{project.web_url}/commits/#{ref}\">#{ref}</a> "
+ message << "pushed to branch <a href=\""\
+ "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a> "
message << "of <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> "
message << "(<a href=\"#{project.web_url}/compare/#{before}...#{after}\">Compare changes</a>)"
diff --git a/app/models/user.rb b/app/models/user.rb
index 9ab3ea025c3..f1ff76edd15 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -414,7 +414,9 @@ class User < ActiveRecord::Base
end
def requires_ldap_check?
- if ldap_user?
+ if !Gitlab.config.ldap.enabled
+ false
+ elsif ldap_user?
!last_credential_check_at || (last_credential_check_at + 1.hour) < Time.now
else
false
diff --git a/app/services/archive_repository_service.rb b/app/services/archive_repository_service.rb
new file mode 100644
index 00000000000..8823f6fdc67
--- /dev/null
+++ b/app/services/archive_repository_service.rb
@@ -0,0 +1,14 @@
+class ArchiveRepositoryService
+ def execute(project, ref, format)
+ storage_path = Gitlab.config.gitlab.repository_downloads_path
+
+ unless File.directory?(storage_path)
+ FileUtils.mkdir_p(storage_path)
+ end
+
+ format ||= 'tar.gz'
+ repository = project.repository
+ repository.clean_old_archives
+ repository.archive_repo(ref, storage_path, format.downcase)
+ end
+end
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 00b1959912f..dd70836cdc9 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -18,7 +18,7 @@
.brand_text
= brand_text
- else
- .brand-image.hidden-sm.hidden-xs
+ .brand-image.default-brand-image.hidden-sm.hidden-xs
= image_tag 'brand_logo.png'
.brand_text.hidden-xs
%h2 Open source software to collaborate on code
diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml
new file mode 100644
index 00000000000..cfb91d6568a
--- /dev/null
+++ b/app/views/projects/blob/diff.html.haml
@@ -0,0 +1,19 @@
+- if @lines.present?
+ - if @form.unfold? && @form.since != 1 && !@form.bottom?
+ %tr.line_holder{ id: @form.since }
+ = render "projects/commits/diffs/match_line", {line: @match_line,
+ line_old: @form.since, line_new: @form.since, bottom: false}
+
+ - @lines.each_with_index do |line, index|
+ - line_new = index + @form.since
+ - line_old = line_new - @form.offset
+ %tr.line_holder
+ %td.old_line.diff-line-num{data: {linenumber: line_old}}
+ = link_to raw(line_old), "#"
+ %td.new_line= link_to raw(line_new) , "#"
+ %td.line_content.noteable_line= line
+
+ - if @form.unfold? && @form.bottom? && @form.to < @blob.loc
+ %tr.line_holder{ id: @form.to }
+ = render "projects/commits/diffs/match_line", {line: @match_line,
+ line_old: @form.to, line_new: @form.to, bottom: true}
diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml
index f2b0699f136..2bc9048b2ad 100644
--- a/app/views/projects/commit/_commit_box.html.haml
+++ b/app/views/projects/commit/_commit_box.html.haml
@@ -55,4 +55,4 @@
= gfm escape_once(@commit.title)
- if @commit.description.present?
%pre.commit-description
- = gfm escape_once(@commit.description)
+ = preserve(gfm(escape_once(@commit.description)))
diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml
index abe0d4cff46..8e73663939f 100644
--- a/app/views/projects/commits/_commit.html.haml
+++ b/app/views/projects/commits/_commit.html.haml
@@ -23,7 +23,7 @@
- if commit.description?
.commit-row-description.js-toggle-content
%pre
- = commit.description
+ = preserve(gfm(escape_once(commit.description)))
.commit-row-info
= commit_author_link(commit, avatar: true, size: 16)
diff --git a/app/views/projects/commits/_diff_file.html.haml b/app/views/projects/commits/_diff_file.html.haml
index 9cbcb84aead..6e6107c8849 100644
--- a/app/views/projects/commits/_diff_file.html.haml
+++ b/app/views/projects/commits/_diff_file.html.haml
@@ -1,15 +1,15 @@
- file = project.repository.blob_for_diff(@commit, diff)
- return unless file
-.diff-file{id: "diff-#{i}"}
+- blob_diff_path = diff_project_blob_path(project,
+ tree_join(@commit.id, diff.new_path))
+.diff-file{id: "diff-#{i}", data: {blob_diff_path: blob_diff_path }}
.diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"}
- if diff.deleted_file
%span= diff.old_path
.diff-btn-group
- if @commit.parent_ids.present?
- = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do
- View file @
- %span.commit-short-id= @commit.short_id(6)
+ = view_file_btn(@commit.parent_id, diff, project)
- else
%span= diff.new_path
- if diff_file_mode_changed?(diff)
@@ -26,10 +26,7 @@
Edit
&nbsp;
- = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do
- View file @
- %span.commit-short-id= @commit.short_id(6)
-
+ = view_file_btn(@commit.id, diff, project)
.diff-content
-# Skipp all non non-supported blobs
diff --git a/app/views/projects/commits/_text_file.html.haml b/app/views/projects/commits/_text_file.html.haml
index f5b0d711416..756481c1b21 100644
--- a/app/views/projects/commits/_text_file.html.haml
+++ b/app/views/projects/commits/_text_file.html.haml
@@ -3,18 +3,20 @@
%a.supp_diff_link Changes suppressed. Click to show
%table.text-file{class: "#{'hide' if too_big}"}
+ - last_line = 0
- each_diff_line(diff, index) do |line, type, line_code, line_new, line_old, raw_line|
+ - last_line = line_new
%tr.line_holder{ id: line_code, class: "#{type}" }
- if type == "match"
- %td.old_line= "..."
- %td.new_line= "..."
- %td.line_content.matched= line
+ = render "projects/commits/diffs/match_line", {line: line,
+ line_old: line_old, line_new: line_new, bottom: false}
- else
%td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
- if @comments_allowed
= link_to_new_diff_note(line_code)
- %td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
+ %td.new_line{data: {linenumber: line_new}}
+ = link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
- if @reply_allowed
@@ -22,6 +24,10 @@
- unless comments.empty?
= render "projects/notes/diff_notes_with_reply", notes: comments, line: line
+ - if last_line > 0
+ = render "projects/commits/diffs/match_line", {line: "",
+ line_old: last_line, line_new: last_line, bottom: true}
+
- if diff.diff.blank? && diff_file_mode_changed?(diff)
.file-mode-changed
File mode changed
diff --git a/app/views/projects/commits/diffs/_match_line.html.haml b/app/views/projects/commits/diffs/_match_line.html.haml
new file mode 100644
index 00000000000..4ebe3379733
--- /dev/null
+++ b/app/views/projects/commits/diffs/_match_line.html.haml
@@ -0,0 +1,7 @@
+%td.old_line.diff-line-num.unfold.js-unfold{data: {linenumber: line_old},
+ class: unfold_bottom_class(bottom)}
+ \...
+%td.new_line.diff-line-num.unfold.js-unfold{data: {linenumber: line_new},
+ class: unfold_bottom_class(bottom)}
+ \...
+%td.line_content.matched= line
diff --git a/app/views/projects/labels/_form.html.haml b/app/views/projects/labels/_form.html.haml
index 2a5c907febe..72a01e1c271 100644
--- a/app/views/projects/labels/_form.html.haml
+++ b/app/views/projects/labels/_form.html.haml
@@ -28,22 +28,6 @@
&nbsp;
.form-actions
- = f.submit 'Save', class: 'btn btn-save'
+ = f.submit 'Save', class: 'btn btn-save js-save-button'
= link_to "Cancel", project_labels_path(@project), class: 'btn btn-cancel'
-
-:coffeescript
- updateColorPreview = ->
- previewColor = $('input#label_color').val()
- $('div.label-color-preview').css('background-color', previewColor)
-
- $('.suggest-colors a').on 'click', (e) ->
- color = $(this).data("color")
- $('input#label_color').val(color)
- updateColorPreview()
- e.preventDefault()
-
- $('input#label_color').on 'input', ->
- updateColorPreview()
-
- updateColorPreview()
diff --git a/app/views/projects/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml
index 725bf852078..03a8f0921b7 100644
--- a/app/views/projects/labels/_label.html.haml
+++ b/app/views/projects/labels/_label.html.haml
@@ -7,4 +7,4 @@
- if can? current_user, :admin_label, @project
= link_to 'Edit', edit_project_label_path(@project, label), class: 'btn'
- = link_to 'Remove', project_label_path(@project, label), class: 'btn btn-remove', method: :delete, data: {confirm: "Remove this label? Are you sure?"}
+ = link_to 'Remove', project_label_path(@project, label), class: 'btn btn-remove remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"}
diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml
index 979c27daa2b..df79125eae6 100644
--- a/app/views/projects/milestones/_form.html.haml
+++ b/app/views/projects/milestones/_form.html.haml
@@ -21,7 +21,7 @@
.form-group
= f.label :description, "Description", class: "control-label"
.col-sm-10
- = f.text_area :description, maxlength: 2000, class: "form-control markdown-area", rows: 10
+ = f.text_area :description, maxlength: 65535, class: "form-control markdown-area", rows: 10
.hint
.pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-left Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index 3b0cf77d42e..f110e20bf00 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -12,7 +12,7 @@ class PostReceive
log("Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"")
end
- repo_path.gsub!(/.git$/, "")
+ repo_path.gsub!(/\.git$/, "")
repo_path.gsub!(/^\//, "")
project = Project.find_with_namespace(repo_path)