Upstream version 8.4.3+dfsg
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJWtLfUAAoJEM4fnGdFEsIqruoQAJqBpdoLNFnMWMIinZQhN7cg cVJg5jZ1nHVLIzB5KUiKd436DRgsqeUpzHrNoAVtV9+9wxxWLZUuX/gryV3uqti1 rWgc9mH/2ly0NVg0NeAVWie7gdgv8ut8JT8fAsSD3uqmMncn3BysqYOjDrA5AKLj 9YbRluzM3q74sWsIbzvUsTJaJJ74jEa6C+YEyuM8UNbp3gljsHrhaQ/rUlrQ2/lw RfJDzRjdUgVOQ201p380VH8cmF9uBF7RDMW6gYVzYG9BJuF6V6Gghnu0P0H/nRbv REhzeYswD6ni8LIaalxSmQ0rjSfQrP8K23OB8F4qOGj+SYcsE5+9PYZ0ZmAcd4XR /tBKipv1uEJEZnt4Q9o1o22v3Kn1l0P1kbjhCrLtIbCcBmmv6Hgj8FCAh5K7CUsx jjnWRbxASIYFIPBsyTrPJ8/qyZWiuqiX6Rq6Io1K+fuqWsi9/HOo20/YogxsPbx5 c/76nukY2x+xv8UEv8Q8sFz7oUnzuhVj9DC/jgpd4dA+FNEpYBK5x6Md8qpxvx2F /Wqfb0M6Y+y0lIhK2ivLgqfl2UeJ/sf6n4D4KnbpdFm5n+pMIXE4Q47vUXlL6znW D1VBVRT+YNOdyRh9CPGUqRLVHfRfw+OK/KlSUZKV7doZVIfe5icQxzU7g5bIiy7s 0KSBIFs9V07hVEjWZ+MD =Dzft -----END PGP SIGNATURE----- Merge tag 'upstream/8.4.3+dfsg' Upstream version 8.4.3+dfsg # gpg: Signature made Friday 05 February 2016 08:25:16 PM IST using RSA key ID 4512C22A # gpg: Good signature from "Praveen Arimbrathodiyil (piratepin) <praveen@debian.org>" # gpg: aka "Pirate Praveen (pirates.org.in) <praveen@onenetbeyond.org>" # gpg: aka "Pirate Praveen (piratesin) <me@j4v4m4n.in>" # gpg: aka "Pirate Praveen (PP) <praveen@privacyrequired.com>" # gpg: aka "Praveen Arimbrathodiyil (j4v4m4n) <pravi.a@gmail.com>"
This commit is contained in:
commit
1fa17d8af6
70 changed files with 1099 additions and 550 deletions
|
@ -1,4 +1,13 @@
|
||||||
# This file is generated by GitLab CI
|
image: "ruby:2.1"
|
||||||
|
|
||||||
|
services:
|
||||||
|
- mysql:latest
|
||||||
|
- postgres:latest
|
||||||
|
- redis:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: "1"
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- ./scripts/prepare_build.sh
|
- ./scripts/prepare_build.sh
|
||||||
- ruby -v
|
- ruby -v
|
||||||
|
|
31
CHANGELOG
31
CHANGELOG
|
@ -1,6 +1,35 @@
|
||||||
Please view this file on the master branch, on stable branches it's out of date.
|
Please view this file on the master branch, on stable branches it's out of date.
|
||||||
|
|
||||||
v 8.4.0 (unreleased)
|
v 8.4.3
|
||||||
|
- Increase lfs_objects size column to 8-byte integer to allow files larger
|
||||||
|
than 2.1GB
|
||||||
|
- Correctly highlight MR diff when MR has merge conflicts
|
||||||
|
- Fix highlighting in blame view
|
||||||
|
- Update sentry-raven gem to prevent "Not a git repository" console output
|
||||||
|
when running certain commands
|
||||||
|
- Add instrumentation to additional Gitlab::Git and Rugged methods for
|
||||||
|
performance monitoring
|
||||||
|
- Allow autosize textareas to also be manually resized
|
||||||
|
|
||||||
|
v 8.4.2
|
||||||
|
- Bump required gitlab-workhorse version to bring in a fix for missing
|
||||||
|
artifacts in the build artifacts browser
|
||||||
|
- Get rid of those ugly borders on the file tree view
|
||||||
|
- Fix updating the runner information when asking for builds
|
||||||
|
- Bump gitlab_git version to 7.2.24 in order to bring in a performance
|
||||||
|
improvement when checking if a repository was empty
|
||||||
|
- Add instrumentation for Gitlab::Git::Repository instance methods so we can
|
||||||
|
track them in Performance Monitoring.
|
||||||
|
- Increase contrast between highlighted code comments and inline diff marker
|
||||||
|
- Fix method undefined when using external commit status in builds
|
||||||
|
|
||||||
|
v 8.4.1
|
||||||
|
- Apply security updates for Rails (4.2.5.1), rails-html-sanitizer (1.0.3),
|
||||||
|
and Nokogiri (1.6.7.2)
|
||||||
|
- Fix redirect loop during import
|
||||||
|
- Fix diff highlighting for all syntax themes
|
||||||
|
|
||||||
|
v 8.4.0
|
||||||
- Allow LDAP users to change their email if it was not set by the LDAP server
|
- Allow LDAP users to change their email if it was not set by the LDAP server
|
||||||
- Ensure Gravatar host looks like an actual host
|
- Ensure Gravatar host looks like an actual host
|
||||||
- Consider re-assign as a mention from a notification point of view
|
- Consider re-assign as a mention from a notification point of view
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6.1
|
0.6.2
|
||||||
|
|
5
Gemfile
5
Gemfile
|
@ -1,6 +1,6 @@
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem 'rails', '4.2.4'
|
gem 'rails', '4.2.5.1'
|
||||||
gem 'rails-deprecated_sanitizer', '~> 1.0.3'
|
gem 'rails-deprecated_sanitizer', '~> 1.0.3'
|
||||||
|
|
||||||
# Responders respond_to and respond_with
|
# Responders respond_to and respond_with
|
||||||
|
@ -103,7 +103,8 @@ gem 'asciidoctor', '~> 1.5.2'
|
||||||
gem 'rouge', '~> 1.10.1'
|
gem 'rouge', '~> 1.10.1'
|
||||||
|
|
||||||
# See https://groups.google.com/forum/#!topic/ruby-security-ann/aSbgDiwb24s
|
# See https://groups.google.com/forum/#!topic/ruby-security-ann/aSbgDiwb24s
|
||||||
gem 'nokogiri', '1.6.7.1'
|
# and https://groups.google.com/forum/#!topic/ruby-security-ann/Dy7YiKb_pMM
|
||||||
|
gem 'nokogiri', '1.6.7.2'
|
||||||
|
|
||||||
# Diffs
|
# Diffs
|
||||||
gem 'diffy', '~> 3.0.3'
|
gem 'diffy', '~> 3.0.3'
|
||||||
|
|
70
Gemfile.lock
70
Gemfile.lock
|
@ -4,41 +4,41 @@ GEM
|
||||||
CFPropertyList (2.3.2)
|
CFPropertyList (2.3.2)
|
||||||
RedCloth (4.2.9)
|
RedCloth (4.2.9)
|
||||||
ace-rails-ap (2.0.1)
|
ace-rails-ap (2.0.1)
|
||||||
actionmailer (4.2.4)
|
actionmailer (4.2.5.1)
|
||||||
actionpack (= 4.2.4)
|
actionpack (= 4.2.5.1)
|
||||||
actionview (= 4.2.4)
|
actionview (= 4.2.5.1)
|
||||||
activejob (= 4.2.4)
|
activejob (= 4.2.5.1)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||||
actionpack (4.2.4)
|
actionpack (4.2.5.1)
|
||||||
actionview (= 4.2.4)
|
actionview (= 4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
rack (~> 1.6)
|
rack (~> 1.6)
|
||||||
rack-test (~> 0.6.2)
|
rack-test (~> 0.6.2)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (4.2.4)
|
actionview (4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
activejob (4.2.4)
|
activejob (4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
globalid (>= 0.3.0)
|
globalid (>= 0.3.0)
|
||||||
activemodel (4.2.4)
|
activemodel (4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
activerecord (4.2.4)
|
activerecord (4.2.5.1)
|
||||||
activemodel (= 4.2.4)
|
activemodel (= 4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
arel (~> 6.0)
|
arel (~> 6.0)
|
||||||
activerecord-deprecated_finders (1.0.4)
|
activerecord-deprecated_finders (1.0.4)
|
||||||
activerecord-session_store (0.1.2)
|
activerecord-session_store (0.1.2)
|
||||||
actionpack (>= 4.0.0, < 5)
|
actionpack (>= 4.0.0, < 5)
|
||||||
activerecord (>= 4.0.0, < 5)
|
activerecord (>= 4.0.0, < 5)
|
||||||
railties (>= 4.0.0, < 5)
|
railties (>= 4.0.0, < 5)
|
||||||
activesupport (4.2.4)
|
activesupport (4.2.5.1)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
|
@ -356,7 +356,7 @@ GEM
|
||||||
posix-spawn (~> 0.3)
|
posix-spawn (~> 0.3)
|
||||||
gitlab_emoji (0.2.0)
|
gitlab_emoji (0.2.0)
|
||||||
gemojione (~> 2.1)
|
gemojione (~> 2.1)
|
||||||
gitlab_git (7.2.22)
|
gitlab_git (7.2.24)
|
||||||
activesupport (~> 4.0)
|
activesupport (~> 4.0)
|
||||||
charlock_holmes (~> 0.7.3)
|
charlock_holmes (~> 0.7.3)
|
||||||
github-linguist (~> 4.7.0)
|
github-linguist (~> 4.7.0)
|
||||||
|
@ -482,7 +482,7 @@ GEM
|
||||||
grape
|
grape
|
||||||
newrelic_rpm
|
newrelic_rpm
|
||||||
newrelic_rpm (3.9.4.245)
|
newrelic_rpm (3.9.4.245)
|
||||||
nokogiri (1.6.7.1)
|
nokogiri (1.6.7.2)
|
||||||
mini_portile2 (~> 2.0.0.rc2)
|
mini_portile2 (~> 2.0.0.rc2)
|
||||||
nprogress-rails (0.1.6.7)
|
nprogress-rails (0.1.6.7)
|
||||||
oauth (0.4.7)
|
oauth (0.4.7)
|
||||||
|
@ -588,16 +588,16 @@ GEM
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (4.2.4)
|
rails (4.2.5.1)
|
||||||
actionmailer (= 4.2.4)
|
actionmailer (= 4.2.5.1)
|
||||||
actionpack (= 4.2.4)
|
actionpack (= 4.2.5.1)
|
||||||
actionview (= 4.2.4)
|
actionview (= 4.2.5.1)
|
||||||
activejob (= 4.2.4)
|
activejob (= 4.2.5.1)
|
||||||
activemodel (= 4.2.4)
|
activemodel (= 4.2.5.1)
|
||||||
activerecord (= 4.2.4)
|
activerecord (= 4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
railties (= 4.2.4)
|
railties (= 4.2.5.1)
|
||||||
sprockets-rails
|
sprockets-rails
|
||||||
rails-deprecated_sanitizer (1.0.3)
|
rails-deprecated_sanitizer (1.0.3)
|
||||||
activesupport (>= 4.2.0.alpha)
|
activesupport (>= 4.2.0.alpha)
|
||||||
|
@ -605,11 +605,11 @@ GEM
|
||||||
activesupport (>= 4.2.0.beta, < 5.0)
|
activesupport (>= 4.2.0.beta, < 5.0)
|
||||||
nokogiri (~> 1.6.0)
|
nokogiri (~> 1.6.0)
|
||||||
rails-deprecated_sanitizer (>= 1.0.1)
|
rails-deprecated_sanitizer (>= 1.0.1)
|
||||||
rails-html-sanitizer (1.0.2)
|
rails-html-sanitizer (1.0.3)
|
||||||
loofah (~> 2.0)
|
loofah (~> 2.0)
|
||||||
railties (4.2.4)
|
railties (4.2.5.1)
|
||||||
actionpack (= 4.2.4)
|
actionpack (= 4.2.5.1)
|
||||||
activesupport (= 4.2.4)
|
activesupport (= 4.2.5.1)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (2.0.0)
|
rainbow (2.0.0)
|
||||||
|
@ -725,7 +725,7 @@ GEM
|
||||||
activesupport (>= 3.1, < 4.3)
|
activesupport (>= 3.1, < 4.3)
|
||||||
select2-rails (3.5.9.3)
|
select2-rails (3.5.9.3)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
sentry-raven (0.15.3)
|
sentry-raven (0.15.4)
|
||||||
faraday (>= 0.7.6)
|
faraday (>= 0.7.6)
|
||||||
settingslogic (2.0.9)
|
settingslogic (2.0.9)
|
||||||
sexp_processor (4.6.0)
|
sexp_processor (4.6.0)
|
||||||
|
@ -962,7 +962,7 @@ DEPENDENCIES
|
||||||
net-ssh (~> 3.0.1)
|
net-ssh (~> 3.0.1)
|
||||||
newrelic-grape
|
newrelic-grape
|
||||||
newrelic_rpm (~> 3.9.4.245)
|
newrelic_rpm (~> 3.9.4.245)
|
||||||
nokogiri (= 1.6.7.1)
|
nokogiri (= 1.6.7.2)
|
||||||
nprogress-rails (~> 0.1.6.7)
|
nprogress-rails (~> 0.1.6.7)
|
||||||
oauth2 (~> 1.0.0)
|
oauth2 (~> 1.0.0)
|
||||||
octokit (~> 3.7.0)
|
octokit (~> 3.7.0)
|
||||||
|
@ -988,7 +988,7 @@ DEPENDENCIES
|
||||||
rack-attack (~> 4.3.1)
|
rack-attack (~> 4.3.1)
|
||||||
rack-cors (~> 0.4.0)
|
rack-cors (~> 0.4.0)
|
||||||
rack-oauth2 (~> 1.2.1)
|
rack-oauth2 (~> 1.2.1)
|
||||||
rails (= 4.2.4)
|
rails (= 4.2.5.1)
|
||||||
rails-deprecated_sanitizer (~> 1.0.3)
|
rails-deprecated_sanitizer (~> 1.0.3)
|
||||||
raphael-rails (~> 2.1.2)
|
raphael-rails (~> 2.1.2)
|
||||||
rblineprof
|
rblineprof
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
8.4.0
|
8.4.3
|
|
@ -1,4 +1,22 @@
|
||||||
|
#= require jquery.ba-resize
|
||||||
#= require autosize
|
#= require autosize
|
||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
autosize($('.js-autosize'))
|
$fields = $('.js-autosize')
|
||||||
|
|
||||||
|
$fields.on 'autosize:resized', ->
|
||||||
|
$field = $(@)
|
||||||
|
$field.data('height', $field.outerHeight())
|
||||||
|
|
||||||
|
$fields.on 'resize.autosize', ->
|
||||||
|
$field = $(@)
|
||||||
|
|
||||||
|
if $field.data('height') != $field.outerHeight()
|
||||||
|
$field.data('height', $field.outerHeight())
|
||||||
|
autosize.destroy($field)
|
||||||
|
$field.css('max-height', window.outerHeight)
|
||||||
|
|
||||||
|
autosize($fields)
|
||||||
|
autosize.update($fields)
|
||||||
|
|
||||||
|
$fields.css('resize', 'vertical')
|
||||||
|
|
|
@ -32,6 +32,7 @@ class @EditBlob
|
||||||
content: editor.getValue()
|
content: editor.getValue()
|
||||||
, (response) ->
|
, (response) ->
|
||||||
currentPane.empty().append response
|
currentPane.empty().append response
|
||||||
|
currentPane.syntaxHighlight()
|
||||||
return
|
return
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -120,14 +120,6 @@ span.update-author {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line_holder {
|
|
||||||
&:hover {
|
|
||||||
td {
|
|
||||||
background: #FFFFCF !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.time {
|
p.time {
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
|
@ -319,14 +311,6 @@ table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wiki .highlight, .note-body .highlight {
|
|
||||||
margin: 12px 0 12px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wiki .code {
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-links {
|
.footer-links {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
a {
|
a {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
border: 1px solid $border-color;
|
border: 1px solid $border-color;
|
||||||
|
|
||||||
&.readme-holder {
|
&.readme-holder {
|
||||||
|
margin-top: 10px;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +93,6 @@
|
||||||
&:last-child {
|
&:last-child {
|
||||||
border-right: none;
|
border-right: none;
|
||||||
}
|
}
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
.lines {
|
|
||||||
pre {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
img.avatar {
|
img.avatar {
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
|
@ -116,18 +108,18 @@
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
td.blame-numbers {
|
td.line-numbers {
|
||||||
pre {
|
float: none;
|
||||||
color: #AAA;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
|
||||||
background: #f1f1f1;
|
|
||||||
border-left: 1px solid #DDD;
|
border-left: 1px solid #DDD;
|
||||||
}
|
}
|
||||||
td.lines {
|
td.lines {
|
||||||
|
padding: 0;
|
||||||
code {
|
code {
|
||||||
font-family: $monospace_font;
|
font-family: $monospace_font;
|
||||||
}
|
}
|
||||||
|
pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
word-wrap: normal;
|
word-wrap: normal;
|
||||||
|
border-left: 1px solid;
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: $monospace_font;
|
font-family: $monospace_font;
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
display: inline;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,18 +54,3 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-text .code {
|
|
||||||
border: none;
|
|
||||||
box-shadow: none;
|
|
||||||
background: $background-color;
|
|
||||||
padding: 1em;
|
|
||||||
overflow-x: auto;
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: $monospace_font;
|
|
||||||
white-space: pre;
|
|
||||||
word-wrap: normal;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
min-height: 140px;
|
min-height: 140px;
|
||||||
max-height: 430px;
|
max-height: 500px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -33,12 +33,12 @@ table {
|
||||||
background-color: $background-color;
|
background-color: $background-color;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
border-bottom: 1px solid $border-color !important;
|
border-bottom: 1px solid $border-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
border-color: $table-border-color !important;
|
border-color: $table-border-color;
|
||||||
border-bottom: 1px solid;
|
border-bottom: 1px solid $border-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
color:#5c5d5e;
|
color: #5c5d5e;
|
||||||
margin:6px 0 0 0;
|
margin: 6px 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
@ -102,11 +102,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
margin: 12px 0 12px 0 !important;
|
margin: 12px 0 12px 0;
|
||||||
background-color: #f8fafc;
|
font-size: 13px;
|
||||||
font-size: 13px !important;
|
line-height: 1.6em;
|
||||||
color: #5b6169;
|
overflow-x: auto;
|
||||||
line-height: 1.6em !important;
|
|
||||||
@include border-radius(2px);
|
@include border-radius(2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,11 +203,6 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
pre {
|
pre {
|
||||||
font-family: $monospace_font;
|
font-family: $monospace_font;
|
||||||
|
|
||||||
&.dark {
|
|
||||||
background: #333;
|
|
||||||
color: $background-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.plain-readme {
|
&.plain-readme {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
|
|
@ -1,18 +1,38 @@
|
||||||
/* https://github.com/MozMorris/tomorrow-pygments */
|
/* https://github.com/MozMorris/tomorrow-pygments */
|
||||||
.code.dark {
|
.code.dark {
|
||||||
|
// Line numbers
|
||||||
background-color: #1d1f21 !important;
|
.line-numbers, .diff-line-num {
|
||||||
color: #c5c8c6 !important;
|
background-color: #1d1f21;
|
||||||
|
|
||||||
pre.highlight,
|
|
||||||
.line-numbers,
|
|
||||||
.line-numbers a {
|
|
||||||
background-color: #1d1f21 !important;
|
|
||||||
color: #c5c8c6 !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.code {
|
.diff-line-num, .diff-line-num a {
|
||||||
border-left: 1px solid #666;
|
color: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code itself
|
||||||
|
pre.code, .diff-line-num {
|
||||||
|
border-color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
&, pre.code, .line_holder .line_content {
|
||||||
|
background-color: #1d1f21;
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Diff line
|
||||||
|
.line_holder {
|
||||||
|
.diff-line-num.new, .line_content.new {
|
||||||
|
@include diff_background(rgba(51, 255, 51, 0.1), rgba(51, 255, 51, 0.2), #808080);
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-line-num.old, .line_content.old {
|
||||||
|
@include diff_background(rgba(255, 51, 51, 0.2), rgba(255, 51, 51, 0.25), #808080);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line_content.match {
|
||||||
|
color: rgba(255, 255, 255, 0.3);
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight line via anchor
|
// highlight line via anchor
|
||||||
|
@ -90,22 +110,4 @@
|
||||||
.vg { color: #cc6666 } /* Name.Variable.Global */
|
.vg { color: #cc6666 } /* Name.Variable.Global */
|
||||||
.vi { color: #cc6666 } /* Name.Variable.Instance */
|
.vi { color: #cc6666 } /* Name.Variable.Instance */
|
||||||
.il { color: #de935f } /* Literal.Number.Integer.Long */
|
.il { color: #de935f } /* Literal.Number.Integer.Long */
|
||||||
|
|
||||||
.line_holder {
|
|
||||||
&.parallel .new.new_line,
|
|
||||||
&.parallel .new.line_content,
|
|
||||||
&.new .old_line,
|
|
||||||
&.new .new_line,
|
|
||||||
&.new .line_content {
|
|
||||||
@include diff_background(255, 255, 255, #808080);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.parallel .old.old_line,
|
|
||||||
&.parallel .old.line_content,
|
|
||||||
&.old .old_line,
|
|
||||||
&.old .new_line,
|
|
||||||
&.old .line_content {
|
|
||||||
@include diff_background(255, 51, 51, #808080);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,38 @@
|
||||||
/* https://github.com/richleland/pygments-css/blob/master/monokai.css */
|
/* https://github.com/richleland/pygments-css/blob/master/monokai.css */
|
||||||
.code.monokai {
|
.code.monokai {
|
||||||
|
// Line numbers
|
||||||
background-color: #272822 !important;
|
.line-numbers, .diff-line-num {
|
||||||
color: #f8f8f2 !important;
|
background-color: #272822;
|
||||||
|
|
||||||
pre.highlight,
|
|
||||||
.line-numbers,
|
|
||||||
.line-numbers a {
|
|
||||||
background-color :#272822 !important;
|
|
||||||
color: #f8f8f2 !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.code {
|
.diff-line-num, .diff-line-num a {
|
||||||
border-left: 1px solid #555;
|
color: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code itself
|
||||||
|
pre.code, .diff-line-num {
|
||||||
|
border-color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
&, pre.code, .line_holder .line_content {
|
||||||
|
background-color: #272822;
|
||||||
|
color: #f8f8f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Diff line
|
||||||
|
.line_holder {
|
||||||
|
.diff-line-num.new, .line_content.new {
|
||||||
|
@include diff_background(rgba(166, 226, 46, 0.1), rgba(166, 226, 46, 0.15), #808080);
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-line-num.old, .line_content.old {
|
||||||
|
@include diff_background(rgba(254, 147, 140, 0.15), rgba(254, 147, 140, 0.2), #808080);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line_content.match {
|
||||||
|
color: rgba(255, 255, 255, 0.3);
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight line via anchor
|
// highlight line via anchor
|
||||||
|
@ -90,22 +110,4 @@
|
||||||
.gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */
|
.gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */
|
||||||
.gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */
|
.gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */
|
||||||
.gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */
|
.gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */
|
||||||
|
|
||||||
.line_holder {
|
|
||||||
&.parallel .new.new_line,
|
|
||||||
&.parallel .new.line_content,
|
|
||||||
&.new .old_line,
|
|
||||||
&.new .new_line,
|
|
||||||
&.new .line_content {
|
|
||||||
@include diff_background(156, 175, 183, #808080);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.parallel .old.old_line,
|
|
||||||
&.parallel .old.line_content,
|
|
||||||
&.old .old_line,
|
|
||||||
&.old .new_line,
|
|
||||||
&.old .line_content {
|
|
||||||
@include diff_background(254, 147, 140, #808080);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,38 @@
|
||||||
/* https://gist.github.com/qguv/7936275 */
|
/* https://gist.github.com/qguv/7936275 */
|
||||||
.code.solarized-dark {
|
.code.solarized-dark {
|
||||||
|
// Line numbers
|
||||||
background-color: #002b36 !important;
|
.line-numbers, .diff-line-num {
|
||||||
color: #93a1a1 !important;
|
background-color: #002b36;
|
||||||
|
|
||||||
pre.highlight,
|
|
||||||
.line-numbers,
|
|
||||||
.line-numbers a {
|
|
||||||
background-color: #002b36 !important;
|
|
||||||
color: #93a1a1 !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.code {
|
.diff-line-num, .diff-line-num a {
|
||||||
border-left: 1px solid #113b46;
|
color: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code itself
|
||||||
|
pre.code, .diff-line-num {
|
||||||
|
border-color: #113b46;
|
||||||
|
}
|
||||||
|
|
||||||
|
&, pre.code, .line_holder .line_content {
|
||||||
|
background-color: #002b36;
|
||||||
|
color: #93a1a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Diff line
|
||||||
|
.line_holder {
|
||||||
|
.diff-line-num.new, .line_content.new {
|
||||||
|
@include diff_background(rgba(133, 153, 0, 0.15), rgba(133, 153, 0, 0.25), #113b46);
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-line-num.old, .line_content.old {
|
||||||
|
@include diff_background(rgba(220, 50, 47, 0.3), rgba(220, 50, 47, 0.25), #113b46);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line_content.match {
|
||||||
|
color: rgba(255, 255, 255, 0.3);
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight line via anchor
|
// highlight line via anchor
|
||||||
|
@ -111,22 +131,4 @@
|
||||||
.vg { color: #268bd2 } /* Name.Variable.Global */
|
.vg { color: #268bd2 } /* Name.Variable.Global */
|
||||||
.vi { color: #268bd2 } /* Name.Variable.Instance */
|
.vi { color: #268bd2 } /* Name.Variable.Instance */
|
||||||
.il { color: #2aa198 } /* Literal.Number.Integer.Long */
|
.il { color: #2aa198 } /* Literal.Number.Integer.Long */
|
||||||
|
|
||||||
.line_holder {
|
|
||||||
&.parallel .new.new_line,
|
|
||||||
&.parallel .new.line_content,
|
|
||||||
&.new .old_line,
|
|
||||||
&.new .new_line,
|
|
||||||
&.new .line_content {
|
|
||||||
@include diff_background(255, 255, 255, #808080);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.parallel .old.old_line,
|
|
||||||
&.parallel .old.line_content,
|
|
||||||
&.old .old_line,
|
|
||||||
&.old .new_line,
|
|
||||||
&.old .line_content {
|
|
||||||
@include diff_background(255, 51, 51, #808080);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,38 @@
|
||||||
/* https://gist.github.com/qguv/7936275 */
|
/* https://gist.github.com/qguv/7936275 */
|
||||||
.code.solarized-light {
|
.code.solarized-light {
|
||||||
|
// Line numbers
|
||||||
background-color: #fdf6e3 !important;
|
.line-numbers, .diff-line-num {
|
||||||
color: #586e75 !important;
|
background-color: #fdf6e3;
|
||||||
|
|
||||||
pre.highlight,
|
|
||||||
.line-numbers,
|
|
||||||
.line-numbers a {
|
|
||||||
background-color: #fdf6e3 !important;
|
|
||||||
color: #586e75 !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.code {
|
.diff-line-num, .diff-line-num a {
|
||||||
border-left: 1px solid #c5d0d4;
|
color: rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code itself
|
||||||
|
pre.code, .diff-line-num {
|
||||||
|
border-color: #c5d0d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
&, pre.code, .line_holder .line_content {
|
||||||
|
background-color: #fdf6e3;
|
||||||
|
color: #586e75;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Diff line
|
||||||
|
.line_holder {
|
||||||
|
.diff-line-num.new, .line_content.new {
|
||||||
|
@include diff_background(rgba(133, 153, 0, 0.2), rgba(133, 153, 0, 0.25), #c5d0d4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-line-num.old, .line_content.old {
|
||||||
|
@include diff_background(rgba(220, 50, 47, 0.2), rgba(220, 50, 47, 0.25), #c5d0d4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line_content.match {
|
||||||
|
color: rgba(0, 0, 0, 0.3);
|
||||||
|
background: rgba(255, 255, 255, 0.4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight line via anchor
|
// highlight line via anchor
|
||||||
|
@ -111,23 +131,4 @@
|
||||||
.vg { color: #268bd2 } /* Name.Variable.Global */
|
.vg { color: #268bd2 } /* Name.Variable.Global */
|
||||||
.vi { color: #268bd2 } /* Name.Variable.Instance */
|
.vi { color: #268bd2 } /* Name.Variable.Instance */
|
||||||
.il { color: #2aa198 } /* Literal.Number.Integer.Long */
|
.il { color: #2aa198 } /* Literal.Number.Integer.Long */
|
||||||
|
|
||||||
|
|
||||||
.line_holder {
|
|
||||||
&.parallel .new.new_line,
|
|
||||||
&.parallel .new.line_content,
|
|
||||||
&.new .old_line,
|
|
||||||
&.new .new_line,
|
|
||||||
&.new .line_content {
|
|
||||||
@include diff_background(92, 164, 169, #FAF3DD);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.parallel .old.old_line,
|
|
||||||
&.parallel .old.line_content,
|
|
||||||
&.old .old_line,
|
|
||||||
&.old .new_line,
|
|
||||||
&.old .line_content {
|
|
||||||
@include diff_background(237, 106, 90, #FAF3DD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,60 @@
|
||||||
/* https://github.com/aahan/pygments-github-style */
|
/* https://github.com/aahan/pygments-github-style */
|
||||||
.code.white {
|
.code.white {
|
||||||
|
// Line numbers
|
||||||
background-color: #f8fafc !important;
|
.line-numbers, .diff-line-num {
|
||||||
color: #5b6169 !important;
|
background-color: $background-color;
|
||||||
|
|
||||||
pre.highlight,
|
|
||||||
.line-numbers,
|
|
||||||
.line-numbers a {
|
|
||||||
background-color: $background-color !important;
|
|
||||||
color: $gl-gray !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.code {
|
.diff-line-num, .diff-line-num a {
|
||||||
border-left: 1px solid $border-color;
|
color: rgba(0, 0, 0, 0.3);
|
||||||
background-color: #fff !important;
|
}
|
||||||
color: #333 !important;
|
|
||||||
|
// Code itself
|
||||||
|
pre.code, .diff-line-num {
|
||||||
|
border-color: $border-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&, pre.code, .line_holder .line_content {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Diff line
|
||||||
|
.line_holder {
|
||||||
|
.diff-line-num {
|
||||||
|
&.old {
|
||||||
|
background: #ffdddd;
|
||||||
|
border-color: #f1c0c0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.new {
|
||||||
|
background: #dbffdb;
|
||||||
|
border-color: #c1e9c1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.line_content {
|
||||||
|
&.old {
|
||||||
|
background: #ffecec;
|
||||||
|
|
||||||
|
span.idiff {
|
||||||
|
background-color: #f8cbcb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.new {
|
||||||
|
background: #eaffea;
|
||||||
|
|
||||||
|
span.idiff {
|
||||||
|
background-color: #a6f3a6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.match {
|
||||||
|
color: rgba(0, 0, 0, 0.3);
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight line via anchor
|
// highlight line via anchor
|
||||||
|
|
|
@ -32,16 +32,6 @@
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|
||||||
.old {
|
|
||||||
span.idiff {
|
|
||||||
background-color: #f8cbcb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.new {
|
|
||||||
span.idiff {
|
|
||||||
background-color: #a6f3a6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.unfold {
|
.unfold {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +65,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.line_holder.parallel {
|
tr.line_holder.parallel {
|
||||||
.old_line, .new_line, .diff_line {
|
.old_line, .new_line {
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,14 +74,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.old_line, .new_line, .diff_line {
|
.old_line, .new_line {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
border: none;
|
border: none;
|
||||||
background: $background-color;
|
|
||||||
color: rgba(0, 0, 0, 0.3);
|
|
||||||
padding: 0px 5px;
|
padding: 0px 5px;
|
||||||
border-right: 1px solid $border-color;
|
border-right: 1px solid;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
min-width: 35px;
|
min-width: 35px;
|
||||||
max-width: 50px;
|
max-width: 50px;
|
||||||
|
@ -101,48 +89,16 @@
|
||||||
float: left;
|
float: left;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
color: rgba(0, 0, 0, 0.3);
|
|
||||||
&:hover {
|
&:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.new {
|
|
||||||
background: #CFD;
|
|
||||||
}
|
|
||||||
&.old {
|
|
||||||
background: #FDD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.diff_line {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
.line_holder {
|
|
||||||
&.old .old_line,
|
|
||||||
&.old .new_line {
|
|
||||||
background: #ffdddd;
|
|
||||||
border-color: #f1c0c0;
|
|
||||||
}
|
|
||||||
&.new .old_line,
|
|
||||||
&.new .new_line {
|
|
||||||
background: #dbffdb;
|
|
||||||
border-color: #c1e9c1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.line_content {
|
.line_content {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px 0.5em;
|
padding: 0px 0.5em;
|
||||||
border: none;
|
border: none;
|
||||||
&.new {
|
|
||||||
background: #eaffea;
|
|
||||||
}
|
|
||||||
&.old {
|
|
||||||
background: #ffecec;
|
|
||||||
}
|
|
||||||
&.matched {
|
|
||||||
color: $border-color;
|
|
||||||
background: #fafafa;
|
|
||||||
}
|
|
||||||
&.parallel {
|
&.parallel {
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
}
|
}
|
||||||
|
@ -393,17 +349,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin diff_background($r, $g, $b, $custom-border) {
|
@mixin diff_background($background, $idiff, $border) {
|
||||||
/* Fallback for web browsers that doesn't support RGBa */
|
background: $background;
|
||||||
background: rgb($r, $g, $b);
|
|
||||||
/* RGBa with 0.3 opacity */
|
|
||||||
background: rgba($r, $g, $b, 0.3);
|
|
||||||
|
|
||||||
&.new_line, &.old_line {
|
|
||||||
border-right-color: $custom-border !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.line_content span.idiff {
|
&.line_content span.idiff {
|
||||||
background: rgb($r, $g, $b);
|
background: $idiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.diff-line-num {
|
||||||
|
border-color: $border;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,6 @@
|
||||||
margin: 10px $gl-padding;
|
margin: 10px $gl-padding;
|
||||||
}
|
}
|
||||||
.diff-file .diff-content {
|
.diff-file .diff-content {
|
||||||
tr.line_holder:hover {
|
|
||||||
&> td.line_content {
|
|
||||||
background: $hover !important;
|
|
||||||
border-color: darken($hover, 10%) !important;
|
|
||||||
}
|
|
||||||
&> td.new_line,
|
|
||||||
&> td.old_line {
|
|
||||||
background: darken($hover, 4%) !important;
|
|
||||||
border-color: darken($hover, 10%) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.line_holder:hover > td .line_note_link {
|
tr.line_holder:hover > td .line_note_link {
|
||||||
opacity: 1.0;
|
opacity: 1.0;
|
||||||
filter: alpha(opacity=100);
|
filter: alpha(opacity=100);
|
||||||
|
@ -159,7 +147,7 @@
|
||||||
.edit_note {
|
.edit_note {
|
||||||
.markdown-area {
|
.markdown-area {
|
||||||
min-height: 140px;
|
min-height: 140px;
|
||||||
max-height: 430px;
|
max-height: 500px;
|
||||||
}
|
}
|
||||||
.note-form-actions {
|
.note-form-actions {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|
|
@ -154,6 +154,7 @@ ul.notes {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
|
color: $text-color;
|
||||||
}
|
}
|
||||||
&.notes_line2 {
|
&.notes_line2 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -242,11 +243,8 @@ ul.notes {
|
||||||
|
|
||||||
// "show" the icon also if we just hover somewhere over the line
|
// "show" the icon also if we just hover somewhere over the line
|
||||||
&:hover > td {
|
&:hover > td {
|
||||||
background: $hover !important;
|
|
||||||
|
|
||||||
.add-diff-note {
|
.add-diff-note {
|
||||||
@include show-add-diff-note;
|
@include show-add-diff-note;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
&:hover {
|
&:hover {
|
||||||
td {
|
td {
|
||||||
background: $hover;
|
background: $hover;
|
||||||
border-top: 1px solid #ADF;
|
|
||||||
border-bottom: 1px solid #ADF;
|
|
||||||
}
|
}
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,16 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||||
# We only find ourselves here
|
# We only find ourselves here
|
||||||
# if the authentication to LDAP was successful.
|
# if the authentication to LDAP was successful.
|
||||||
def ldap
|
def ldap
|
||||||
@user = Gitlab::LDAP::User.new(oauth)
|
ldap_user = Gitlab::LDAP::User.new(oauth)
|
||||||
@user.save if @user.changed? # will also save new users
|
ldap_user.save if ldap_user.changed? # will also save new users
|
||||||
gl_user = @user.gl_user
|
|
||||||
gl_user.remember_me = params[:remember_me] if @user.persisted?
|
@user = ldap_user.gl_user
|
||||||
|
@user.remember_me = params[:remember_me] if ldap_user.persisted?
|
||||||
|
|
||||||
# Do additional LDAP checks for the user filter and EE features
|
# Do additional LDAP checks for the user filter and EE features
|
||||||
if @user.allowed?
|
if ldap_user.allowed?
|
||||||
log_audit_event(gl_user, with: :ldap)
|
log_audit_event(@user, with: :ldap)
|
||||||
sign_in_and_redirect(gl_user)
|
sign_in_and_redirect(@user)
|
||||||
else
|
else
|
||||||
flash[:alert] = "Access denied for your LDAP account."
|
flash[:alert] = "Access denied for your LDAP account."
|
||||||
redirect_to new_user_session_path
|
redirect_to new_user_session_path
|
||||||
|
|
|
@ -8,28 +8,6 @@ class Projects::BlameController < Projects::ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@blob = @repository.blob_at(@commit.id, @path)
|
@blob = @repository.blob_at(@commit.id, @path)
|
||||||
@blame = group_blame_lines
|
@blame_groups = Gitlab::Blame.new(@blob, @commit).groups
|
||||||
end
|
|
||||||
|
|
||||||
def group_blame_lines
|
|
||||||
blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path)
|
|
||||||
|
|
||||||
prev_sha = nil
|
|
||||||
groups = []
|
|
||||||
current_group = nil
|
|
||||||
|
|
||||||
blame.each do |commit, line|
|
|
||||||
if prev_sha && prev_sha == commit.sha
|
|
||||||
current_group[:lines] << line
|
|
||||||
else
|
|
||||||
groups << current_group if current_group.present?
|
|
||||||
current_group = { commit: commit, lines: [line] }
|
|
||||||
end
|
|
||||||
|
|
||||||
prev_sha = commit.sha
|
|
||||||
end
|
|
||||||
|
|
||||||
groups << current_group if current_group.present?
|
|
||||||
groups
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController
|
||||||
@commits = Commit.decorate(compare_result.commits, @project)
|
@commits = Commit.decorate(compare_result.commits, @project)
|
||||||
@diffs = compare_result.diffs
|
@diffs = compare_result.diffs
|
||||||
@commit = @project.commit(head_ref)
|
@commit = @project.commit(head_ref)
|
||||||
@base_commit = @project.commit(base_ref)
|
@base_commit = @project.merge_base_commit(base_ref, head_ref)
|
||||||
@diff_refs = [@base_commit, @commit]
|
@diff_refs = [@base_commit, @commit]
|
||||||
@line_notes = []
|
@line_notes = []
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
class Projects::ImportsController < Projects::ApplicationController
|
class Projects::ImportsController < Projects::ApplicationController
|
||||||
# Authorize
|
# Authorize
|
||||||
before_action :authorize_admin_project!
|
before_action :authorize_admin_project!
|
||||||
before_action :require_no_repo, except: :show
|
before_action :require_no_repo, only: [:new, :create]
|
||||||
before_action :redirect_if_progress, except: :show
|
before_action :redirect_if_progress, only: [:new, :create]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
end
|
end
|
||||||
|
@ -24,11 +24,11 @@ class Projects::ImportsController < Projects::ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if @project.repository_exists? || @project.import_finished?
|
if @project.import_finished?
|
||||||
if continue_params
|
if continue_params
|
||||||
redirect_to continue_params[:to], notice: continue_params[:notice]
|
redirect_to continue_params[:to], notice: continue_params[:notice]
|
||||||
else
|
else
|
||||||
redirect_to project_path(@project), notice: "The project was successfully forked."
|
redirect_to namespace_project_path(@project.namespace, @project), notice: finished_notice
|
||||||
end
|
end
|
||||||
elsif @project.import_failed?
|
elsif @project.import_failed?
|
||||||
redirect_to new_namespace_project_import_path(@project.namespace, @project)
|
redirect_to new_namespace_project_import_path(@project.namespace, @project)
|
||||||
|
@ -36,6 +36,7 @@ class Projects::ImportsController < Projects::ApplicationController
|
||||||
if continue_params && continue_params[:notice_now]
|
if continue_params && continue_params[:notice_now]
|
||||||
flash.now[:notice] = continue_params[:notice_now]
|
flash.now[:notice] = continue_params[:notice_now]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render
|
# Render
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,6 +45,7 @@ class Projects::ImportsController < Projects::ApplicationController
|
||||||
|
|
||||||
def continue_params
|
def continue_params
|
||||||
continue_params = params[:continue]
|
continue_params = params[:continue]
|
||||||
|
|
||||||
if continue_params
|
if continue_params
|
||||||
continue_params.permit(:to, :notice, :notice_now)
|
continue_params.permit(:to, :notice, :notice_now)
|
||||||
else
|
else
|
||||||
|
@ -51,8 +53,16 @@ class Projects::ImportsController < Projects::ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def finished_notice
|
||||||
|
if @project.forked?
|
||||||
|
'The project was successfully forked.'
|
||||||
|
else
|
||||||
|
'The project was successfully imported.'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def require_no_repo
|
def require_no_repo
|
||||||
if @project.repository_exists? && !@project.import_in_progress?
|
if @project.repository_exists?
|
||||||
redirect_to(namespace_project_path(@project.namespace, @project))
|
redirect_to(namespace_project_path(@project.namespace, @project))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -183,8 +183,8 @@ class MergeRequest < ActiveRecord::Base
|
||||||
def diff_base_commit
|
def diff_base_commit
|
||||||
if merge_request_diff
|
if merge_request_diff
|
||||||
merge_request_diff.base_commit
|
merge_request_diff.base_commit
|
||||||
else
|
elsif source_sha
|
||||||
self.target_project.commit(self.target_branch)
|
self.target_project.merge_base_commit(self.source_sha, self.target_branch)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ class MergeRequest < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_sha
|
def source_sha
|
||||||
commits.first.sha
|
last_commit.try(:sha)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_ref
|
def fetch_ref
|
||||||
|
|
|
@ -48,14 +48,11 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def diffs_no_whitespace
|
def diffs_no_whitespace
|
||||||
# Get latest sha of branch from source project
|
|
||||||
source_sha = merge_request.source_project.commit(source_branch).sha
|
|
||||||
|
|
||||||
compare_result = Gitlab::CompareResult.new(
|
compare_result = Gitlab::CompareResult.new(
|
||||||
Gitlab::Git::Compare.new(
|
Gitlab::Git::Compare.new(
|
||||||
merge_request.target_project.repository.raw_repository,
|
self.repository.raw_repository,
|
||||||
merge_request.target_branch,
|
self.target_branch,
|
||||||
source_sha,
|
self.source_sha,
|
||||||
), { ignore_whitespace_change: true }
|
), { ignore_whitespace_change: true }
|
||||||
)
|
)
|
||||||
@diffs_no_whitespace ||= load_diffs(dump_commits(compare_result.diffs))
|
@diffs_no_whitespace ||= load_diffs(dump_commits(compare_result.diffs))
|
||||||
|
@ -83,8 +80,6 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
@last_commit_short_sha ||= last_commit.short_id
|
@last_commit_short_sha ||= last_commit.short_id
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def dump_commits(commits)
|
def dump_commits(commits)
|
||||||
commits.map(&:to_hash)
|
commits.map(&:to_hash)
|
||||||
end
|
end
|
||||||
|
@ -163,7 +158,7 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
|
|
||||||
self.st_diffs = new_diffs
|
self.st_diffs = new_diffs
|
||||||
|
|
||||||
self.base_commit_sha = merge_request.target_project.commit(target_branch).try(:sha)
|
self.base_commit_sha = self.repository.merge_base(self.source_sha, self.target_branch)
|
||||||
|
|
||||||
self.save
|
self.save
|
||||||
end
|
end
|
||||||
|
@ -181,7 +176,10 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
merge_request.target_project.repository
|
merge_request.target_project.repository
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
def source_sha
|
||||||
|
source_commit = merge_request.source_project.commit(source_branch)
|
||||||
|
source_commit.try(:sha)
|
||||||
|
end
|
||||||
|
|
||||||
def compare_result
|
def compare_result
|
||||||
@compare_result ||=
|
@compare_result ||=
|
||||||
|
@ -189,15 +187,11 @@ class MergeRequestDiff < ActiveRecord::Base
|
||||||
# Update ref for merge request
|
# Update ref for merge request
|
||||||
merge_request.fetch_ref
|
merge_request.fetch_ref
|
||||||
|
|
||||||
# Get latest sha of branch from source project
|
|
||||||
source_commit = merge_request.source_project.commit(source_branch)
|
|
||||||
source_sha = source_commit.try(:sha)
|
|
||||||
|
|
||||||
Gitlab::CompareResult.new(
|
Gitlab::CompareResult.new(
|
||||||
Gitlab::Git::Compare.new(
|
Gitlab::Git::Compare.new(
|
||||||
merge_request.target_project.repository.raw_repository,
|
self.repository.raw_repository,
|
||||||
merge_request.target_branch,
|
self.target_branch,
|
||||||
source_sha,
|
self.source_sha
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -344,6 +344,11 @@ class Project < ActiveRecord::Base
|
||||||
repository.commit(id)
|
repository.commit(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def merge_base_commit(first_commit_id, second_commit_id)
|
||||||
|
sha = repository.merge_base(first_commit_id, second_commit_id)
|
||||||
|
repository.commit(sha) if sha
|
||||||
|
end
|
||||||
|
|
||||||
def saved?
|
def saved?
|
||||||
id && persisted?
|
id && persisted?
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Repository
|
||||||
# This method return true if repository contains some content visible in project page.
|
# This method return true if repository contains some content visible in project page.
|
||||||
#
|
#
|
||||||
def has_visible_content?
|
def has_visible_content?
|
||||||
!raw_repository.branches.empty?
|
raw_repository.branch_count > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def commit(id = 'HEAD')
|
def commit(id = 'HEAD')
|
||||||
|
@ -589,6 +589,8 @@ class Repository
|
||||||
|
|
||||||
def merge_base(first_commit_id, second_commit_id)
|
def merge_base(first_commit_id, second_commit_id)
|
||||||
rugged.merge_base(first_commit_id, second_commit_id)
|
rugged.merge_base(first_commit_id, second_commit_id)
|
||||||
|
rescue Rugged::ReferenceError
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_ancestor?(ancestor_id, descendant_id)
|
def is_ancestor?(ancestor_id, descendant_id)
|
||||||
|
|
|
@ -12,15 +12,14 @@
|
||||||
%small= number_to_human_size @blob.size
|
%small= number_to_human_size @blob.size
|
||||||
.file-actions
|
.file-actions
|
||||||
= render "projects/blob/actions"
|
= render "projects/blob/actions"
|
||||||
.file-content.blame.highlight
|
.file-content.blame.code.js-syntax-highlight
|
||||||
%table
|
%table
|
||||||
- current_line = 1
|
- current_line = 1
|
||||||
- blame_highlighter = highlighter(@blob.name, @blob.data, nowrap: true)
|
- @blame_groups.each do |blame_group|
|
||||||
- @blame.each do |blame_group|
|
|
||||||
%tr
|
%tr
|
||||||
%td.blame-commit
|
%td.blame-commit
|
||||||
.commit
|
.commit
|
||||||
- commit = Commit.new(blame_group[:commit], @project)
|
- commit = blame_group[:commit]
|
||||||
.commit-row-title
|
.commit-row-title
|
||||||
%strong
|
%strong
|
||||||
= link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark"
|
= link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark"
|
||||||
|
@ -31,16 +30,14 @@
|
||||||
= commit_author_link(commit, avatar: false)
|
= commit_author_link(commit, avatar: false)
|
||||||
authored
|
authored
|
||||||
#{time_ago_with_tooltip(commit.committed_date, skip_js: true)}
|
#{time_ago_with_tooltip(commit.committed_date, skip_js: true)}
|
||||||
%td.lines.blame-numbers
|
%td.line-numbers
|
||||||
%pre
|
- line_count = blame_group[:lines].count
|
||||||
- line_count = blame_group[:lines].count
|
- (current_line...(current_line + line_count)).each do |i|
|
||||||
- (current_line...(current_line + line_count)).each do |i|
|
%a.diff-line-num= i
|
||||||
= i
|
\
|
||||||
\
|
- current_line += line_count
|
||||||
- current_line += line_count
|
|
||||||
%td.lines
|
%td.lines
|
||||||
%pre{class: 'code highlight white'}
|
%pre.code.highlight
|
||||||
%code
|
%code
|
||||||
- blame_group[:lines].each do |line|
|
- blame_group[:lines].each do |line|
|
||||||
:preserve
|
#{line}
|
||||||
#{blame_highlighter.highlight(line)}
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
.file-content.wiki
|
.file-content.wiki
|
||||||
= render_markup(blob.name, blob.data)
|
= render_markup(blob.name, blob.data)
|
||||||
- else
|
- else
|
||||||
.file-content.code
|
- unless blob.empty?
|
||||||
- unless blob.empty?
|
= render 'shared/file_highlight', blob: blob
|
||||||
= render 'shared/file_highlight', blob: blob
|
- else
|
||||||
- else
|
.file-content.code
|
||||||
.nothing-here-block Empty file
|
.nothing-here-block Empty file
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
%tr.line_holder
|
%tr.line_holder
|
||||||
%td.old_line.diff-line-num{data: {linenumber: line_old}}
|
%td.old_line.diff-line-num{data: {linenumber: line_old}}
|
||||||
= link_to raw(line_old), "#"
|
= link_to raw(line_old), "#"
|
||||||
%td.new_line= link_to raw(line_new) , "#"
|
%td.new_line.diff-line-num
|
||||||
|
= link_to raw(line_new) , "#"
|
||||||
%td.line_content.noteable_line==#{' ' * @form.indent}#{line}
|
%td.line_content.noteable_line==#{' ' * @form.indent}#{line}
|
||||||
|
|
||||||
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc
|
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc
|
||||||
|
|
|
@ -8,18 +8,18 @@
|
||||||
.file-content.wiki
|
.file-content.wiki
|
||||||
= raw render_markup(@blob.name, @content)
|
= raw render_markup(@blob.name, @content)
|
||||||
- else
|
- else
|
||||||
.file-content.code
|
.file-content.code.js-syntax-highlight
|
||||||
- unless @diff_lines.empty?
|
- unless @diff_lines.empty?
|
||||||
%table.text-file
|
%table.text-file
|
||||||
- @diff_lines.each do |line|
|
- @diff_lines.each do |line|
|
||||||
%tr.line_holder{ class: "#{line.type}" }
|
%tr.line_holder{ class: "#{line.type}" }
|
||||||
- if line.type == "match"
|
- if line.type == "match"
|
||||||
%td.old_line= "..."
|
%td.old_line.diff-line-num= "..."
|
||||||
%td.new_line= "..."
|
%td.new_line.diff-line-num= "..."
|
||||||
%td.line_content.matched= line.text
|
%td.line_content.match= line.text
|
||||||
- else
|
- else
|
||||||
%td.old_line
|
%td.old_line.diff-line-num
|
||||||
%td.new_line
|
%td.new_line.diff-line-num
|
||||||
%td.line_content{class: "#{line.type}"}= diff_line_content(line.text)
|
%td.line_content{class: "#{line.type}"}= diff_line_content(line.text)
|
||||||
- else
|
- else
|
||||||
.nothing-here-block No changes.
|
.nothing-here-block No changes.
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
|
|
||||||
%td
|
%td
|
||||||
.pull-right
|
.pull-right
|
||||||
- if current_user && can?(current_user, :read_build_artifacts, commit_status.project) && commit_status.artifacts?
|
- if current_user && can?(current_user, :read_build_artifacts, commit_status.project) && commit_status.artifacts_download_url
|
||||||
= link_to commit_status.artifacts_download_url, title: 'Download artifacts' do
|
= link_to commit_status.artifacts_download_url, title: 'Download artifacts' do
|
||||||
%i.fa.fa-download
|
%i.fa.fa-download
|
||||||
- if current_user && can?(current_user, :manage_builds, commit_status.project)
|
- if current_user && can?(current_user, :manage_builds, commit_status.project)
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
%td.new_line.diff-line-num{data: {linenumber: line_new},
|
%td.new_line.diff-line-num{data: {linenumber: line_new},
|
||||||
class: [unfold_bottom_class(bottom), unfold_class(!new_file)]}
|
class: [unfold_bottom_class(bottom), unfold_class(!new_file)]}
|
||||||
\...
|
\...
|
||||||
%td.line_content.matched= line
|
%td.line_content.match= line
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
%td.old_line
|
%td.old_line.diff-line-num
|
||||||
%td.line_content.parallel.matched= line
|
%td.line_content.parallel.match= line
|
||||||
%td.new_line
|
%td.new_line.diff-line-num
|
||||||
%td.line_content.parallel.matched= line
|
%td.line_content.parallel.match= line
|
||||||
|
|
|
@ -9,16 +9,16 @@
|
||||||
= render "projects/diffs/match_line_parallel", { line: left[:text],
|
= render "projects/diffs/match_line_parallel", { line: left[:text],
|
||||||
line_old: left[:number], line_new: right[:number] }
|
line_old: left[:number], line_new: right[:number] }
|
||||||
- elsif left[:type] == 'nonewline'
|
- elsif left[:type] == 'nonewline'
|
||||||
%td.old_line
|
%td.old_line.diff-line-num
|
||||||
%td.line_content.parallel.matched= left[:text]
|
%td.line_content.parallel.match= left[:text]
|
||||||
%td.new_line
|
%td.new_line.diff-line-num
|
||||||
%td.line_content.parallel.matched= left[:text]
|
%td.line_content.parallel.match= left[:text]
|
||||||
- else
|
- else
|
||||||
%td.old_line{id: left[:line_code], class: "#{left[:type]}"}
|
%td.old_line.diff-line-num{id: left[:line_code], class: "#{left[:type]}"}
|
||||||
= link_to raw(left[:number]), "##{left[:line_code]}", id: left[:line_code]
|
= link_to raw(left[:number]), "##{left[:line_code]}", id: left[:line_code]
|
||||||
- if @comments_allowed && can?(current_user, :create_note, @project)
|
- if @comments_allowed && can?(current_user, :create_note, @project)
|
||||||
= link_to_new_diff_note(left[:line_code], 'old')
|
= link_to_new_diff_note(left[:line_code], 'old')
|
||||||
%td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text])
|
%td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text])
|
||||||
|
|
||||||
- if right[:type] == 'new'
|
- if right[:type] == 'new'
|
||||||
- new_line_class = 'new'
|
- new_line_class = 'new'
|
||||||
|
@ -27,11 +27,11 @@
|
||||||
- new_line_class = nil
|
- new_line_class = nil
|
||||||
- new_line_code = left[:line_code]
|
- new_line_code = left[:line_code]
|
||||||
|
|
||||||
%td.new_line{id: new_line_code, class: "#{new_line_class}", data: { linenumber: right[:number] }}
|
%td.new_line.diff-line-num{id: new_line_code, class: "#{new_line_class}", data: { linenumber: right[:number] }}
|
||||||
= link_to raw(right[:number]), "##{new_line_code}", id: new_line_code
|
= link_to raw(right[:number]), "##{new_line_code}", id: new_line_code
|
||||||
- if @comments_allowed && can?(current_user, :create_note, @project)
|
- if @comments_allowed && can?(current_user, :create_note, @project)
|
||||||
= link_to_new_diff_note(right[:line_code], 'new')
|
= link_to_new_diff_note(right[:line_code], 'new')
|
||||||
%td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", data: { line_code: new_line_code }}= diff_line_content(right[:text])
|
%td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", data: { line_code: new_line_code }}= diff_line_content(right[:text])
|
||||||
|
|
||||||
- if @reply_allowed
|
- if @reply_allowed
|
||||||
- comments_left, comments_right = organize_comments(left[:type], right[:type], left[:line_code], right[:line_code])
|
- comments_left, comments_right = organize_comments(left[:type], right[:type], left[:line_code], right[:line_code])
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
- elsif type == 'nonewline'
|
- elsif type == 'nonewline'
|
||||||
%td.old_line.diff-line-num
|
%td.old_line.diff-line-num
|
||||||
%td.new_line.diff-line-num
|
%td.new_line.diff-line-num
|
||||||
%td.line_content.matched= line.text
|
%td.line_content.match= line.text
|
||||||
- else
|
- else
|
||||||
%td.old_line
|
%td.old_line.diff-line-num{class: type}
|
||||||
= link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code
|
= link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code
|
||||||
- if @comments_allowed && can?(current_user, :create_note, @project)
|
- if @comments_allowed && can?(current_user, :create_note, @project)
|
||||||
= link_to_new_diff_note(line_code)
|
= link_to_new_diff_note(line_code)
|
||||||
%td.new_line{data: {linenumber: line.new_pos}}
|
%td.new_line.diff-line-num{class: type, data: {linenumber: line.new_pos}}
|
||||||
= link_to raw(type == "old" ? " " : line.new_pos), "##{line_code}", id: line_code
|
= link_to raw(type == "old" ? " " : line.new_pos), "##{line_code}", id: line_code
|
||||||
%td.line_content{class: "noteable_line #{type} #{line_code}", data: { line_code: line_code }}= diff_line_content(line.text)
|
%td.line_content{class: "noteable_line #{type} #{line_code}", data: { line_code: line_code }}= diff_line_content(line.text)
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,20 @@
|
||||||
= diff.new_path
|
= diff.new_path
|
||||||
- if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
|
- if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
|
||||||
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
|
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
|
||||||
.diff-content
|
.diff-content.code.js-syntax-highlight
|
||||||
%table
|
%table
|
||||||
- note.truncated_diff_lines.each do |line|
|
- note.truncated_diff_lines.each do |line|
|
||||||
- type = line.type
|
- type = line.type
|
||||||
- line_code = generate_line_code(note.file_path, line)
|
- line_code = generate_line_code(note.file_path, line)
|
||||||
%tr.line_holder{ id: line_code, class: "#{type}" }
|
%tr.line_holder{ id: line_code, class: "#{type}" }
|
||||||
- if type == "match"
|
- if type == "match"
|
||||||
%td.old_line= "..."
|
%td.old_line.diff-line-num= "..."
|
||||||
%td.new_line= "..."
|
%td.new_line.diff-line-num= "..."
|
||||||
%td.line_content.matched= line.text
|
%td.line_content.match= line.text
|
||||||
- else
|
- else
|
||||||
%td.old_line
|
%td.old_line.diff-line-num
|
||||||
= raw(type == "new" ? " " : line.old_pos)
|
= raw(type == "new" ? " " : line.old_pos)
|
||||||
%td.new_line
|
%td.new_line.diff-line-num
|
||||||
= raw(type == "old" ? " " : line.new_pos)
|
= raw(type == "old" ? " " : line.new_pos)
|
||||||
%td.line_content{class: "noteable_line #{type} #{line_code}", line_code: line_code}= diff_line_content(line.text)
|
%td.line_content{class: "noteable_line #{type} #{line_code}", line_code: line_code}= diff_line_content(line.text)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
- if merge_request.description.present?
|
- if merge_request.description.present?
|
||||||
.description.term
|
.description.term
|
||||||
= preserve do
|
= preserve do
|
||||||
= search_md_sanitize(markdown(merge_request.description))
|
= search_md_sanitize(markdown(merge_request.description, { project: merge_request.project }))
|
||||||
%span.light
|
%span.light
|
||||||
#{merge_request.project.name_with_namespace}
|
#{merge_request.project.name_with_namespace}
|
||||||
.pull-right
|
.pull-right
|
||||||
|
|
|
@ -22,29 +22,27 @@
|
||||||
.file-content.code
|
.file-content.code
|
||||||
.nothing-here-block Empty file
|
.nothing-here-block Empty file
|
||||||
- else
|
- else
|
||||||
.file-content.code
|
.file-content.code.js-syntax-highlight
|
||||||
%div.highlighted-data{ class: user_color_scheme }
|
.line-numbers
|
||||||
.line-numbers
|
- snippet_blob[:snippet_chunks].each do |snippet|
|
||||||
|
- unless snippet[:data].empty?
|
||||||
|
- snippet[:data].lines.to_a.size.times do |index|
|
||||||
|
- offset = defined?(snippet[:start_line]) ? snippet[:start_line] : 1
|
||||||
|
- i = index + offset
|
||||||
|
= link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}", class: "diff-line-num" do
|
||||||
|
%i.fa.fa-link
|
||||||
|
= i
|
||||||
|
- unless snippet == snippet_blob[:snippet_chunks].last
|
||||||
|
%a.diff-line-num
|
||||||
|
= "."
|
||||||
|
%pre.code
|
||||||
|
%code
|
||||||
- snippet_blob[:snippet_chunks].each do |snippet|
|
- snippet_blob[:snippet_chunks].each do |snippet|
|
||||||
- unless snippet[:data].empty?
|
- unless snippet[:data].empty?
|
||||||
- snippet[:data].lines.to_a.size.times do |index|
|
= snippet[:data]
|
||||||
- offset = defined?(snippet[:start_line]) ? snippet[:start_line] : 1
|
|
||||||
- i = index + offset
|
|
||||||
= link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}" do
|
|
||||||
%i.fa.fa-link
|
|
||||||
= i
|
|
||||||
- unless snippet == snippet_blob[:snippet_chunks].last
|
- unless snippet == snippet_blob[:snippet_chunks].last
|
||||||
%a
|
%a
|
||||||
= "."
|
= "..."
|
||||||
.highlight.term
|
- else
|
||||||
%pre
|
.file-content.code
|
||||||
%code
|
.nothing-here-block Empty file
|
||||||
- snippet_blob[:snippet_chunks].each do |snippet|
|
|
||||||
- unless snippet[:data].empty?
|
|
||||||
= snippet[:data]
|
|
||||||
- unless snippet == snippet_blob[:snippet_chunks].last
|
|
||||||
%a
|
|
||||||
= "..."
|
|
||||||
- else
|
|
||||||
.file-content.code
|
|
||||||
.nothing-here-block Empty file
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
.file-content.code.js-syntax-highlight{ class: user_color_scheme }
|
.file-content.code.js-syntax-highlight
|
||||||
.line-numbers
|
.line-numbers
|
||||||
- if blob.data.present?
|
- if blob.data.present?
|
||||||
- blob.data.lines.each_index do |index|
|
- blob.data.lines.each_index do |index|
|
||||||
- offset = defined?(first_line_number) ? first_line_number : 1
|
- offset = defined?(first_line_number) ? first_line_number : 1
|
||||||
- i = index + offset
|
- i = index + offset
|
||||||
-# We're not using `link_to` because it is too slow once we get to thousands of lines.
|
-# We're not using `link_to` because it is too slow once we get to thousands of lines.
|
||||||
%a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i}
|
%a.diff-line-num{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i}
|
||||||
%i.fa.fa-link
|
%i.fa.fa-link
|
||||||
= i
|
= i
|
||||||
.blob-content{data: {blob_id: blob.id}}
|
.blob-content{data: {blob_id: blob.id}}
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
.file-content.wiki
|
.file-content.wiki
|
||||||
= render_markup(@snippet.file_name, @snippet.data)
|
= render_markup(@snippet.file_name, @snippet.data)
|
||||||
- else
|
- else
|
||||||
.file-content.code
|
= render 'shared/file_highlight', blob: @snippet
|
||||||
= render 'shared/file_highlight', blob: @snippet
|
|
||||||
- else
|
- else
|
||||||
.file-content.code
|
.file-content.code
|
||||||
.nothing-here-block Empty file
|
.nothing-here-block Empty file
|
||||||
|
|
|
@ -53,7 +53,26 @@ if Gitlab::Metrics.enabled?
|
||||||
Gitlab::Git.constants.each do |name|
|
Gitlab::Git.constants.each do |name|
|
||||||
const = Gitlab::Git.const_get(name)
|
const = Gitlab::Git.const_get(name)
|
||||||
|
|
||||||
config.instrument_methods(const) if const.is_a?(Module)
|
next unless const.is_a?(Module)
|
||||||
|
|
||||||
|
config.instrument_methods(const)
|
||||||
|
config.instrument_instance_methods(const)
|
||||||
|
end
|
||||||
|
|
||||||
|
Dir[Rails.root.join('app', 'finders', '*.rb')].each do |path|
|
||||||
|
const = File.basename(path, '.rb').camelize.constantize
|
||||||
|
|
||||||
|
config.instrument_instance_methods(const)
|
||||||
|
end
|
||||||
|
|
||||||
|
[
|
||||||
|
:Blame, :Branch, :BranchCollection, :Blob, :Commit, :Diff, :Repository,
|
||||||
|
:Tag, :TagCollection, :Tree
|
||||||
|
].each do |name|
|
||||||
|
const = Rugged.const_get(name)
|
||||||
|
|
||||||
|
config.instrument_methods(const)
|
||||||
|
config.instrument_instance_methods(const)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ChangeLfsObjectsSizeColumn < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column :lfs_objects, :size, :integer, limit: 8
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160120172143) do
|
ActiveRecord::Schema.define(version: 20160128233227) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -447,8 +447,8 @@ ActiveRecord::Schema.define(version: 20160120172143) do
|
||||||
add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree
|
add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree
|
||||||
|
|
||||||
create_table "lfs_objects", force: :cascade do |t|
|
create_table "lfs_objects", force: :cascade do |t|
|
||||||
t.string "oid", null: false
|
t.string "oid", null: false
|
||||||
t.integer "size", null: false
|
t.integer "size", limit: 8, null: false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.string "file"
|
t.string "file"
|
||||||
|
|
|
@ -348,7 +348,7 @@ GitLab Shell is an SSH access and repository management software developed speci
|
||||||
cd /home/git
|
cd /home/git
|
||||||
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
|
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
|
||||||
cd gitlab-workhorse
|
cd gitlab-workhorse
|
||||||
sudo -u git -H git checkout 0.5.4
|
sudo -u git -H git checkout 0.6.2
|
||||||
sudo -u git -H make
|
sudo -u git -H make
|
||||||
|
|
||||||
### Initialize Database and Activate Advanced Features
|
### Initialize Database and Activate Advanced Features
|
||||||
|
|
|
@ -37,7 +37,7 @@ sudo -u git -H git checkout 8-4-stable-ee
|
||||||
```bash
|
```bash
|
||||||
cd /home/git/gitlab-shell
|
cd /home/git/gitlab-shell
|
||||||
sudo -u git -H git fetch --all
|
sudo -u git -H git fetch --all
|
||||||
sudo -u git -H git checkout v2.6.9
|
sudo -u git -H git checkout v2.6.10
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Update gitlab-workhorse
|
### 5. Update gitlab-workhorse
|
||||||
|
@ -48,7 +48,7 @@ which should already be on your system from GitLab 8.1.
|
||||||
```bash
|
```bash
|
||||||
cd /home/git/gitlab-workhorse
|
cd /home/git/gitlab-workhorse
|
||||||
sudo -u git -H git fetch --all
|
sudo -u git -H git fetch --all
|
||||||
sudo -u git -H git checkout 0.6.1
|
sudo -u git -H git checkout 0.6.2
|
||||||
sudo -u git -H make
|
sudo -u git -H make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -153,10 +153,11 @@ module API
|
||||||
end
|
end
|
||||||
|
|
||||||
def attributes_for_keys(keys, custom_params = nil)
|
def attributes_for_keys(keys, custom_params = nil)
|
||||||
|
params_hash = custom_params || params
|
||||||
attrs = {}
|
attrs = {}
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
if params[key].present? or (params.has_key?(key) and params[key] == false)
|
if params_hash[key].present? or (params_hash.has_key?(key) and params_hash[key] == false)
|
||||||
attrs[key] = params[key]
|
attrs[key] = params_hash[key]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ActionController::Parameters.new(attrs).permit!
|
ActionController::Parameters.new(attrs).permit!
|
||||||
|
|
|
@ -13,13 +13,13 @@ module Ci
|
||||||
post "register" do
|
post "register" do
|
||||||
authenticate_runner!
|
authenticate_runner!
|
||||||
update_runner_last_contact
|
update_runner_last_contact
|
||||||
|
update_runner_info
|
||||||
required_attributes! [:token]
|
required_attributes! [:token]
|
||||||
not_found! unless current_runner.active?
|
not_found! unless current_runner.active?
|
||||||
|
|
||||||
build = Ci::RegisterBuildService.new.execute(current_runner)
|
build = Ci::RegisterBuildService.new.execute(current_runner)
|
||||||
|
|
||||||
if build
|
if build
|
||||||
update_runner_info
|
|
||||||
present build, with: Entities::BuildDetails
|
present build, with: Entities::BuildDetails
|
||||||
else
|
else
|
||||||
not_found!
|
not_found!
|
||||||
|
|
|
@ -34,10 +34,14 @@ module Ci
|
||||||
@runner ||= Runner.find_by_token(params[:token].to_s)
|
@runner ||= Runner.find_by_token(params[:token].to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_runner_info
|
def get_runner_version_from_params
|
||||||
return unless params["info"].present?
|
return unless params["info"].present?
|
||||||
info = attributes_for_keys(["name", "version", "revision", "platform", "architecture"], params["info"])
|
attributes_for_keys(["name", "version", "revision", "platform", "architecture"], params["info"])
|
||||||
current_runner.update(info)
|
end
|
||||||
|
|
||||||
|
def update_runner_info
|
||||||
|
current_runner.assign_attributes(get_runner_version_from_params)
|
||||||
|
current_runner.save if current_runner.changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_artifacts_size
|
def max_artifacts_size
|
||||||
|
|
|
@ -47,6 +47,7 @@ module Ci
|
||||||
return forbidden! unless runner
|
return forbidden! unless runner
|
||||||
|
|
||||||
if runner.id
|
if runner.id
|
||||||
|
runner.update(get_runner_version_from_params)
|
||||||
present runner, with: Entities::Runner
|
present runner, with: Entities::Runner
|
||||||
else
|
else
|
||||||
not_found!
|
not_found!
|
||||||
|
|
54
lib/gitlab/blame.rb
Normal file
54
lib/gitlab/blame.rb
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
module Gitlab
|
||||||
|
class Blame
|
||||||
|
attr_accessor :blob, :commit
|
||||||
|
|
||||||
|
def initialize(blob, commit)
|
||||||
|
@blob = blob
|
||||||
|
@commit = commit
|
||||||
|
end
|
||||||
|
|
||||||
|
def groups(highlight: true)
|
||||||
|
prev_sha = nil
|
||||||
|
groups = []
|
||||||
|
current_group = nil
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
blame.each do |commit, line|
|
||||||
|
commit = Commit.new(commit, project)
|
||||||
|
|
||||||
|
sha = commit.sha
|
||||||
|
if prev_sha != sha
|
||||||
|
groups << current_group if current_group
|
||||||
|
current_group = { commit: commit, lines: [] }
|
||||||
|
end
|
||||||
|
|
||||||
|
line = highlighted_lines[i].html_safe if highlight
|
||||||
|
current_group[:lines] << line
|
||||||
|
|
||||||
|
prev_sha = sha
|
||||||
|
i += 1
|
||||||
|
end
|
||||||
|
groups << current_group if current_group
|
||||||
|
|
||||||
|
groups
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def blame
|
||||||
|
@blame ||= Gitlab::Git::Blame.new(repository, @commit.id, @blob.path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def highlighted_lines
|
||||||
|
@highlighted_lines ||= Gitlab::Highlight.highlight(@blob.name, @blob.data).lines
|
||||||
|
end
|
||||||
|
|
||||||
|
def project
|
||||||
|
commit.project
|
||||||
|
end
|
||||||
|
|
||||||
|
def repository
|
||||||
|
project.repository
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -106,20 +106,36 @@ module Gitlab
|
||||||
if type == :instance
|
if type == :instance
|
||||||
target = mod
|
target = mod
|
||||||
label = "#{mod.name}##{name}"
|
label = "#{mod.name}##{name}"
|
||||||
|
method = mod.instance_method(name)
|
||||||
else
|
else
|
||||||
target = mod.singleton_class
|
target = mod.singleton_class
|
||||||
label = "#{mod.name}.#{name}"
|
label = "#{mod.name}.#{name}"
|
||||||
|
method = mod.method(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Some code out there (e.g. the "state_machine" Gem) checks the arity of
|
||||||
|
# a method to make sure it only passes arguments when the method expects
|
||||||
|
# any. If we were to always overwrite a method to take an `*args`
|
||||||
|
# signature this would break things. As a result we'll make sure the
|
||||||
|
# generated method _only_ accepts regular arguments if the underlying
|
||||||
|
# method also accepts them.
|
||||||
|
if method.arity == 0
|
||||||
|
args_signature = '&block'
|
||||||
|
else
|
||||||
|
args_signature = '*args, &block'
|
||||||
|
end
|
||||||
|
|
||||||
|
send_signature = "__send__(#{alias_name.inspect}, #{args_signature})"
|
||||||
|
|
||||||
target.class_eval <<-EOF, __FILE__, __LINE__ + 1
|
target.class_eval <<-EOF, __FILE__, __LINE__ + 1
|
||||||
alias_method #{alias_name.inspect}, #{name.inspect}
|
alias_method #{alias_name.inspect}, #{name.inspect}
|
||||||
|
|
||||||
def #{name}(*args, &block)
|
def #{name}(#{args_signature})
|
||||||
trans = Gitlab::Metrics::Instrumentation.transaction
|
trans = Gitlab::Metrics::Instrumentation.transaction
|
||||||
|
|
||||||
if trans
|
if trans
|
||||||
start = Time.now
|
start = Time.now
|
||||||
retval = __send__(#{alias_name.inspect}, *args, &block)
|
retval = #{send_signature}
|
||||||
duration = (Time.now - start) * 1000.0
|
duration = (Time.now - start) * 1000.0
|
||||||
|
|
||||||
if duration >= Gitlab::Metrics.method_call_threshold
|
if duration >= Gitlab::Metrics.method_call_threshold
|
||||||
|
@ -132,7 +148,7 @@ module Gitlab
|
||||||
|
|
||||||
retval
|
retval
|
||||||
else
|
else
|
||||||
__send__(#{alias_name.inspect}, *args, &block)
|
#{send_signature}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -24,20 +24,6 @@ describe Projects::BlameController do
|
||||||
context "valid file" do
|
context "valid file" do
|
||||||
let(:id) { 'master/files/ruby/popen.rb' }
|
let(:id) { 'master/files/ruby/popen.rb' }
|
||||||
it { is_expected.to respond_with(:success) }
|
it { is_expected.to respond_with(:success) }
|
||||||
|
|
||||||
it 'groups blames properly' do
|
|
||||||
blame = assigns(:blame)
|
|
||||||
# Sanity check a few items
|
|
||||||
expect(blame.count).to eq(18)
|
|
||||||
expect(blame[0][:commit].sha).to eq('913c66a37b4a45b9769037c55c2d238bd0942d2e')
|
|
||||||
expect(blame[0][:lines]).to eq(["require 'fileutils'", "require 'open3'", ""])
|
|
||||||
|
|
||||||
expect(blame[1][:commit].sha).to eq('874797c3a73b60d2187ed6e2fcabd289ff75171e')
|
|
||||||
expect(blame[1][:lines]).to eq(["module Popen", " extend self"])
|
|
||||||
|
|
||||||
expect(blame[-1][:commit].sha).to eq('913c66a37b4a45b9769037c55c2d238bd0942d2e')
|
|
||||||
expect(blame[-1][:lines]).to eq([" end", "end"])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
109
spec/controllers/projects/imports_controller_spec.rb
Normal file
109
spec/controllers/projects/imports_controller_spec.rb
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Projects::ImportsController do
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
|
describe 'GET #show' do
|
||||||
|
context 'when repository does not exists' do
|
||||||
|
let(:project) { create(:empty_project) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in(user)
|
||||||
|
project.team << [user, :master]
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders template' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param
|
||||||
|
|
||||||
|
expect(response).to render_template :show
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets flash.now if params is present' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { notice_now: 'Started' }
|
||||||
|
|
||||||
|
expect(flash.now[:notice]).to eq 'Started'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when repository exists' do
|
||||||
|
let(:project) { create(:project_empty_repo, import_url: 'https://github.com/vim/vim.git') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in(user)
|
||||||
|
project.team << [user, :master]
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when import is in progress' do
|
||||||
|
before do
|
||||||
|
project.update_attribute(:import_status, :started)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders template' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param
|
||||||
|
|
||||||
|
expect(response).to render_template :show
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets flash.now if params is present' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { notice_now: 'In progress' }
|
||||||
|
|
||||||
|
expect(flash.now[:notice]).to eq 'In progress'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when import failed' do
|
||||||
|
before do
|
||||||
|
project.update_attribute(:import_status, :failed)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to new_namespace_project_import_path' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param
|
||||||
|
|
||||||
|
expect(response).to redirect_to new_namespace_project_import_path(project.namespace, project)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when import finished' do
|
||||||
|
before do
|
||||||
|
project.update_attribute(:import_status, :finished)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when project is a fork' do
|
||||||
|
it 'redirects to namespace_project_path' do
|
||||||
|
allow_any_instance_of(Project).to receive(:forked?).and_return(true)
|
||||||
|
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param
|
||||||
|
|
||||||
|
expect(flash[:notice]).to eq 'The project was successfully forked.'
|
||||||
|
expect(response).to redirect_to namespace_project_path(project.namespace, project)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when project is external' do
|
||||||
|
it 'redirects to namespace_project_path' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param
|
||||||
|
|
||||||
|
expect(flash[:notice]).to eq 'The project was successfully imported.'
|
||||||
|
expect(response).to redirect_to namespace_project_path(project.namespace, project)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when continue params is present' do
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
to: namespace_project_path(project.namespace, project),
|
||||||
|
notice: 'Finished'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to params[:to]' do
|
||||||
|
get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: params
|
||||||
|
|
||||||
|
expect(flash[:notice]).to eq params[:notice]
|
||||||
|
expect(response).to redirect_to params[:to]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,11 +1,15 @@
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :commit_status, class: CommitStatus do
|
factory :commit_status, class: CommitStatus do
|
||||||
started_at 'Di 29. Okt 09:51:28 CET 2013'
|
|
||||||
finished_at 'Di 29. Okt 09:53:28 CET 2013'
|
|
||||||
name 'default'
|
name 'default'
|
||||||
status 'success'
|
status 'success'
|
||||||
description 'commit status'
|
description 'commit status'
|
||||||
commit factory: :ci_commit_with_one_job
|
commit factory: :ci_commit_with_one_job
|
||||||
|
started_at 'Tue, 26 Jan 2016 08:21:42 +0100'
|
||||||
|
finished_at 'Tue, 26 Jan 2016 08:23:42 +0100'
|
||||||
|
|
||||||
|
after(:build) do |build, evaluator|
|
||||||
|
build.project = build.commit.project
|
||||||
|
end
|
||||||
|
|
||||||
factory :generic_commit_status, class: GenericCommitStatus do
|
factory :generic_commit_status, class: GenericCommitStatus do
|
||||||
name 'generic'
|
name 'generic'
|
||||||
|
|
|
@ -16,83 +16,104 @@ describe 'Commits' do
|
||||||
FactoryGirl.create :ci_commit, project: project, sha: project.commit.sha
|
FactoryGirl.create :ci_commit, project: project, sha: project.commit.sha
|
||||||
end
|
end
|
||||||
|
|
||||||
let!(:build) { FactoryGirl.create :ci_build, commit: commit }
|
context 'commit status is Generic Commit Status' do
|
||||||
|
let!(:status) { FactoryGirl.create :generic_commit_status, commit: commit }
|
||||||
|
|
||||||
describe 'Project commits' do
|
describe 'Commit builds' do
|
||||||
before do
|
|
||||||
visit namespace_project_commits_path(project.namespace, project, :master)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should show build status' do
|
|
||||||
page.within("//li[@id='commit-#{commit.short_sha}']") do
|
|
||||||
expect(page).to have_css(".ci-status-link")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'Commit builds' do
|
|
||||||
before do
|
|
||||||
visit ci_status_path(commit)
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(page).to have_content commit.sha[0..7] }
|
|
||||||
it { expect(page).to have_content commit.git_commit_message }
|
|
||||||
it { expect(page).to have_content commit.git_author_name }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'Download artifacts' do
|
|
||||||
let(:artifacts_file) { fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') }
|
|
||||||
|
|
||||||
before do
|
|
||||||
build.update_attributes(artifacts_file: artifacts_file)
|
|
||||||
end
|
|
||||||
|
|
||||||
it do
|
|
||||||
visit ci_status_path(commit)
|
|
||||||
click_on 'Download artifacts'
|
|
||||||
expect(page.response_headers['Content-Type']).to eq(artifacts_file.content_type)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'Cancel all builds' do
|
|
||||||
it 'cancels commit' do
|
|
||||||
visit ci_status_path(commit)
|
|
||||||
click_on 'Cancel running'
|
|
||||||
expect(page).to have_content 'canceled'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'Cancel build' do
|
|
||||||
it 'cancels build' do
|
|
||||||
visit ci_status_path(commit)
|
|
||||||
click_on 'Cancel'
|
|
||||||
expect(page).to have_content 'canceled'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '.gitlab-ci.yml not found warning' do
|
|
||||||
context 'ci builds enabled' do
|
|
||||||
it "does not show warning" do
|
|
||||||
visit ci_status_path(commit)
|
|
||||||
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'shows warning' do
|
|
||||||
stub_ci_commit_yaml_file(nil)
|
|
||||||
visit ci_status_path(commit)
|
|
||||||
expect(page).to have_content '.gitlab-ci.yml not found in this commit'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'ci builds disabled' do
|
|
||||||
before do
|
before do
|
||||||
stub_ci_builds_disabled
|
|
||||||
stub_ci_commit_yaml_file(nil)
|
|
||||||
visit ci_status_path(commit)
|
visit ci_status_path(commit)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not show warning' do
|
it { expect(page).to have_content commit.sha[0..7] }
|
||||||
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
|
|
||||||
|
it 'contains generic commit status build' do
|
||||||
|
page.within('.table-holder') do
|
||||||
|
expect(page).to have_content "##{status.id}" # build id
|
||||||
|
expect(page).to have_content 'generic' # build name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'commit status is Ci Build' do
|
||||||
|
let!(:build) { FactoryGirl.create :ci_build, commit: commit }
|
||||||
|
|
||||||
|
describe 'Project commits' do
|
||||||
|
before do
|
||||||
|
visit namespace_project_commits_path(project.namespace, project, :master)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should show build status' do
|
||||||
|
page.within("//li[@id='commit-#{commit.short_sha}']") do
|
||||||
|
expect(page).to have_css(".ci-status-link")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Commit builds' do
|
||||||
|
before do
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(page).to have_content commit.sha[0..7] }
|
||||||
|
it { expect(page).to have_content commit.git_commit_message }
|
||||||
|
it { expect(page).to have_content commit.git_author_name }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'Download artifacts' do
|
||||||
|
let(:artifacts_file) { fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') }
|
||||||
|
|
||||||
|
before do
|
||||||
|
build.update_attributes(artifacts_file: artifacts_file)
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
click_on 'Download artifacts'
|
||||||
|
expect(page.response_headers['Content-Type']).to eq(artifacts_file.content_type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Cancel all builds' do
|
||||||
|
it 'cancels commit' do
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
click_on 'Cancel running'
|
||||||
|
expect(page).to have_content 'canceled'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Cancel build' do
|
||||||
|
it 'cancels build' do
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
click_on 'Cancel'
|
||||||
|
expect(page).to have_content 'canceled'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '.gitlab-ci.yml not found warning' do
|
||||||
|
context 'ci builds enabled' do
|
||||||
|
it "does not show warning" do
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows warning' do
|
||||||
|
stub_ci_commit_yaml_file(nil)
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
expect(page).to have_content '.gitlab-ci.yml not found in this commit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'ci builds disabled' do
|
||||||
|
before do
|
||||||
|
stub_ci_builds_disabled
|
||||||
|
stub_ci_commit_yaml_file(nil)
|
||||||
|
visit ci_status_path(commit)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not show warning' do
|
||||||
|
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
11
spec/javascripts/behaviors/autosize_spec.js.coffee
Normal file
11
spec/javascripts/behaviors/autosize_spec.js.coffee
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#= require behaviors/autosize
|
||||||
|
|
||||||
|
describe 'Autosize behavior', ->
|
||||||
|
beforeEach ->
|
||||||
|
fixture.set('<textarea class="js-autosize" style="resize: vertical"></textarea>')
|
||||||
|
|
||||||
|
it 'does not overwrite the resize property', ->
|
||||||
|
load()
|
||||||
|
expect($('textarea')).toHaveCss(resize: 'vertical')
|
||||||
|
|
||||||
|
load = -> $(document).trigger('page:load')
|
24
spec/lib/gitlab/blame_spec.rb
Normal file
24
spec/lib/gitlab/blame_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Gitlab::Blame, lib: true do
|
||||||
|
let(:project) { create(:project) }
|
||||||
|
let(:path) { 'files/ruby/popen.rb' }
|
||||||
|
let(:commit) { project.commit('master') }
|
||||||
|
let(:blob) { project.repository.blob_at(commit.id, path) }
|
||||||
|
|
||||||
|
describe "#groups" do
|
||||||
|
let(:subject) { described_class.new(blob, commit).groups(highlight: false) }
|
||||||
|
|
||||||
|
it 'groups lines properly' do
|
||||||
|
expect(subject.count).to eq(18)
|
||||||
|
expect(subject[0][:commit].sha).to eq('913c66a37b4a45b9769037c55c2d238bd0942d2e')
|
||||||
|
expect(subject[0][:lines]).to eq(["require 'fileutils'", "require 'open3'", ""])
|
||||||
|
|
||||||
|
expect(subject[1][:commit].sha).to eq('874797c3a73b60d2187ed6e2fcabd289ff75171e')
|
||||||
|
expect(subject[1][:lines]).to eq(["module Popen", " extend self"])
|
||||||
|
|
||||||
|
expect(subject[-1][:commit].sha).to eq('913c66a37b4a45b9769037c55c2d238bd0942d2e')
|
||||||
|
expect(subject[-1][:lines]).to eq([" end", "end"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -66,6 +66,16 @@ describe Gitlab::Metrics::Instrumentation do
|
||||||
|
|
||||||
@dummy.foo
|
@dummy.foo
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'generates a method with the correct arity when using methods without arguments' do
|
||||||
|
dummy = Class.new do
|
||||||
|
def self.test; end
|
||||||
|
end
|
||||||
|
|
||||||
|
described_class.instrument_method(dummy, :test)
|
||||||
|
|
||||||
|
expect(dummy.method(:test).arity).to eq(0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with metrics disabled' do
|
describe 'with metrics disabled' do
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Ci::Build, models: true do
|
describe Ci::Build, models: true do
|
||||||
let(:project) { FactoryGirl.create :empty_project }
|
let(:project) { FactoryGirl.create :project }
|
||||||
let(:commit) { FactoryGirl.create :ci_commit, project: project }
|
let(:commit) { FactoryGirl.create :ci_commit, project: project }
|
||||||
let(:build) { FactoryGirl.create :ci_build, commit: commit }
|
let(:build) { FactoryGirl.create :ci_build, commit: commit }
|
||||||
|
|
||||||
|
|
|
@ -219,4 +219,24 @@ describe Repository, models: true do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#has_visible_content?' do
|
||||||
|
subject { repository.has_visible_content? }
|
||||||
|
|
||||||
|
describe 'when there are no branches' do
|
||||||
|
before do
|
||||||
|
allow(repository.raw_repository).to receive(:branch_count).and_return(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to eq(false) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when there are branches' do
|
||||||
|
before do
|
||||||
|
allow(repository.raw_repository).to receive(:branch_count).and_return(3)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to eq(true) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -113,6 +113,21 @@ describe Ci::API::API do
|
||||||
expect(json_response["depends_on_builds"].count).to eq(2)
|
expect(json_response["depends_on_builds"].count).to eq(2)
|
||||||
expect(json_response["depends_on_builds"][0]["name"]).to eq("rspec")
|
expect(json_response["depends_on_builds"][0]["name"]).to eq("rspec")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
%w(name version revision platform architecture).each do |param|
|
||||||
|
context "updates runner #{param}" do
|
||||||
|
let(:value) { "#{param}_value" }
|
||||||
|
|
||||||
|
subject { runner.read_attribute(param.to_sym) }
|
||||||
|
|
||||||
|
it do
|
||||||
|
post ci_api("/builds/register"), token: runner.token, info: { param => value }
|
||||||
|
expect(response.status).to eq(404)
|
||||||
|
runner.reload
|
||||||
|
is_expected.to eq(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PUT /builds/:id" do
|
describe "PUT /builds/:id" do
|
||||||
|
|
|
@ -51,6 +51,20 @@ describe Ci::API::API do
|
||||||
|
|
||||||
expect(response.status).to eq(400)
|
expect(response.status).to eq(400)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
%w(name version revision platform architecture).each do |param|
|
||||||
|
context "creates runner with #{param} saved" do
|
||||||
|
let(:value) { "#{param}_value" }
|
||||||
|
|
||||||
|
subject { Ci::Runner.first.read_attribute(param.to_sym) }
|
||||||
|
|
||||||
|
it do
|
||||||
|
post ci_api("/runners/register"), token: registration_token, info: { param => value }
|
||||||
|
expect(response.status).to eq(201)
|
||||||
|
is_expected.to eq(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE /runners/delete" do
|
describe "DELETE /runners/delete" do
|
||||||
|
|
|
@ -48,4 +48,10 @@ FactoryGirl::SyntaxRunner.class_eval do
|
||||||
include RSpec::Mocks::ExampleMethods
|
include RSpec::Mocks::ExampleMethods
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Work around a Rails 4.2.5.1 issue
|
||||||
|
# See https://github.com/rspec/rspec-rails/issues/1532
|
||||||
|
RSpec::Rails::ViewRendering::EmptyTemplatePathSetDecorator.class_eval do
|
||||||
|
alias_method :find_all_anywhere, :find_all
|
||||||
|
end
|
||||||
|
|
||||||
ActiveRecord::Migration.maintain_test_schema!
|
ActiveRecord::Migration.maintain_test_schema!
|
||||||
|
|
246
vendor/assets/javascripts/jquery.ba-resize.js
vendored
Normal file
246
vendor/assets/javascripts/jquery.ba-resize.js
vendored
Normal file
|
@ -0,0 +1,246 @@
|
||||||
|
/*!
|
||||||
|
* jQuery resize event - v1.1 - 3/14/2010
|
||||||
|
* http://benalman.com/projects/jquery-resize-plugin/
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||||
|
* Dual licensed under the MIT and GPL licenses.
|
||||||
|
* http://benalman.com/about/license/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Script: jQuery resize event
|
||||||
|
//
|
||||||
|
// *Version: 1.1, Last updated: 3/14/2010*
|
||||||
|
//
|
||||||
|
// Project Home - http://benalman.com/projects/jquery-resize-plugin/
|
||||||
|
// GitHub - http://github.com/cowboy/jquery-resize/
|
||||||
|
// Source - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.js
|
||||||
|
// (Minified) - http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.min.js (1.0kb)
|
||||||
|
//
|
||||||
|
// About: License
|
||||||
|
//
|
||||||
|
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
||||||
|
// Dual licensed under the MIT and GPL licenses.
|
||||||
|
// http://benalman.com/about/license/
|
||||||
|
//
|
||||||
|
// About: Examples
|
||||||
|
//
|
||||||
|
// This working example, complete with fully commented code, illustrates a few
|
||||||
|
// ways in which this plugin can be used.
|
||||||
|
//
|
||||||
|
// resize event - http://benalman.com/code/projects/jquery-resize/examples/resize/
|
||||||
|
//
|
||||||
|
// About: Support and Testing
|
||||||
|
//
|
||||||
|
// Information about what version or versions of jQuery this plugin has been
|
||||||
|
// tested with, what browsers it has been tested in, and where the unit tests
|
||||||
|
// reside (so you can test it yourself).
|
||||||
|
//
|
||||||
|
// jQuery Versions - 1.3.2, 1.4.1, 1.4.2
|
||||||
|
// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.1.
|
||||||
|
// Unit Tests - http://benalman.com/code/projects/jquery-resize/unit/
|
||||||
|
//
|
||||||
|
// About: Release History
|
||||||
|
//
|
||||||
|
// 1.1 - (3/14/2010) Fixed a minor bug that was causing the event to trigger
|
||||||
|
// immediately after bind in some circumstances. Also changed $.fn.data
|
||||||
|
// to $.data to improve performance.
|
||||||
|
// 1.0 - (2/10/2010) Initial release
|
||||||
|
|
||||||
|
(function($,window,undefined){
|
||||||
|
'$:nomunge'; // Used by YUI compressor.
|
||||||
|
|
||||||
|
// A jQuery object containing all non-window elements to which the resize
|
||||||
|
// event is bound.
|
||||||
|
var elems = $([]),
|
||||||
|
|
||||||
|
// Extend $.resize if it already exists, otherwise create it.
|
||||||
|
jq_resize = $.resize = $.extend( $.resize, {} ),
|
||||||
|
|
||||||
|
timeout_id,
|
||||||
|
|
||||||
|
// Reused strings.
|
||||||
|
str_setTimeout = 'setTimeout',
|
||||||
|
str_resize = 'resize',
|
||||||
|
str_data = str_resize + '-special-event',
|
||||||
|
str_delay = 'delay',
|
||||||
|
str_throttle = 'throttleWindow';
|
||||||
|
|
||||||
|
// Property: jQuery.resize.delay
|
||||||
|
//
|
||||||
|
// The numeric interval (in milliseconds) at which the resize event polling
|
||||||
|
// loop executes. Defaults to 250.
|
||||||
|
|
||||||
|
jq_resize[ str_delay ] = 250;
|
||||||
|
|
||||||
|
// Property: jQuery.resize.throttleWindow
|
||||||
|
//
|
||||||
|
// Throttle the native window object resize event to fire no more than once
|
||||||
|
// every <jQuery.resize.delay> milliseconds. Defaults to true.
|
||||||
|
//
|
||||||
|
// Because the window object has its own resize event, it doesn't need to be
|
||||||
|
// provided by this plugin, and its execution can be left entirely up to the
|
||||||
|
// browser. However, since certain browsers fire the resize event continuously
|
||||||
|
// while others do not, enabling this will throttle the window resize event,
|
||||||
|
// making event behavior consistent across all elements in all browsers.
|
||||||
|
//
|
||||||
|
// While setting this property to false will disable window object resize
|
||||||
|
// event throttling, please note that this property must be changed before any
|
||||||
|
// window object resize event callbacks are bound.
|
||||||
|
|
||||||
|
jq_resize[ str_throttle ] = true;
|
||||||
|
|
||||||
|
// Event: resize event
|
||||||
|
//
|
||||||
|
// Fired when an element's width or height changes. Because browsers only
|
||||||
|
// provide this event for the window element, for other elements a polling
|
||||||
|
// loop is initialized, running every <jQuery.resize.delay> milliseconds
|
||||||
|
// to see if elements' dimensions have changed. You may bind with either
|
||||||
|
// .resize( fn ) or .bind( "resize", fn ), and unbind with .unbind( "resize" ).
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
//
|
||||||
|
// > jQuery('selector').bind( 'resize', function(e) {
|
||||||
|
// > // element's width or height has changed!
|
||||||
|
// > ...
|
||||||
|
// > });
|
||||||
|
//
|
||||||
|
// Additional Notes:
|
||||||
|
//
|
||||||
|
// * The polling loop is not created until at least one callback is actually
|
||||||
|
// bound to the 'resize' event, and this single polling loop is shared
|
||||||
|
// across all elements.
|
||||||
|
//
|
||||||
|
// Double firing issue in jQuery 1.3.2:
|
||||||
|
//
|
||||||
|
// While this plugin works in jQuery 1.3.2, if an element's event callbacks
|
||||||
|
// are manually triggered via .trigger( 'resize' ) or .resize() those
|
||||||
|
// callbacks may double-fire, due to limitations in the jQuery 1.3.2 special
|
||||||
|
// events system. This is not an issue when using jQuery 1.4+.
|
||||||
|
//
|
||||||
|
// > // While this works in jQuery 1.4+
|
||||||
|
// > $(elem).css({ width: new_w, height: new_h }).resize();
|
||||||
|
// >
|
||||||
|
// > // In jQuery 1.3.2, you need to do this:
|
||||||
|
// > var elem = $(elem);
|
||||||
|
// > elem.css({ width: new_w, height: new_h });
|
||||||
|
// > elem.data( 'resize-special-event', { width: elem.width(), height: elem.height() } );
|
||||||
|
// > elem.resize();
|
||||||
|
|
||||||
|
$.event.special[ str_resize ] = {
|
||||||
|
|
||||||
|
// Called only when the first 'resize' event callback is bound per element.
|
||||||
|
setup: function() {
|
||||||
|
// Since window has its own native 'resize' event, return false so that
|
||||||
|
// jQuery will bind the event using DOM methods. Since only 'window'
|
||||||
|
// objects have a .setTimeout method, this should be a sufficient test.
|
||||||
|
// Unless, of course, we're throttling the 'resize' event for window.
|
||||||
|
if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
|
||||||
|
|
||||||
|
var elem = $(this);
|
||||||
|
|
||||||
|
// Add this element to the list of internal elements to monitor.
|
||||||
|
elems = elems.add( elem );
|
||||||
|
|
||||||
|
// Initialize data store on the element.
|
||||||
|
$.data( this, str_data, { w: elem.width(), h: elem.height() } );
|
||||||
|
|
||||||
|
// If this is the first element added, start the polling loop.
|
||||||
|
if ( elems.length === 1 ) {
|
||||||
|
loopy();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Called only when the last 'resize' event callback is unbound per element.
|
||||||
|
teardown: function() {
|
||||||
|
// Since window has its own native 'resize' event, return false so that
|
||||||
|
// jQuery will unbind the event using DOM methods. Since only 'window'
|
||||||
|
// objects have a .setTimeout method, this should be a sufficient test.
|
||||||
|
// Unless, of course, we're throttling the 'resize' event for window.
|
||||||
|
if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
|
||||||
|
|
||||||
|
var elem = $(this);
|
||||||
|
|
||||||
|
// Remove this element from the list of internal elements to monitor.
|
||||||
|
elems = elems.not( elem );
|
||||||
|
|
||||||
|
// Remove any data stored on the element.
|
||||||
|
elem.removeData( str_data );
|
||||||
|
|
||||||
|
// If this is the last element removed, stop the polling loop.
|
||||||
|
if ( !elems.length ) {
|
||||||
|
clearTimeout( timeout_id );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Called every time a 'resize' event callback is bound per element (new in
|
||||||
|
// jQuery 1.4).
|
||||||
|
add: function( handleObj ) {
|
||||||
|
// Since window has its own native 'resize' event, return false so that
|
||||||
|
// jQuery doesn't modify the event object. Unless, of course, we're
|
||||||
|
// throttling the 'resize' event for window.
|
||||||
|
if ( !jq_resize[ str_throttle ] && this[ str_setTimeout ] ) { return false; }
|
||||||
|
|
||||||
|
var old_handler;
|
||||||
|
|
||||||
|
// The new_handler function is executed every time the event is triggered.
|
||||||
|
// This is used to update the internal element data store with the width
|
||||||
|
// and height when the event is triggered manually, to avoid double-firing
|
||||||
|
// of the event callback. See the "Double firing issue in jQuery 1.3.2"
|
||||||
|
// comments above for more information.
|
||||||
|
|
||||||
|
function new_handler( e, w, h ) {
|
||||||
|
var elem = $(this),
|
||||||
|
data = $.data( this, str_data );
|
||||||
|
|
||||||
|
// If called from the polling loop, w and h will be passed in as
|
||||||
|
// arguments. If called manually, via .trigger( 'resize' ) or .resize(),
|
||||||
|
// those values will need to be computed.
|
||||||
|
data.w = w !== undefined ? w : elem.width();
|
||||||
|
data.h = h !== undefined ? h : elem.height();
|
||||||
|
|
||||||
|
old_handler.apply( this, arguments );
|
||||||
|
};
|
||||||
|
|
||||||
|
// This may seem a little complicated, but it normalizes the special event
|
||||||
|
// .add method between jQuery 1.4/1.4.1 and 1.4.2+
|
||||||
|
if ( $.isFunction( handleObj ) ) {
|
||||||
|
// 1.4, 1.4.1
|
||||||
|
old_handler = handleObj;
|
||||||
|
return new_handler;
|
||||||
|
} else {
|
||||||
|
// 1.4.2+
|
||||||
|
old_handler = handleObj.handler;
|
||||||
|
handleObj.handler = new_handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function loopy() {
|
||||||
|
|
||||||
|
// Start the polling loop, asynchronously.
|
||||||
|
timeout_id = window[ str_setTimeout ](function(){
|
||||||
|
|
||||||
|
// Iterate over all elements to which the 'resize' event is bound.
|
||||||
|
elems.each(function(){
|
||||||
|
var elem = $(this),
|
||||||
|
width = elem.width(),
|
||||||
|
height = elem.height(),
|
||||||
|
data = $.data( this, str_data );
|
||||||
|
|
||||||
|
// If element size has changed since the last time, update the element
|
||||||
|
// data store and trigger the 'resize' event.
|
||||||
|
if ( width !== data.w || height !== data.h ) {
|
||||||
|
elem.trigger( str_resize, [ data.w = width, data.h = height ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Loop.
|
||||||
|
loopy();
|
||||||
|
|
||||||
|
}, jq_resize[ str_delay ] );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery,this);
|
Loading…
Reference in a new issue