From 7c29f03e23c0a87b1dc9dacda173f40de17378eb Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 18 Jan 2017 13:25:10 -0600 Subject: ensure click event is bound only once --- app/assets/javascripts/diff.js.es6 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/diff.js.es6 b/app/assets/javascripts/diff.js.es6 index 5e1a4c948aa..328d383a060 100644 --- a/app/assets/javascripts/diff.js.es6 +++ b/app/assets/javascripts/diff.js.es6 @@ -2,6 +2,7 @@ (() => { const UNFOLD_COUNT = 20; + let isBound = false; class Diff { constructor() { @@ -15,10 +16,12 @@ $('.content-wrapper .container-fluid').removeClass('container-limited'); } - $(document) - .off('click', '.js-unfold, .diff-line-num a') - .on('click', '.js-unfold', this.handleClickUnfold.bind(this)) - .on('click', '.diff-line-num a', this.handleClickLineNum.bind(this)); + if (!isBound) { + $(document) + .on('click', '.js-unfold', this.handleClickUnfold.bind(this)) + .on('click', '.diff-line-num a', this.handleClickLineNum.bind(this)); + isBound = true; + } this.openAnchoredDiff(); } -- cgit v1.2.3 From bc0a82334af7ef3a49067277cc5b7a7f3889658e Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 18 Jan 2017 13:55:46 -0600 Subject: ensure last line in diff block is contained within a table row element --- app/views/projects/diffs/_parallel_view.html.haml | 3 ++- app/views/projects/diffs/_text_file.html.haml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index b087485aa17..a25d7834c29 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -38,4 +38,5 @@ - if discussion_left || discussion_right = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right - if !diff_file.new_file && last_line > 0 - = diff_match_line last_line, last_line, bottom: true, view: :parallel + %tr.line_holder.parallel + = diff_match_line last_line, last_line, bottom: true, view: :parallel diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index f1d2d4bf268..fa1b5d5f8ac 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -13,4 +13,5 @@ - last_line = diff_file.highlighted_diff_lines.last.new_pos - if !diff_file.new_file && last_line > 0 - = diff_match_line last_line, last_line, bottom: true + %tr.line_holder + = diff_match_line last_line, last_line, bottom: true -- cgit v1.2.3 From ece2e80bf88c594b454d8dce9d040f99725ef535 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 18 Jan 2017 15:03:12 -0600 Subject: ensure linenumber data attribute is correct for the last line in a diff chunk --- app/views/projects/blob/diff.html.haml | 2 +- app/views/projects/diffs/_parallel_view.html.haml | 7 +++---- app/views/projects/diffs/_text_file.html.haml | 7 +++---- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml index 538f8591f13..3b1a2e54ec2 100644 --- a/app/views/projects/blob/diff.html.haml +++ b/app/views/projects/blob/diff.html.haml @@ -27,4 +27,4 @@ - if @form.unfold? && @form.bottom? && @form.to < @blob.loc %tr.line_holder{ id: @form.to, class: line_class } - = diff_match_line @form.to, @form.to, text: @match_line, view: diff_view, bottom: true + = diff_match_line @form.to - @form.offset, @form.to, text: @match_line, view: diff_view, bottom: true diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index a25d7834c29..8145d66f192 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -1,11 +1,9 @@ / Side-by-side diff view .text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data } %table - - last_line = 0 - diff_file.parallel_diff_lines.each do |line| - left = line[:left] - right = line[:right] - - last_line = right.new_pos if right %tr.line_holder.parallel - if left - if left.meta? @@ -37,6 +35,7 @@ - discussion_left, discussion_right = parallel_diff_discussions(left, right, diff_file) - if discussion_left || discussion_right = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right - - if !diff_file.new_file && last_line > 0 + - if !diff_file.new_file && diff_file.diff_lines.any? + - last_line = diff_file.diff_lines.last %tr.line_holder.parallel - = diff_match_line last_line, last_line, bottom: true, view: :parallel + = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index fa1b5d5f8ac..2eea1db169a 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -4,14 +4,13 @@ %a.show-suppressed-diff.js-show-suppressed-diff Changes suppressed. Click to show. %table.text-file.code.js-syntax-highlight{ data: diff_view_data, class: too_big ? 'hide' : '' } - - last_line = 0 - discussions = @grouped_diff_discussions unless @diff_notes_disabled = render partial: "projects/diffs/line", collection: diff_file.highlighted_diff_lines, as: :line, locals: { diff_file: diff_file, discussions: discussions } - - last_line = diff_file.highlighted_diff_lines.last.new_pos - - if !diff_file.new_file && last_line > 0 + - if !diff_file.new_file && diff_file.highlighted_diff_lines.any? + - last_line = diff_file.highlighted_diff_lines.last %tr.line_holder - = diff_match_line last_line, last_line, bottom: true + = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true -- cgit v1.2.3 From 7c583293cda3be8def5c665000a540124c838122 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 18 Jan 2017 16:40:34 -0600 Subject: prevent nonewline type diff lines from containing unfolding link --- app/views/projects/diffs/_parallel_view.html.haml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index b087485aa17..cbd021487ef 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -8,8 +8,12 @@ - last_line = right.new_pos if right %tr.line_holder.parallel - if left - - if left.meta? + - case left.type + - when 'match' = diff_match_line left.old_pos, nil, text: left.text, view: :parallel + - when 'nonewline' + %td.old_line.diff-line-num + %td.line_content.match= left.text - else - left_line_code = diff_file.line_code(left) - left_position = diff_file.position(left) @@ -21,8 +25,12 @@ %td.line_content.parallel - if right - - if right.meta? + - case right.type + - when 'match' = diff_match_line nil, right.new_pos, text: left.text, view: :parallel + - when 'nonewline' + %td.new_line.diff-line-num + %td.line_content.match= right.text - else - right_line_code = diff_file.line_code(right) - right_position = diff_file.position(right) -- cgit v1.2.3 From 63dac85385c6f82db6c6465876d76f67173ebc3b Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Sat, 4 Feb 2017 00:00:26 +1100 Subject: Fixed redirection from http://someproject.git to http://someproject --- app/controllers/projects/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index b2ff36f6538..f9d550ffb85 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -18,7 +18,7 @@ class Projects::ApplicationController < ApplicationController # to # localhost/group/project # - if id =~ /\.git\Z/ + if params[:format] == 'git' redirect_to request.original_url.gsub(/\.git\/?\Z/, '') return end -- cgit v1.2.3 From 644d8eb9d47835a748280aeb9a6cb154b65b2a35 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 3 Feb 2017 17:53:36 +0000 Subject: Fixed eslint test failure --- app/assets/javascripts/project.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/project.js b/app/assets/javascripts/project.js index 67f8804666d..ba99d1fd913 100644 --- a/app/assets/javascripts/project.js +++ b/app/assets/javascripts/project.js @@ -58,8 +58,8 @@ }; Project.prototype.initRefSwitcher = function() { - var refListItem = document.createElement('li'), - refLink = document.createElement('a'); + var refListItem = document.createElement('li'); + var refLink = document.createElement('a'); refLink.href = '#'; -- cgit v1.2.3 From 8063628b903d4a8498152d4c3c7c22fca2768957 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 3 Feb 2017 19:26:48 +0100 Subject: Move webhooks to new a location under Integrations --- app/helpers/search_helper.rb | 2 +- app/views/shared/web_hooks/_form.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 37b69423c97..8ff8db16514 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -56,7 +56,7 @@ module SearchHelper { category: "Help", label: "Rake Tasks Help", url: help_page_path("raketasks/README") }, { category: "Help", label: "SSH Keys Help", url: help_page_path("ssh/README") }, { category: "Help", label: "System Hooks Help", url: help_page_path("system_hooks/system_hooks") }, - { category: "Help", label: "Webhooks Help", url: help_page_path("web_hooks/web_hooks") }, + { category: "Help", label: "Webhooks Help", url: help_page_path("user/project/integrations/webhooks") }, { category: "Help", label: "Workflow Help", url: help_page_path("workflow/README") }, ] end diff --git a/app/views/shared/web_hooks/_form.html.haml b/app/views/shared/web_hooks/_form.html.haml index 13586a5a12a..0236541fd9b 100644 --- a/app/views/shared/web_hooks/_form.html.haml +++ b/app/views/shared/web_hooks/_form.html.haml @@ -3,7 +3,7 @@ %h4.prepend-top-0 = page_title %p - #{link_to "Webhooks", help_page_path("web_hooks/web_hooks")} can be + #{link_to "Webhooks", help_page_path("user/project/integrations//webhooks")} can be used for binding events when something is happening within the project. .col-lg-9.append-bottom-default = form_for hook, as: :hook, url: polymorphic_path(url_components + [:hooks]) do |f| -- cgit v1.2.3 From a6ac23250a41bd6be7f4e530bff22a8e1cfd3104 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 3 Feb 2017 19:41:35 +0100 Subject: Move project services to new location under Integrations --- app/views/shared/web_hooks/_form.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/shared/web_hooks/_form.html.haml b/app/views/shared/web_hooks/_form.html.haml index 0236541fd9b..8f64ba043b5 100644 --- a/app/views/shared/web_hooks/_form.html.haml +++ b/app/views/shared/web_hooks/_form.html.haml @@ -3,7 +3,7 @@ %h4.prepend-top-0 = page_title %p - #{link_to "Webhooks", help_page_path("user/project/integrations//webhooks")} can be + #{link_to "Webhooks", help_page_path("user/project/integrations/webhooks")} can be used for binding events when something is happening within the project. .col-lg-9.append-bottom-default = form_for hook, as: :hook, url: polymorphic_path(url_components + [:hooks]) do |f| -- cgit v1.2.3