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
Léo-Paul Géneau
gitlab-ce
Commits
9da4d06a
Commit
9da4d06a
authored
Jan 10, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
per line comments display
parent
c66bc99f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
78 additions
and
2 deletions
+78
-2
app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss
+28
-0
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+2
-0
app/models/note.rb
app/models/note.rb
+17
-0
app/models/project.rb
app/models/project.rb
+5
-1
app/views/commits/_text_file.html.haml
app/views/commits/_text_file.html.haml
+7
-0
db/migrate/20120110180749_add_line_number_to_note.rb
db/migrate/20120110180749_add_line_number_to_note.rb
+5
-0
db/schema.rb
db/schema.rb
+14
-1
No files found.
app/assets/stylesheets/projects.css.scss
View file @
9da4d06a
...
...
@@ -693,3 +693,31 @@ a.project-update.titled {
top
:
0
;
}
}
tr
.line_notes_row
{
&
:hover
{
background
:none
;
}
td
{
margin
:
0px
;
padding
:
0px
;
border-bottom
:
1px
solid
#DEE2E3
;
ul
{
display
:block
;
list-style
:none
;
margin
:
0px
;
padding
:
0px
;
li
{
border-top
:
1px
solid
#DEE2E3
;
padding
:
10px
;
.delete-note
{
display
:none
;
}
}
}
}
}
app/controllers/commits_controller.rb
View file @
9da4d06a
...
...
@@ -27,6 +27,8 @@ class CommitsController < ApplicationController
@notes
=
project
.
commit_notes
(
@commit
).
fresh
.
limit
(
20
)
@note
=
@project
.
build_commit_note
(
@commit
)
@line_notes
=
project
.
commit_line_notes
(
@commit
)
respond_to
do
|
format
|
format
.
html
format
.
js
{
respond_with_notes
}
...
...
app/models/note.rb
View file @
9da4d06a
...
...
@@ -53,6 +53,23 @@ class Note < ActiveRecord::Base
noteable
end
end
def
line_file_id
@line_file_id
||=
line_code
.
split
(
"_"
)[
1
].
to_i
if
line_code
end
def
line_type_id
@line_type_id
||=
line_code
.
split
(
"_"
).
first
if
line_code
end
def
line_number
@line_number
||=
line_code
.
split
(
"_"
).
last
.
to_i
if
line_code
end
def
for_line?
(
file_id
,
old_line
,
new_line
)
line_file_id
==
file_id
&&
((
line_type_id
==
"NEW"
&&
line_number
==
new_line
)
||
(
line_type_id
==
"OLD"
&&
line_number
==
old_line
))
end
end
# == Schema Information
#
...
...
app/models/project.rb
View file @
9da4d06a
...
...
@@ -166,7 +166,11 @@ class Project < ActiveRecord::Base
end
def
commit_notes
(
commit
)
notes
.
where
(
:noteable_id
=>
commit
.
id
,
:noteable_type
=>
"Commit"
)
notes
.
where
(
:noteable_id
=>
commit
.
id
,
:noteable_type
=>
"Commit"
,
:line_code
=>
nil
)
end
def
commit_line_notes
(
commit
)
notes
.
where
(
:noteable_id
=>
commit
.
id
,
:noteable_type
=>
"Commit"
).
where
(
"line_code not null"
)
end
def
has_commits?
...
...
app/views/commits/_text_file.html.haml
View file @
9da4d06a
...
...
@@ -19,6 +19,13 @@
%td
.new_line
=
link_to
raw
(
diff_line_class
(
line
)
==
"old"
?
" "
:
line_new
)
,
"#NEW
#{
index
}
-
#{
line_new
}
"
,
:id
=>
"NEW
#{
index
}
-
#{
line_new
}
"
%td
.line_content
{
:class
=>
diff_line_class
(
full_line
)}=
raw
"
#{
full_line
}
"
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
for_line?
(
index
,
line_old
,
line_new
)
}.
sort_by
(
&
:created_at
).
reverse
-
unless
comments
.
empty?
%tr
.line_notes_row
%td
{
:colspan
=>
3
}
%ul
-
comments
.
each
do
|
note
|
=
render
:partial
=>
"notes/show"
,
:locals
=>
{
:note
=>
note
}
-
if
line
[
0
]
==
"+"
-
line_new
+=
1
-
elsif
line
[
0
]
==
"-"
...
...
db/migrate/20120110180749_add_line_number_to_note.rb
0 → 100644
View file @
9da4d06a
class
AddLineNumberToNote
<
ActiveRecord
::
Migration
def
change
add_column
:notes
,
:line_code
,
:string
,
:null
=>
true
end
end
db/schema.rb
View file @
9da4d06a
...
...
@@ -11,7 +11,19 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
20111220190817
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
20120110180749
)
do
create_table
"features"
,
:force
=>
true
do
|
t
|
t
.
string
"name"
t
.
string
"branch_name"
t
.
integer
"assignee_id"
t
.
integer
"author_id"
t
.
integer
"project_id"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"version"
t
.
integer
"status"
,
:default
=>
0
,
:null
=>
false
end
create_table
"issues"
,
:force
=>
true
do
|
t
|
t
.
string
"title"
...
...
@@ -56,6 +68,7 @@ ActiveRecord::Schema.define(:version => 20111220190817) do
t
.
datetime
"updated_at"
t
.
integer
"project_id"
t
.
string
"attachment"
t
.
string
"line_code"
end
create_table
"projects"
,
:force
=>
true
do
|
t
|
...
...
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