Commit 7fefb0397eea99910537541bbba70d0a68a44644
1 parent
02c3bb7a
Exists in
master
and in
4 other branches
Fix filter context. Dont duplicate target project name for MR
Showing
10 changed files
with
31 additions
and
26 deletions
Show diff stats
app/assets/stylesheets/common.scss
@@ -364,18 +364,6 @@ img.emoji { | @@ -364,18 +364,6 @@ img.emoji { | ||
364 | margin-bottom: 10px; | 364 | margin-bottom: 10px; |
365 | } | 365 | } |
366 | 366 | ||
367 | -.label-project { | ||
368 | - @include border-radius(4px); | ||
369 | - padding: 2px 4px; | ||
370 | - border: none; | ||
371 | - font-size: 14px; | ||
372 | - background: #474D57; | ||
373 | - color: #fff; | ||
374 | - font-family: $monospace_font; | ||
375 | - text-shadow: 0 1px 1px #111; | ||
376 | - font-weight: normal; | ||
377 | -} | ||
378 | - | ||
379 | .group-name { | 367 | .group-name { |
380 | font-size: 14px; | 368 | font-size: 14px; |
381 | line-height: 24px; | 369 | line-height: 24px; |
app/assets/stylesheets/gitlab_bootstrap/mixins.scss
@@ -17,6 +17,10 @@ | @@ -17,6 +17,10 @@ | ||
17 | border-radius: $radius; | 17 | border-radius: $radius; |
18 | } | 18 | } |
19 | 19 | ||
20 | +@mixin border-radius-left($radius) { | ||
21 | + @include border-radius($radius 0 0 $radius) | ||
22 | +} | ||
23 | + | ||
20 | @mixin linear-gradient($from, $to) { | 24 | @mixin linear-gradient($from, $to) { |
21 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to)); | 25 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to)); |
22 | background-image: -webkit-linear-gradient($from, $to); | 26 | background-image: -webkit-linear-gradient($from, $to); |
app/assets/stylesheets/sections/merge_requests.scss
@@ -84,14 +84,23 @@ | @@ -84,14 +84,23 @@ | ||
84 | 84 | ||
85 | .label-branch { | 85 | .label-branch { |
86 | @include border-radius(4px); | 86 | @include border-radius(4px); |
87 | - padding: 2px 4px; | 87 | + padding: 3px 4px; |
88 | border: none; | 88 | border: none; |
89 | font-size: 14px; | 89 | font-size: 14px; |
90 | background: #474D57; | 90 | background: #474D57; |
91 | color: #fff; | 91 | color: #fff; |
92 | font-family: $monospace_font; | 92 | font-family: $monospace_font; |
93 | - text-shadow: 0 1px 1px #111; | ||
94 | font-weight: normal; | 93 | font-weight: normal; |
94 | + overflow: hidden; | ||
95 | + | ||
96 | + .label-project { | ||
97 | + @include border-radius-left(4px); | ||
98 | + padding: 3px 4px; | ||
99 | + background: #29A; | ||
100 | + position: relative; | ||
101 | + left: -4px; | ||
102 | + letter-spacing: -1px; | ||
103 | + } | ||
95 | } | 104 | } |
96 | 105 | ||
97 | .mr-list { | 106 | .mr-list { |
app/contexts/filter_context.rb
@@ -12,7 +12,7 @@ class FilterContext | @@ -12,7 +12,7 @@ class FilterContext | ||
12 | 12 | ||
13 | def apply_filter items | 13 | def apply_filter items |
14 | if params[:project_id].present? | 14 | if params[:project_id].present? |
15 | - items = items.where(project_id: params[:project_id]) | 15 | + items = items.of_projects(params[:project_id]) |
16 | end | 16 | end |
17 | 17 | ||
18 | if params[:search].present? | 18 | if params[:search].present? |
app/models/concerns/issuable.rb
@@ -21,6 +21,7 @@ module Issuable | @@ -21,6 +21,7 @@ module Issuable | ||
21 | scope :recent, -> { order("created_at DESC") } | 21 | scope :recent, -> { order("created_at DESC") } |
22 | scope :assigned, -> { where("assignee_id IS NOT NULL") } | 22 | scope :assigned, -> { where("assignee_id IS NOT NULL") } |
23 | scope :unassigned, -> { where("assignee_id IS NULL") } | 23 | scope :unassigned, -> { where("assignee_id IS NULL") } |
24 | + scope :of_projects, ->(ids) { where(project_id: ids) } | ||
24 | 25 | ||
25 | delegate :name, | 26 | delegate :name, |
26 | :email, | 27 | :email, |
app/models/issue.rb
@@ -27,7 +27,6 @@ class Issue < ActiveRecord::Base | @@ -27,7 +27,6 @@ class Issue < ActiveRecord::Base | ||
27 | scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } | 27 | scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } |
28 | scope :opened, -> { with_state(:opened) } | 28 | scope :opened, -> { with_state(:opened) } |
29 | scope :closed, -> { with_state(:closed) } | 29 | scope :closed, -> { with_state(:closed) } |
30 | - scope :by_project, ->(project_id) {where(project_id:project_id)} | ||
31 | 30 | ||
32 | attr_accessible :title, :assignee_id, :position, :description, | 31 | attr_accessible :title, :assignee_id, :position, :description, |
33 | :milestone_id, :label_list, :author_id_of_changes, | 32 | :milestone_id, :label_list, :author_id_of_changes, |
app/models/merge_request.rb
@@ -93,8 +93,8 @@ class MergeRequest < ActiveRecord::Base | @@ -93,8 +93,8 @@ class MergeRequest < ActiveRecord::Base | ||
93 | scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) } | 93 | scope :by_branch, ->(branch_name) { where("(source_branch LIKE :branch) OR (target_branch LIKE :branch)", branch: branch_name) } |
94 | scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) } | 94 | scope :cared, ->(user) { where('assignee_id = :user OR author_id = :user', user: user.id) } |
95 | scope :by_milestone, ->(milestone) { where(milestone_id: milestone) } | 95 | scope :by_milestone, ->(milestone) { where(milestone_id: milestone) } |
96 | - scope :by_project, ->(project_id) { where("source_project_id = :project_id OR target_project_id = :project_id", project_id: project_id) } | ||
97 | scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) } | 96 | scope :in_projects, ->(project_ids) { where("source_project_id in (:project_ids) OR target_project_id in (:project_ids)", project_ids: project_ids) } |
97 | + scope :of_projects, ->(ids) { where(target_project_id: ids) } | ||
98 | # Closed scope for merge request should return | 98 | # Closed scope for merge request should return |
99 | # both merged and closed mr's | 99 | # both merged and closed mr's |
100 | scope :closed, -> { with_states(:closed, :merged) } | 100 | scope :closed, -> { with_states(:closed, :merged) } |
app/views/projects/merge_requests/_merge_request.html.haml
@@ -9,12 +9,14 @@ | @@ -9,12 +9,14 @@ | ||
9 | - else | 9 | - else |
10 | %span.pull-right | 10 | %span.pull-right |
11 | - if merge_request.for_fork? | 11 | - if merge_request.for_fork? |
12 | - = "#{merge_request.source_project.path_with_namespace}/#{merge_request.source_branch}" | ||
13 | - %i.icon-angle-right | ||
14 | - = "#{merge_request.target_project.path_with_namespace}/#{merge_request.target_branch}" | 12 | + %span.light |
13 | + = "#{merge_request.source_project.path_with_namespace}" | ||
14 | + = "#{merge_request.source_branch}" | ||
15 | + %i.icon-angle-right.light | ||
16 | + = "#{merge_request.target_branch}" | ||
15 | - else | 17 | - else |
16 | = "#{merge_request.source_branch}" | 18 | = "#{merge_request.source_branch}" |
17 | - %i.icon-angle-right | 19 | + %i.icon-angle-right.light |
18 | = "#{merge_request.target_branch}" | 20 | = "#{merge_request.target_branch}" |
19 | .merge-request-info | 21 | .merge-request-info |
20 | - if merge_request.author | 22 | - if merge_request.author |
app/views/projects/merge_requests/show/_mr_title.html.haml
@@ -2,10 +2,10 @@ | @@ -2,10 +2,10 @@ | ||
2 | = "Merge Request ##{@merge_request.id}:" | 2 | = "Merge Request ##{@merge_request.id}:" |
3 | | 3 | |
4 | -if @merge_request.for_fork? | 4 | -if @merge_request.for_fork? |
5 | - %span.label-project= truncate(@merge_request.source_project.path_with_namespace, length: 25) | ||
6 | - %span.label-branch= @merge_request.source_branch | 5 | + %span.label-branch |
6 | + %span.label-project= truncate(@merge_request.source_project.path_with_namespace, length: 25) | ||
7 | + #{@merge_request.source_branch} | ||
7 | → | 8 | → |
8 | - %span.label-project= truncate(@merge_request.target_project.path_with_namespace, length: 25) | ||
9 | %span.label-branch= @merge_request.target_branch | 9 | %span.label-branch= @merge_request.target_branch |
10 | - else | 10 | - else |
11 | %span.label-branch= @merge_request.source_branch | 11 | %span.label-branch= @merge_request.source_branch |
spec/contexts/filter_context_spec.rb
@@ -21,17 +21,19 @@ describe FilterContext do | @@ -21,17 +21,19 @@ describe FilterContext do | ||
21 | merge_request3 | 21 | merge_request3 |
22 | merge_request4 | 22 | merge_request4 |
23 | end | 23 | end |
24 | + | ||
24 | it 'should by default filter properly' do | 25 | it 'should by default filter properly' do |
25 | merge_requests = user.cared_merge_requests | 26 | merge_requests = user.cared_merge_requests |
26 | params ={} | 27 | params ={} |
27 | merge_requests = FilterContext.new(merge_requests, params).execute | 28 | merge_requests = FilterContext.new(merge_requests, params).execute |
28 | merge_requests.size.should == 3 | 29 | merge_requests.size.should == 3 |
29 | end | 30 | end |
31 | + | ||
30 | it 'should apply blocks passed in on creation to the filters' do | 32 | it 'should apply blocks passed in on creation to the filters' do |
31 | merge_requests = user.cared_merge_requests | 33 | merge_requests = user.cared_merge_requests |
32 | params = {:project_id => project1.id} | 34 | params = {:project_id => project1.id} |
33 | merge_requests = FilterContext.new(merge_requests, params).execute | 35 | merge_requests = FilterContext.new(merge_requests, params).execute |
34 | - merge_requests.size.should == 2 | 36 | + merge_requests.size.should == 1 |
35 | end | 37 | end |
36 | end | 38 | end |
37 | 39 | ||
@@ -54,4 +56,4 @@ describe FilterContext do | @@ -54,4 +56,4 @@ describe FilterContext do | ||
54 | issues.size.should == 1 | 56 | issues.size.should == 1 |
55 | end | 57 | end |
56 | end | 58 | end |
57 | -end | ||
58 | \ No newline at end of file | 59 | \ No newline at end of file |
60 | +end |