Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
7fefb039
Commit
7fefb039
authored
Aug 08, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix filter context. Dont duplicate target project name for MR
parent
02c3bb7a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
26 deletions
+31
-26
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+0
-12
app/assets/stylesheets/gitlab_bootstrap/mixins.scss
app/assets/stylesheets/gitlab_bootstrap/mixins.scss
+4
-0
app/assets/stylesheets/sections/merge_requests.scss
app/assets/stylesheets/sections/merge_requests.scss
+11
-2
app/contexts/filter_context.rb
app/contexts/filter_context.rb
+1
-1
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-0
app/models/issue.rb
app/models/issue.rb
+0
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+6
-4
app/views/projects/merge_requests/show/_mr_title.html.haml
app/views/projects/merge_requests/show/_mr_title.html.haml
+3
-3
spec/contexts/filter_context_spec.rb
spec/contexts/filter_context_spec.rb
+4
-2
No files found.
app/assets/stylesheets/common.scss
View file @
7fefb039
...
@@ -364,18 +364,6 @@ img.emoji {
...
@@ -364,18 +364,6 @@ img.emoji {
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
.label-project
{
@include
border-radius
(
4px
);
padding
:
2px
4px
;
border
:
none
;
font-size
:
14px
;
background
:
#474D57
;
color
:
#fff
;
font-family
:
$monospace_font
;
text-shadow
:
0
1px
1px
#111
;
font-weight
:
normal
;
}
.group-name
{
.group-name
{
font-size
:
14px
;
font-size
:
14px
;
line-height
:
24px
;
line-height
:
24px
;
...
...
app/assets/stylesheets/gitlab_bootstrap/mixins.scss
View file @
7fefb039
...
@@ -17,6 +17,10 @@
...
@@ -17,6 +17,10 @@
border-radius
:
$radius
;
border-radius
:
$radius
;
}
}
@mixin
border-radius-left
(
$radius
)
{
@include
border-radius
(
$radius
0
0
$radius
)
}
@mixin
linear-gradient
(
$from
,
$to
)
{
@mixin
linear-gradient
(
$from
,
$to
)
{
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
$from
)
,
to
(
$to
));
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
$from
)
,
to
(
$to
));
background-image
:
-webkit-linear-gradient
(
$from
,
$to
);
background-image
:
-webkit-linear-gradient
(
$from
,
$to
);
...
...
app/assets/stylesheets/sections/merge_requests.scss
View file @
7fefb039
...
@@ -84,14 +84,23 @@
...
@@ -84,14 +84,23 @@
.label-branch
{
.label-branch
{
@include
border-radius
(
4px
);
@include
border-radius
(
4px
);
padding
:
2
px
4px
;
padding
:
3
px
4px
;
border
:
none
;
border
:
none
;
font-size
:
14px
;
font-size
:
14px
;
background
:
#474D57
;
background
:
#474D57
;
color
:
#fff
;
color
:
#fff
;
font-family
:
$monospace_font
;
font-family
:
$monospace_font
;
text-shadow
:
0
1px
1px
#111
;
font-weight
:
normal
;
font-weight
:
normal
;
overflow
:
hidden
;
.label-project
{
@include
border-radius-left
(
4px
);
padding
:
3px
4px
;
background
:
#29A
;
position
:
relative
;
left
:
-4px
;
letter-spacing
:
-1px
;
}
}
}
.mr-list
{
.mr-list
{
...
...
app/contexts/filter_context.rb
View file @
7fefb039
...
@@ -12,7 +12,7 @@ class FilterContext
...
@@ -12,7 +12,7 @@ class FilterContext
def
apply_filter
items
def
apply_filter
items
if
params
[
:project_id
].
present?
if
params
[
:project_id
].
present?
items
=
items
.
where
(
project_id:
params
[
:project_id
])
items
=
items
.
of_projects
(
params
[
:project_id
])
end
end
if
params
[
:search
].
present?
if
params
[
:search
].
present?
...
...
app/models/concerns/issuable.rb
View file @
7fefb039
...
@@ -21,6 +21,7 @@ module Issuable
...
@@ -21,6 +21,7 @@ module Issuable
scope
:recent
,
->
{
order
(
"created_at DESC"
)
}
scope
:recent
,
->
{
order
(
"created_at DESC"
)
}
scope
:assigned
,
->
{
where
(
"assignee_id IS NOT NULL"
)
}
scope
:assigned
,
->
{
where
(
"assignee_id IS NOT NULL"
)
}
scope
:unassigned
,
->
{
where
(
"assignee_id IS NULL"
)
}
scope
:unassigned
,
->
{
where
(
"assignee_id IS NULL"
)
}
scope
:of_projects
,
->
(
ids
)
{
where
(
project_id:
ids
)
}
delegate
:name
,
delegate
:name
,
:email
,
:email
,
...
...
app/models/issue.rb
View file @
7fefb039
...
@@ -27,7 +27,6 @@ class Issue < ActiveRecord::Base
...
@@ -27,7 +27,6 @@ class Issue < ActiveRecord::Base
scope
:of_user_team
,
->
(
team
)
{
where
(
project_id:
team
.
project_ids
,
assignee_id:
team
.
member_ids
)
}
scope
:of_user_team
,
->
(
team
)
{
where
(
project_id:
team
.
project_ids
,
assignee_id:
team
.
member_ids
)
}
scope
:opened
,
->
{
with_state
(
:opened
)
}
scope
:opened
,
->
{
with_state
(
:opened
)
}
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:by_project
,
->
(
project_id
)
{
where
(
project_id
:project_id
)}
attr_accessible
:title
,
:assignee_id
,
:position
,
:description
,
attr_accessible
:title
,
:assignee_id
,
:position
,
:description
,
:milestone_id
,
:label_list
,
:author_id_of_changes
,
:milestone_id
,
:label_list
,
:author_id_of_changes
,
...
...
app/models/merge_request.rb
View file @
7fefb039
...
@@ -93,8 +93,8 @@ class MergeRequest < ActiveRecord::Base
...
@@ -93,8 +93,8 @@ class MergeRequest < ActiveRecord::Base
scope
:by_branch
,
->
(
branch_name
)
{
where
(
"(source_branch LIKE :branch) OR (target_branch LIKE :branch)"
,
branch:
branch_name
)
}
scope
:by_branch
,
->
(
branch_name
)
{
where
(
"(source_branch LIKE :branch) OR (target_branch LIKE :branch)"
,
branch:
branch_name
)
}
scope
:cared
,
->
(
user
)
{
where
(
'assignee_id = :user OR author_id = :user'
,
user:
user
.
id
)
}
scope
:cared
,
->
(
user
)
{
where
(
'assignee_id = :user OR author_id = :user'
,
user:
user
.
id
)
}
scope
:by_milestone
,
->
(
milestone
)
{
where
(
milestone_id:
milestone
)
}
scope
:by_milestone
,
->
(
milestone
)
{
where
(
milestone_id:
milestone
)
}
scope
:by_project
,
->
(
project_id
)
{
where
(
"source_project_id = :project_id OR target_project_id = :project_id"
,
project_id:
project_id
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
"source_project_id in (:project_ids) OR target_project_id in (:project_ids)"
,
project_ids:
project_ids
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
"source_project_id in (:project_ids) OR target_project_id in (:project_ids)"
,
project_ids:
project_ids
)
}
scope
:of_projects
,
->
(
ids
)
{
where
(
target_project_id:
ids
)
}
# Closed scope for merge request should return
# Closed scope for merge request should return
# both merged and closed mr's
# both merged and closed mr's
scope
:closed
,
->
{
with_states
(
:closed
,
:merged
)
}
scope
:closed
,
->
{
with_states
(
:closed
,
:merged
)
}
...
...
app/views/projects/merge_requests/_merge_request.html.haml
View file @
7fefb039
...
@@ -9,12 +9,14 @@
...
@@ -9,12 +9,14 @@
-
else
-
else
%span
.pull-right
%span
.pull-right
-
if
merge_request
.
for_fork?
-
if
merge_request
.
for_fork?
=
"
#{
merge_request
.
source_project
.
path_with_namespace
}
/
#{
merge_request
.
source_branch
}
"
%span
.light
%i
.icon-angle-right
=
"
#{
merge_request
.
source_project
.
path_with_namespace
}
"
=
"
#{
merge_request
.
target_project
.
path_with_namespace
}
/
#{
merge_request
.
target_branch
}
"
=
"
#{
merge_request
.
source_branch
}
"
%i
.icon-angle-right.light
=
"
#{
merge_request
.
target_branch
}
"
-
else
-
else
=
"
#{
merge_request
.
source_branch
}
"
=
"
#{
merge_request
.
source_branch
}
"
%i
.icon-angle-right
%i
.icon-angle-right
.light
=
"
#{
merge_request
.
target_branch
}
"
=
"
#{
merge_request
.
target_branch
}
"
.merge-request-info
.merge-request-info
-
if
merge_request
.
author
-
if
merge_request
.
author
...
...
app/views/projects/merge_requests/show/_mr_title.html.haml
View file @
7fefb039
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
=
"Merge Request #
#{
@merge_request
.
id
}
:"
=
"Merge Request #
#{
@merge_request
.
id
}
:"
-
if
@merge_request
.
for_fork?
-
if
@merge_request
.
for_fork?
%span
.label-project
=
truncate
(
@merge_request
.
source_project
.
path_with_namespace
,
length:
25
)
%span
.label-branch
%span
.label-branch
=
@merge_request
.
source_branch
%span
.label-project
=
truncate
(
@merge_request
.
source_project
.
path_with_namespace
,
length:
25
)
#{
@merge_request
.
source_branch
}
→
→
%span
.label-project
=
truncate
(
@merge_request
.
target_project
.
path_with_namespace
,
length:
25
)
%span
.label-branch
=
@merge_request
.
target_branch
%span
.label-branch
=
@merge_request
.
target_branch
-
else
-
else
%span
.label-branch
=
@merge_request
.
source_branch
%span
.label-branch
=
@merge_request
.
source_branch
...
...
spec/contexts/filter_context_spec.rb
View file @
7fefb039
...
@@ -21,17 +21,19 @@ describe FilterContext do
...
@@ -21,17 +21,19 @@ describe FilterContext do
merge_request3
merge_request3
merge_request4
merge_request4
end
end
it
'should by default filter properly'
do
it
'should by default filter properly'
do
merge_requests
=
user
.
cared_merge_requests
merge_requests
=
user
.
cared_merge_requests
params
=
{}
params
=
{}
merge_requests
=
FilterContext
.
new
(
merge_requests
,
params
).
execute
merge_requests
=
FilterContext
.
new
(
merge_requests
,
params
).
execute
merge_requests
.
size
.
should
==
3
merge_requests
.
size
.
should
==
3
end
end
it
'should apply blocks passed in on creation to the filters'
do
it
'should apply blocks passed in on creation to the filters'
do
merge_requests
=
user
.
cared_merge_requests
merge_requests
=
user
.
cared_merge_requests
params
=
{
:project_id
=>
project1
.
id
}
params
=
{
:project_id
=>
project1
.
id
}
merge_requests
=
FilterContext
.
new
(
merge_requests
,
params
).
execute
merge_requests
=
FilterContext
.
new
(
merge_requests
,
params
).
execute
merge_requests
.
size
.
should
==
2
merge_requests
.
size
.
should
==
1
end
end
end
end
...
@@ -54,4 +56,4 @@ describe FilterContext do
...
@@ -54,4 +56,4 @@ describe FilterContext do
issues
.
size
.
should
==
1
issues
.
size
.
should
==
1
end
end
end
end
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment