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
8803fbb5
Commit
8803fbb5
authored
Nov 28, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge request: notes, diffs, commits
parent
c0e5bc5e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
22 deletions
+120
-22
app/assets/stylesheets/application.css
app/assets/stylesheets/application.css
+1
-0
app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss
+36
-0
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+18
-1
app/views/merge_requests/_commits.html.haml
app/views/merge_requests/_commits.html.haml
+17
-0
app/views/merge_requests/_diffs.html.haml
app/views/merge_requests/_diffs.html.haml
+22
-0
app/views/merge_requests/_form.html.haml
app/views/merge_requests/_form.html.haml
+4
-4
app/views/merge_requests/show.html.haml
app/views/merge_requests/show.html.haml
+16
-16
config/routes.rb
config/routes.rb
+6
-1
No files found.
app/assets/stylesheets/application.css
View file @
8803fbb5
...
...
@@ -49,3 +49,4 @@
.no-padding
{
padding
:
0
!important
;
}
app/assets/stylesheets/projects.css.scss
View file @
8803fbb5
...
...
@@ -426,3 +426,39 @@ body.project-page table.no-borders tr,
body
.project-page
table
.no-borders
td
{
border
:none
;
}
#gitlab-tabs
{
.ui-tabs-nav
{
border-bottom
:
1px
solid
#DEDFE1
;
li
{
background
:
none
;
border
:none
;
font-size
:
16px
;
margin
:
0
;
padding
:
0
;
a
{
margin
:
0
;
padding
:
10px
16px
;
width
:
150px
;
}
&
.ui-tabs-selected
{
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
26
,
color-stop
(
0
.076
,
#fefefe
)
,
to
(
#F6F7F8
));
background-image
:
-webkit-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
background-image
:
-moz-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
background-image
:
-o-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
font-weight
:
bold
;
border
:
1px
solid
#DEDFE1
;
border-bottom
:
1px
solid
#DEDFE1
;
-webkit-border-top-left-radius
:
5px
;
-webkit-border-top-right-radius
:
5px
;
-moz-border-radius-topleft
:
5px
;
-moz-border-radius-topright
:
5px
;
border-top-left-radius
:
5px
;
border-top-right-radius
:
5px
;
}
}
}
}
app/controllers/merge_requests_controller.rb
View file @
8803fbb5
class
MergeRequestsController
<
ApplicationController
before_filter
:authenticate_user!
before_filter
:project
before_filter
:merge_request
,
:only
=>
[
:edit
,
:update
,
:destroy
,
:show
]
before_filter
:merge_request
,
:only
=>
[
:edit
,
:update
,
:destroy
,
:show
,
:commits
,
:diffs
]
layout
"project"
# Authorize
...
...
@@ -19,7 +19,24 @@ class MergeRequestsController < ApplicationController
head
(
404
)
and
return
end
@notes
=
@merge_request
.
notes
.
inc_author
.
order
(
"created_at DESC"
).
limit
(
20
)
@note
=
@project
.
notes
.
new
(
:noteable
=>
@merge_request
)
respond_to
do
|
format
|
format
.
html
format
.
js
{
respond_with_notes
}
end
end
def
commits
@commits
=
@project
.
repo
.
commits_between
(
@merge_request
.
target_branch
,
@merge_request
.
source_branch
).
map
{
|
c
|
Commit
.
new
(
c
)}
render
:template
=>
"merge_requests/_commits"
,
:layout
=>
false
end
def
diffs
@commit
=
@project
.
commit
(
@merge_request
.
source_branch
)
@diffs
=
@project
.
repo
.
diff
(
@merge_request
.
target_branch
,
@merge_request
.
source_branch
)
render
:template
=>
"merge_requests/_diffs"
,
:layout
=>
false
end
def
new
...
...
app/views/merge_requests/_commits.html.haml
0 → 100644
View file @
8803fbb5
-
if
@commits
.
size
>
0
.merge-request-commits.ui-box.width-100p
-
@commits
.
each
do
|
commit
|
%a
{
:class
=>
"commit"
,
:href
=>
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
}
-
if
commit
.
author_email
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
-
else
=
image_tag
"no_avatar.png"
,
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%span
.update-title
=
truncate
commit
.
safe_message
,
:length
=>
60
%span
.update-author
%strong
=
commit
.
author_name
authored
=
time_ago_in_words
(
commit
.
created_at
)
ago
.clear
app/views/merge_requests/_diffs.html.haml
0 → 100644
View file @
8803fbb5
-
@diffs
.
each
do
|
diff
|
-
next
if
diff
.
diff
.
empty?
-
file
=
(
@commit
.
tree
/
diff
.
b_path
)
-
next
unless
file
.diff_file
.diff_file_header
-
if
diff
.
deleted_file
%strong
{
:id
=>
"#{diff.b_path}"
}=
diff
.
a_path
-
else
=
link_to
tree_file_project_ref_path
(
@project
,
@commit
.
id
,
diff
.
b_path
)
do
%strong
{
:id
=>
"#{diff.b_path}"
}=
diff
.
b_path
%br
/
.diff_file_content
-
if
file
.
text?
=
render
:partial
=>
"commits/text_file"
,
:locals
=>
{
:diff
=>
diff
}
-
elsif
file
.
image?
.diff_file_content_image
%img
{
:src
=>
"data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"
}
-
else
%p
%center
No preview for this file type
app/views/merge_requests/_form.html.haml
View file @
8803fbb5
...
...
@@ -18,11 +18,11 @@
%td
=
f
.
label
:title
%td
=
f
.
text_field
:title
%tr
%td
=
f
.
label
:target_branch
,
"From"
%td
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
})
%tr
%td
=
f
.
label
:source_branch
,
"To"
%td
=
f
.
label
:source_branch
,
"From"
%td
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
})
%tr
%td
=
f
.
label
:target_branch
,
"To"
%td
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
})
%tr
%td
=
f
.
label
:assignee_id
,
"Assign to"
%td
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
})
...
...
app/views/merge_requests/show.html.haml
View file @
8803fbb5
...
...
@@ -40,20 +40,20 @@
%br
%br
#gitlab-tabs
%ul
%li
=
link_to
"Notes"
,
"#merge-notes"
%li
=
link_to
"Commits"
,
commits_project_merge_request_path
(
@project
,
@merge_request
)
%li
=
link_to
"Diff"
,
diffs_project_merge_request_path
(
@project
,
@merge_request
)
-
if
@commits
.
size
>
0
.merge-request-commits.ui-box.width-100p
-
@commits
.
each
do
|
commit
|
%a
{
:class
=>
"commit"
,
:href
=>
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
}
-
if
commit
.
author_email
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
-
else
=
image_tag
"no_avatar.png"
,
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%span
.update-title
=
commit
.
id
.
to_s
%span
.update-author
%strong
=
commit
.
author_name
authored
=
time_ago_in_words
(
commit
.
created_at
)
ago
.clear
#merge-notes
.issue_notes
=
render
"notes/notes"
.loading
{
:style
=>
"display:none;"
}
%center
=
image_tag
"ajax-loader.gif"
.clear
:javascript
$
(
function
(){
$
(
"
#gitlab-tabs
"
).
tabs
();
})
config/routes.rb
View file @
8803fbb5
...
...
@@ -59,7 +59,12 @@ Gitlab::Application.routes.draw do
end
end
resources
:merge_requests
resources
:merge_requests
do
member
do
get
:diffs
get
:commits
end
end
resources
:snippets
resources
:commits
resources
:team_members
...
...
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