Commit c0a7f876 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq

Conflicts:
	app/helpers/merge_requests_helper.rb
parents 47308303 5738afdb
......@@ -13,6 +13,7 @@ v 7.10.0 (unreleased)
- Identical look of selectboxes in UI
- Move "Import existing repository by URL" option to button.
- Improve error message when save profile has error.
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu)
......
......@@ -31,7 +31,7 @@ gem 'omniauth-shibboleth'
gem 'omniauth-kerberos'
gem 'omniauth-gitlab'
gem 'omniauth-bitbucket'
gem 'doorkeeper', '2.1.0'
gem 'doorkeeper', '2.1.3'
gem "rack-oauth2", "~> 1.0.5"
# Browser detection
......@@ -49,7 +49,7 @@ gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap"
gem 'net-ldap'
# Git Wiki
gem 'gollum-lib', '~> 4.0.0'
gem 'gollum-lib', '~> 4.0.2'
# Language detection
gem "gitlab-linguist", "~> 3.0.1", require: "linguist"
......
......@@ -136,8 +136,8 @@ GEM
diff-lcs (1.2.5)
diffy (3.0.3)
docile (1.1.5)
doorkeeper (2.1.0)
railties (>= 3.1)
doorkeeper (2.1.3)
railties (>= 3.2)
dotenv (0.9.0)
dropzonejs-rails (0.4.14)
rails (> 3.1)
......@@ -223,11 +223,11 @@ GEM
omniauth (~> 1.0)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.3)
gollum-grit_adapter (0.1.0)
gitlab-grit (~> 2.7.1)
gollum-lib (4.0.0)
gollum-grit_adapter (0.1.3)
gitlab-grit (~> 2.7, >= 2.7.1)
gollum-lib (4.0.2)
github-markup (~> 1.3.1)
gollum-grit_adapter (~> 0.1.0)
gollum-grit_adapter (~> 0.1, >= 0.1.1)
nokogiri (~> 1.6.4)
rouge (~> 1.7.4)
sanitize (~> 2.1.0)
......@@ -481,7 +481,7 @@ GEM
rest-client (1.6.7)
mime-types (>= 1.16)
rinku (1.7.3)
rouge (1.7.4)
rouge (1.7.7)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
......@@ -688,7 +688,7 @@ DEPENDENCIES
devise (= 3.2.4)
devise-async (= 0.9.0)
diffy (~> 3.0.3)
doorkeeper (= 2.1.0)
doorkeeper (= 2.1.3)
dropzonejs-rails
email_spec
enumerize
......@@ -706,7 +706,7 @@ DEPENDENCIES
gitlab_git (~> 7.1.2)
gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.1)
gollum-lib (~> 4.0.0)
gollum-lib (~> 4.0.2)
gon (~> 5.0.0)
grape (~> 0.6.1)
grape-entity (~> 0.4.2)
......
......@@ -19,6 +19,6 @@ class @Issue
$('.issue-details').waitForImages ->
$('.issuable-affix').affix offset:
top: ->
@top = $('.issue-details').outerHeight(true) + 25
@top = ($('.issuable-affix').offset().top - 70)
bottom: ->
@bottom = $('.footer').outerHeight(true)
......@@ -23,7 +23,7 @@ class @MergeRequest
$('.merge-request-details').waitForImages ->
$('.issuable-affix').affix offset:
top: ->
@top = $('.merge-request-details').outerHeight(true) + 91
@top = ($('.issuable-affix').offset().top - 70)
bottom: ->
@bottom = $('.footer').outerHeight(true)
......
......@@ -425,7 +425,7 @@ class @Notes
@removeDiscussionNoteForm(form)
updateVotes: ->
(new NotesVotes).updateVotes()
true
###
Called after an attachment file has been selected.
......
class @NotesVotes
updateVotes: ->
votes = $("#votes .votes")
notes = $("#notes-list .note .vote")
# only update if there is a vote display
if votes.size()
upvotes = notes.filter(".upvote").size()
downvotes = notes.filter(".downvote").size()
votesCount = upvotes + downvotes
upvotesPercent = (if votesCount then (100.0 / votesCount * upvotes) else 0)
downvotesPercent = (if votesCount then (100.0 - upvotesPercent) else 0)
# change vote bar lengths
votes.find(".bar-success").css "width", upvotesPercent + "%"
votes.find(".bar-danger").css "width", downvotesPercent + "%"
# replace vote numbers
votes.find(".upvotes").text votes.find(".upvotes").text().replace(/\d+/, upvotes)
votes.find(".downvotes").text votes.find(".downvotes").text().replace(/\d+/, downvotes)
......@@ -29,7 +29,7 @@
line-height: 24px;
.str-truncated {
max-width: 75%;
max-width: 72%;
}
a {
......
......@@ -25,7 +25,7 @@
}
.issuable-context-title {
font-size: 15px;
font-size: 14px;
line-height: 1.4;
margin-bottom: 5px;
......@@ -39,3 +39,9 @@
margin-right: 4px;
}
}
.issuable-affix .context {
font-size: 13px;
.btn { font-size: 13px; }
}
.votes {
font-size: 13px;
line-height: 15px;
.progress {
height: 4px;
margin: 0;
.bar {
float: left;
height: 100%;
}
.bar-success {
@include linear-gradient(#62C462, #51A351);
background-color: #468847;
}
.bar-danger {
@include linear-gradient(#EE5F5B, #BD362F);
background-color: #B94A48;
}
}
.upvotes {
display: inline-block;
color: #468847;
}
.downvotes {
display: inline-block;
color: #B94A48;
}
}
.votes-block {
margin: 6px;
.downvotes {
float: right;
}
}
.votes-inline {
display: inline-block;
margin: 0 8px;
}
......@@ -160,10 +160,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def ci_status
ci_service = @merge_request.source_project.ci_service
status = ci_service.commit_status(merge_request.last_commit.sha)
status = ci_service.commit_status(merge_request.last_commit.sha, merge_request.source_branch)
if ci_service.respond_to?(:commit_coverage)
coverage = ci_service.commit_coverage(merge_request.last_commit.sha)
coverage = ci_service.commit_coverage(merge_request.last_commit.sha, merge_request.source_branch)
end
response = {
......
......@@ -34,8 +34,8 @@ module MergeRequestsHelper
classes
end
def ci_build_details_path merge_request
build_url = merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha)
def ci_build_details_path(merge_request)
build_url = merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha, merge_request.source_branch)
parsed_url = URI.parse(build_url)
unless parsed_url.userinfo.blank?
......
......@@ -98,11 +98,11 @@ class MergeRequest < ActiveRecord::Base
end
event :mark_as_mergeable do
transition unchecked: :can_be_merged
transition [:unchecked, :cannot_be_merged] => :can_be_merged
end
event :mark_as_unmergeable do
transition unchecked: :cannot_be_merged
transition [:unchecked, :can_be_merged] => :cannot_be_merged
end
state :unchecked
......
......@@ -93,7 +93,7 @@ class BambooService < CiService
end
end
def build_page(sha)
def build_page(sha, ref)
build_info(sha) if @response.nil? || !@response.code
if @response.code != 200 || @response['results']['results']['size'] == '0'
......@@ -106,7 +106,7 @@ class BambooService < CiService
end
end
def commit_status(sha)
def commit_status(sha, ref)
build_info(sha) if @response.nil? || !@response.code
return :error unless @response.code == 200 || @response.code == 404
......
......@@ -48,7 +48,7 @@ class BuildboxService < CiService
service_hook.execute(data)
end
def commit_status(sha)
def commit_status(sha, ref)
response = HTTParty.get(commit_status_path(sha), verify: false)
if response.code == 200 && response['status']
......@@ -62,7 +62,7 @@ class BuildboxService < CiService
"#{buildbox_endpoint('gitlab')}/status/#{status_token}.json?commit=#{sha}"
end
def build_page(sha)
def build_page(sha, ref)
"#{project_url}/builds?commit=#{sha}"
end
......
......@@ -34,7 +34,7 @@ class CiService < Service
# Ex.
# http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c
#
def build_page(sha)
def build_page(sha, ref)
# implement inside child
end
......@@ -51,7 +51,7 @@ class CiService < Service
# # => 'running'
#
#
def commit_status(sha)
def commit_status(sha, ref)
# implement inside child
end
end
......@@ -40,17 +40,17 @@ class GitlabCiService < CiService
service_hook.execute(data)
end
def commit_status_path(sha)
project_url + "/commits/#{sha}/status.json?token=#{token}"
def commit_status_path(sha, ref)
project_url + "/refs/#{ref}/commits/#{sha}/status.json?token=#{token}"
end
def get_ci_build(sha)
def get_ci_build(sha, ref)
@ci_builds ||= {}
@ci_builds[sha] ||= HTTParty.get(commit_status_path(sha), verify: false)
@ci_builds[sha] ||= HTTParty.get(commit_status_path(sha, ref), verify: false)
end
def commit_status(sha)
response = get_ci_build(sha)
def commit_status(sha, ref)
response = get_ci_build(sha, ref)
if response.code == 200 and response["status"]
response["status"]
......@@ -59,16 +59,16 @@ class GitlabCiService < CiService
end
end
def commit_coverage(sha)
response = get_ci_build(sha)
def commit_coverage(sha, ref)
response = get_ci_build(sha, ref)
if response.code == 200 and response["coverage"]
response["coverage"]
end
end
def build_page(sha)
project_url + "/commits/#{sha}"
def build_page(sha, ref)
project_url + "/refs/#{ref}/commits/#{sha}"
end
def builds_path
......
......@@ -88,7 +88,7 @@ class TeamcityService < CiService
@response = HTTParty.get("#{url}", verify: false, basic_auth: auth)
end
def build_page(sha)
def build_page(sha, ref)
build_info(sha) if @response.nil? || !@response.code
if @response.code != 200
......@@ -103,7 +103,7 @@ class TeamcityService < CiService
end
end
def commit_status(sha)
def commit_status(sha, ref)
build_info(sha) if @response.nil? || !@response.code
return :error unless @response.code == 200 || @response.code == 404
......
......@@ -6,11 +6,12 @@
= link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"
.row
%section.col-md-9
.votes-holder.pull-right
#votes= render 'votes/votes_block', votable: @issue
.participants
%span= pluralize(@issue.participants.count, 'participant')
- @issue.participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24)
.voting_notes#notes= render "projects/notes/notes_with_form"
%aside.col-md-3
.issuable-affix
......@@ -20,15 +21,10 @@
%hr
.context
= render partial: 'issue_context', locals: { issue: @issue }
%hr
.clearfix
.votes-holder
%h6 Votes
#votes= render 'votes/votes_block', votable: @issue
- if @issue.labels.any?
%hr
%h6 Labels
.issuable-context-title
%label Labels
.issue-show-labels
- @issue.labels.each do |label|
= link_to namespace_project_issues_path(@project.namespace, @project, label_name: label.name) do
......
......@@ -45,5 +45,5 @@
:coffeescript
$ ->
new Subscription("#{toggle_subscription_namespace_project_issue_path(@issue.project.namespace, @project, @issue)}")
\ No newline at end of file
......@@ -7,6 +7,8 @@
.row
%section.col-md-9
.votes-holder.pull-right
#votes= render 'votes/votes_block', votable: @merge_request
= render "projects/merge_requests/show/participants"
= render "projects/notes/notes_with_form"
%aside.col-md-3
......@@ -17,14 +19,10 @@
%hr
.context
= render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
%hr
.votes-holder
%h6 Votes
#votes= render 'votes/votes_block', votable: @merge_request
- if @merge_request.labels.any?
%hr
%h6 Labels
.issuable-context-title
%label Labels
.merge-request-show-labels
- @merge_request.labels.each do |label|
= link_to namespace_project_merge_requests_path(@project.namespace, @project, label_name: label.name) do
......
.votes.votes-block
.progress
.progress-bar.progress-bar-success{style: "width: #{votable.upvotes_in_percent}%;"}
.progress-bar.progress-bar-danger{style: "width: #{votable.downvotes_in_percent}%;"}
.upvotes= "#{votable.upvotes} up"
.downvotes= "#{votable.downvotes} down"
.btn-group
- unless votable.upvotes.zero?
.btn.btn-sm.disabled.cgreen
%i.fa.fa-thumbs-up
= votable.upvotes
- unless votable.downvotes.zero?
.btn.btn-sm.disabled.cred
%i.fa.fa-thumbs-down
= votable.downvotes
.votes.votes-inline
- unless votable.upvotes.zero?
.upvotes
%span.upvotes.cgreen
+ #{votable.upvotes}
- unless votable.downvotes.zero?
\/
- unless votable.downvotes.zero?
.downvotes
%span.downvotes.cred
\- #{votable.downvotes}
......@@ -350,14 +350,6 @@ Gitlab::Application.routes.draw do
as: :tree
)
end
resource :avatar, only: [:show, :destroy]
resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do
get :branches, on: :member
end
resources :commits, only: [:show], constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
resources :compare, only: [:index, :create]
scope do
get(
......@@ -368,8 +360,24 @@ Gitlab::Application.routes.draw do
)
end
resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }
resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
scope do
get(
'/commits/*id',
to: 'commits#show',
constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
as: :commits
)
end
resource :avatar, only: [:show, :destroy]
resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do
get :branches, on: :member
end
resources :compare, only: [:index, :create]
resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }
resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
member do
get :commits
end
......
......@@ -59,7 +59,7 @@ describe BuildboxService do
describe :build_page do
it 'returns the correct build page' do
expect(@service.build_page('2ab7834c')).to eq(
expect(@service.build_page('2ab7834c', nil)).to eq(
'https://buildbox.io/account-name/example-project/builds?commit=2ab7834c'
)
end
......
......@@ -39,11 +39,11 @@ describe GitlabCiService do
end
describe :commit_status_path do
it { expect(@service.commit_status_path("2ab7834c")).to eq("http://ci.gitlab.org/projects/2/commits/2ab7834c/status.json?token=verySecret")}
it { expect(@service.commit_status_path("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c/status.json?token=verySecret")}
end
describe :build_page do
it { expect(@service.build_page("2ab7834c")).to eq("http://ci.gitlab.org/projects/2/commits/2ab7834c")}
it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c")}
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment