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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
21c141af
Commit
21c141af
authored
Feb 24, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'notes_refactoring'
parents
b1a36b55
292a41cb
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
130 additions
and
81 deletions
+130
-81
app/assets/javascripts/note.js
app/assets/javascripts/note.js
+16
-11
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+7
-0
app/assets/stylesheets/notes.css.scss
app/assets/stylesheets/notes.css.scss
+18
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-12
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+0
-7
app/controllers/issues_controller.rb
app/controllers/issues_controller.rb
+1
-2
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+4
-3
app/controllers/notes_controller.rb
app/controllers/notes_controller.rb
+32
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+0
-4
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+0
-1
app/views/commits/_text_file.html.haml
app/views/commits/_text_file.html.haml
+2
-1
app/views/commits/show.html.haml
app/views/commits/show.html.haml
+2
-2
app/views/issues/show.html.haml
app/views/issues/show.html.haml
+1
-2
app/views/issues/show.js.haml
app/views/issues/show.js.haml
+0
-1
app/views/merge_requests/show.html.haml
app/views/merge_requests/show.html.haml
+13
-4
app/views/notes/_create_common.js.haml
app/views/notes/_create_common.js.haml
+9
-0
app/views/notes/_create_line.js.haml
app/views/notes/_create_line.js.haml
+8
-0
app/views/notes/_notes.html.haml
app/views/notes/_notes.html.haml
+4
-2
app/views/notes/_reply_button.html.haml
app/views/notes/_reply_button.html.haml
+3
-0
app/views/notes/_show.html.haml
app/views/notes/_show.html.haml
+1
-1
app/views/notes/create.js.haml
app/views/notes/create.js.haml
+5
-15
app/views/notes/index.js.haml
app/views/notes/index.js.haml
+0
-0
app/views/projects/wall.html.haml
app/views/projects/wall.html.haml
+1
-5
app/views/projects/wall.js.haml
app/views/projects/wall.js.haml
+0
-1
app/views/snippets/show.html.haml
app/views/snippets/show.html.haml
+1
-4
config/routes.rb
config/routes.rb
+1
-1
spec/requests/projects_wall_spec.rb
spec/requests/projects_wall_spec.rb
+1
-1
No files found.
app/assets/javascripts/note.js
View file @
21c141af
var
NoteList
=
{
var
NoteList
=
{
notes_path
:
null
,
target_params
:
null
,
target_id
:
0
,
target_type
:
null
,
first_id
:
0
,
first_id
:
0
,
last_id
:
0
,
last_id
:
0
,
resource_name
:
null
,
disable
:
false
,
disable
:
false
,
init
:
init
:
function
(
resource_name
,
first_id
,
last_id
)
{
function
(
tid
,
tt
,
path
)
{
this
.
resource_name
=
resource_name
;
this
.
notes_path
=
path
+
"
.js
"
;
this
.
first_id
=
first_id
;
this
.
target_id
=
tid
;
this
.
last_id
=
last_id
;
this
.
target_type
=
tt
;
this
.
target_params
=
"
&target_type=
"
+
this
.
target_type
+
"
&target_id=
"
+
this
.
target_id
this
.
refresh
();
this
.
initRefresh
();
this
.
initRefresh
();
this
.
initLoadMore
();
this
.
initLoadMore
();
},
},
...
@@ -19,8 +24,8 @@ getOld:
...
@@ -19,8 +24,8 @@ getOld:
$
(
'
.loading
'
).
show
();
$
(
'
.loading
'
).
show
();
$
.
ajax
({
$
.
ajax
({
type
:
"
GET
"
,
type
:
"
GET
"
,
url
:
location
.
href
,
url
:
this
.
notes_path
,
data
:
"
first_id=
"
+
this
.
first_id
,
data
:
"
first_id=
"
+
this
.
first_id
+
this
.
target_params
,
complete
:
function
(){
$
(
'
.loading
'
).
hide
()},
complete
:
function
(){
$
(
'
.loading
'
).
hide
()},
dataType
:
"
script
"
});
dataType
:
"
script
"
});
},
},
...
@@ -56,8 +61,8 @@ getNew:
...
@@ -56,8 +61,8 @@ getNew:
// refersh notes list
// refersh notes list
$
.
ajax
({
$
.
ajax
({
type
:
"
GET
"
,
type
:
"
GET
"
,
url
:
location
.
href
,
url
:
this
.
notes_path
,
data
:
"
last_id=
"
+
this
.
last_id
,
data
:
"
last_id=
"
+
this
.
last_id
+
this
.
target_params
,
dataType
:
"
script
"
});
dataType
:
"
script
"
});
},
},
...
@@ -66,8 +71,8 @@ refresh:
...
@@ -66,8 +71,8 @@ refresh:
// refersh notes list
// refersh notes list
$
.
ajax
({
$
.
ajax
({
type
:
"
GET
"
,
type
:
"
GET
"
,
url
:
location
.
href
,
url
:
this
.
notes_path
,
data
:
"
first_id=
"
+
this
.
first_id
+
"
&last_id=
"
+
this
.
last_id
,
data
:
"
first_id=
"
+
this
.
first_id
+
"
&last_id=
"
+
this
.
last_id
+
this
.
target_params
,
dataType
:
"
script
"
});
dataType
:
"
script
"
});
},
},
...
...
app/assets/stylesheets/common.scss
View file @
21c141af
...
@@ -374,3 +374,10 @@ table a code {
...
@@ -374,3 +374,10 @@ table a code {
.btn.padded
{
.btn.padded
{
margin-right
:
3px
;
margin-right
:
3px
;
}
}
.loading
{
margin
:
20px
auto
;
background
:
url(ajax-loader-facebook.gif)
no-repeat
center
center
;
width
:
40px
;
height
:
40px
;
}
app/assets/stylesheets/notes.css.scss
View file @
21c141af
...
@@ -30,7 +30,10 @@
...
@@ -30,7 +30,10 @@
}
}
}
}
.note
.delete-note
{
display
:none
;
}
.note
.delete-note
{
display
:none
;
float
:right
;
}
.note
:hover
.delete-note
{
display
:block
;
}
.note
:hover
.delete-note
{
display
:block
;
}
.note
{
padding
:
10px
0
;
border-bottom
:
1px
solid
#eee
;
overflow
:
hidden
;
display
:
block
;}
.note
{
padding
:
10px
0
;
border-bottom
:
1px
solid
#eee
;
overflow
:
hidden
;
display
:
block
;}
.note
img
{
float
:
left
;
margin-right
:
10px
;}
.note
img
{
float
:
left
;
margin-right
:
10px
;}
...
@@ -53,6 +56,20 @@ p.notify_controls span{
...
@@ -53,6 +56,20 @@ p.notify_controls span{
tr
.line_notes_row
{
tr
.line_notes_row
{
border-bottom
:
1px
solid
#DDD
;
border-bottom
:
1px
solid
#DDD
;
&
.reply
{
background
:
#eee
;
td
{
padding
:
7px
10px
;
}
a
.line_note_reply_link
{
@include
round-borders-all
(
4px
);
border-color
:
#aaa
;
background
:
#bbb
;
padding
:
3px
20px
;
color
:
white
;
}
}
ul
{
ul
{
margin
:
0
;
margin
:
0
;
li
{
li
{
...
...
app/controllers/application_controller.rb
View file @
21c141af
...
@@ -95,18 +95,6 @@ class ApplicationController < ActionController::Base
...
@@ -95,18 +95,6 @@ class ApplicationController < ActionController::Base
redirect_to
@project
unless
@project
.
repo_exists?
&&
@project
.
has_commits?
redirect_to
@project
unless
@project
.
repo_exists?
&&
@project
.
has_commits?
end
end
def
respond_with_notes
if
params
[
:last_id
]
&&
params
[
:first_id
]
@notes
=
@notes
.
where
(
"id >= ?"
,
params
[
:first_id
])
elsif
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
elsif
params
[
:first_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
else
nil
end
end
def
no_cache_headers
def
no_cache_headers
response
.
headers
[
"Cache-Control"
]
=
"no-cache, no-store, max-age=0, must-revalidate"
response
.
headers
[
"Cache-Control"
]
=
"no-cache, no-store, max-age=0, must-revalidate"
response
.
headers
[
"Pragma"
]
=
"no-cache"
response
.
headers
[
"Pragma"
]
=
"no-cache"
...
...
app/controllers/commits_controller.rb
View file @
21c141af
...
@@ -29,16 +29,9 @@ class CommitsController < ApplicationController
...
@@ -29,16 +29,9 @@ class CommitsController < ApplicationController
git_not_found!
and
return
unless
@commit
git_not_found!
and
return
unless
@commit
@notes
=
project
.
commit_notes
(
@commit
).
fresh
.
limit
(
20
)
@note
=
@project
.
build_commit_note
(
@commit
)
@note
=
@project
.
build_commit_note
(
@commit
)
@comments_allowed
=
true
@comments_allowed
=
true
@line_notes
=
project
.
commit_line_notes
(
@commit
)
@line_notes
=
project
.
commit_line_notes
(
@commit
)
respond_to
do
|
format
|
format
.
html
format
.
js
{
respond_with_notes
}
end
end
end
def
compare
def
compare
...
...
app/controllers/issues_controller.rb
View file @
21c141af
...
@@ -49,7 +49,6 @@ class IssuesController < ApplicationController
...
@@ -49,7 +49,6 @@ class IssuesController < ApplicationController
end
end
def
show
def
show
@notes
=
@issue
.
notes
.
inc_author
.
order
(
"created_at DESC"
).
limit
(
20
)
@note
=
@project
.
notes
.
new
(
:noteable
=>
@issue
)
@note
=
@project
.
notes
.
new
(
:noteable
=>
@issue
)
@commits
=
if
@issue
.
branch_name
&&
@project
.
repo
.
heads
.
map
(
&
:name
).
include?
(
@issue
.
branch_name
)
@commits
=
if
@issue
.
branch_name
&&
@project
.
repo
.
heads
.
map
(
&
:name
).
include?
(
@issue
.
branch_name
)
...
@@ -61,7 +60,7 @@ class IssuesController < ApplicationController
...
@@ -61,7 +60,7 @@ class IssuesController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
{
respond_with_notes
}
format
.
js
end
end
end
end
...
...
app/controllers/merge_requests_controller.rb
View file @
21c141af
...
@@ -39,7 +39,6 @@ class MergeRequestsController < ApplicationController
...
@@ -39,7 +39,6 @@ class MergeRequestsController < ApplicationController
git_not_found!
and
return
git_not_found!
and
return
end
end
@notes
=
@merge_request
.
notes
.
inc_author
.
order
(
"created_at DESC"
).
limit
(
20
)
@note
=
@project
.
notes
.
new
(
:noteable
=>
@merge_request
)
@note
=
@project
.
notes
.
new
(
:noteable
=>
@merge_request
)
@commits
=
@project
.
repo
.
@commits
=
@project
.
repo
.
...
@@ -52,14 +51,16 @@ class MergeRequestsController < ApplicationController
...
@@ -52,14 +51,16 @@ class MergeRequestsController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
{
respond_with_notes
}
format
.
js
end
end
end
end
def
diffs
def
diffs
@diffs
=
@merge_request
.
diffs
@diffs
=
@merge_request
.
diffs
@commit
=
@merge_request
.
last_commit
@commit
=
@merge_request
.
last_commit
@line_notes
=
[]
@comments_allowed
=
true
@line_notes
=
@merge_request
.
notes
.
where
(
"line_code is not null"
)
end
end
def
new
def
new
...
...
app/controllers/notes_controller.rb
View file @
21c141af
...
@@ -9,6 +9,25 @@ class NotesController < ApplicationController
...
@@ -9,6 +9,25 @@ class NotesController < ApplicationController
respond_to
:js
respond_to
:js
def
index
@notes
=
case
params
[
:target_type
]
when
"commit"
then
project
.
commit_notes
(
project
.
commit
((
params
[
:target_id
]))).
fresh
.
limit
(
20
)
when
"snippet"
then
project
.
snippets
.
find
(
params
[
:target_id
]).
notes
when
"wall"
then
project
.
common_notes
.
order
(
"created_at DESC"
).
fresh
.
limit
(
20
)
when
"issue"
then
project
.
issues
.
find
(
params
[
:target_id
]).
notes
.
inc_author
.
order
(
"created_at DESC"
).
limit
(
20
)
when
"merge_request"
then
project
.
merge_requests
.
find
(
params
[
:target_id
]).
notes
.
inc_author
.
order
(
"created_at DESC"
).
limit
(
20
)
end
respond_to
do
|
format
|
format
.
js
{
respond_with_notes
}
end
end
def
create
def
create
@note
=
@project
.
notes
.
new
(
params
[
:note
])
@note
=
@project
.
notes
.
new
(
params
[
:note
])
@note
.
author
=
current_user
@note
.
author
=
current_user
...
@@ -34,4 +53,17 @@ class NotesController < ApplicationController
...
@@ -34,4 +53,17 @@ class NotesController < ApplicationController
end
end
end
end
protected
def
respond_with_notes
if
params
[
:last_id
]
&&
params
[
:first_id
]
@notes
=
@notes
.
where
(
"id >= ?"
,
params
[
:first_id
])
elsif
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
elsif
params
[
:first_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
else
nil
end
end
end
end
app/controllers/projects_controller.rb
View file @
21c141af
...
@@ -82,14 +82,10 @@ class ProjectsController < ApplicationController
...
@@ -82,14 +82,10 @@ class ProjectsController < ApplicationController
def
wall
def
wall
return
render_404
unless
@project
.
wall_enabled
return
render_404
unless
@project
.
wall_enabled
@note
=
Note
.
new
@note
=
Note
.
new
@notes
=
@project
.
common_notes
.
order
(
"created_at DESC"
)
@notes
=
@notes
.
fresh
.
limit
(
20
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
{
respond_with_notes
}
end
end
end
end
...
...
app/controllers/snippets_controller.rb
View file @
21c141af
...
@@ -55,7 +55,6 @@ class SnippetsController < ApplicationController
...
@@ -55,7 +55,6 @@ class SnippetsController < ApplicationController
end
end
def
show
def
show
@notes
=
@snippet
.
notes
@note
=
@project
.
notes
.
new
(
:noteable
=>
@snippet
)
@note
=
@project
.
notes
.
new
(
:noteable
=>
@snippet
)
render_full_content
render_full_content
end
end
...
...
app/views/commits/_text_file.html.haml
View file @
21c141af
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
-
if
@comments_allowed
-
if
@comments_allowed
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
}.
sort_by
(
&
:created_at
).
reverse
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
}.
sort_by
(
&
:created_at
).
reverse
-
unless
comments
.
empty?
-
unless
comments
.
empty?
-
comments
.
each
do
|
note
|
-
comments
.
each_with_index
do
|
note
,
i
|
=
render
"notes/reply_button"
,
:line_code
=>
line_code
if
i
.
zero?
=
render
"notes/per_line_show"
,
:note
=>
note
=
render
"notes/per_line_show"
,
:note
=>
note
-
@line_notes
.
reject!
{
|
n
|
n
==
note
}
-
@line_notes
.
reject!
{
|
n
|
n
==
note
}
app/views/commits/show.html.haml
View file @
21c141af
...
@@ -21,13 +21,13 @@
...
@@ -21,13 +21,13 @@
%p
.cgray
%p
.cgray
Showing
#{
pluralize
(
@commit
.
diffs
.
count
,
"changed file"
)
}
Showing
#{
pluralize
(
@commit
.
diffs
.
count
,
"changed file"
)
}
=
render
"commits/diffs"
,
:diffs
=>
@commit
.
diffs
=
render
"commits/diffs"
,
:diffs
=>
@commit
.
diffs
=
render
"notes/notes"
=
render
"notes/notes"
,
:tid
=>
@commit
.
id
,
:tt
=>
"commit"
=
render
"notes/per_line_form"
=
render
"notes/per_line_form"
:javascript
:javascript
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
$
(
"
.line_note_link
"
).
live
(
"
click
"
,
function
(
e
)
{
$
(
"
.line_note_link
, .line_note_reply_link
"
).
live
(
"
click
"
,
function
(
e
)
{
var
form
=
$
(
"
.per_line_form
"
);
var
form
=
$
(
"
.per_line_form
"
);
$
(
this
).
parent
().
parent
().
after
(
form
);
$
(
this
).
parent
().
parent
().
after
(
form
);
form
.
find
(
"
#note_line_code
"
).
val
(
$
(
this
).
attr
(
"
line_code
"
));
form
.
find
(
"
#note_line_code
"
).
val
(
$
(
this
).
attr
(
"
line_code
"
));
...
...
app/views/issues/show.html.haml
View file @
21c141af
...
@@ -41,5 +41,4 @@
...
@@ -41,5 +41,4 @@
%div
=
simple_format
@issue
.
title
%div
=
simple_format
@issue
.
title
.issue_notes
=
render
"notes/notes"
.issue_notes
=
render
"notes/notes"
,
:tid
=>
@issue
.
id
,
:tt
=>
"issue"
app/views/issues/show.js.haml
deleted
100644 → 0
View file @
b1a36b55
=
render
"notes/load"
app/views/merge_requests/show.html.haml
View file @
21c141af
...
@@ -63,10 +63,7 @@
...
@@ -63,10 +63,7 @@
%img
{
:src
=>
"/assets/ajax-loader-facebook.gif"
,
:class
=>
"dashboard-loader"
}
%img
{
:src
=>
"/assets/ajax-loader-facebook.gif"
,
:class
=>
"dashboard-loader"
}
.merge-request-notes
.merge-request-notes
.merge_request_notes
=
render
"notes/notes"
.merge_request_notes
=
render
"notes/notes"
,
:tid
=>
@merge_request
.
id
,
:tt
=>
"merge_request"
.loading
{
:style
=>
"display:none;"
}
%center
=
image_tag
"ajax-loader.gif"
.clear
.merge-request-diffs
.merge-request-diffs
...
@@ -75,3 +72,15 @@
...
@@ -75,3 +72,15 @@
$
(
function
(){
$
(
function
(){
MergeRequest
.
init
();
MergeRequest
.
init
();
})
})
=
render
"notes/per_line_form"
:javascript
$
(
document
).
ready
(
function
(){
$
(
"
.line_note_link, .line_note_reply_link
"
).
live
(
"
click
"
,
function
(
e
)
{
var
form
=
$
(
"
.per_line_form
"
);
$
(
this
).
parent
().
parent
().
after
(
form
);
form
.
find
(
"
#note_line_code
"
).
val
(
$
(
this
).
attr
(
"
line_code
"
));
form
.
show
();
return
false
;
});
});
app/views/notes/_create_common.js.haml
0 → 100644
View file @
21c141af
-
if
note
.
valid?
:plain
$("#new_note .errors").remove();
$('#new_note textarea').val("");
NoteList.prepend(
#{
note
.
id
}
, "
#{
escape_javascript
(
render
:partial
=>
"notes/show"
,
:locals
=>
{
:note
=>
note
})
}
");
-
else
:plain
$("#new_note").replaceWith("
#{
escape_javascript
(
render
(
'form'
))
}
");
app/views/notes/_create_line.js.haml
0 → 100644
View file @
21c141af
-
if
note
.
valid?
:plain
$(".per_line_form").hide();
$('#new_note textarea').val("");
$("a.line_note_reply_link[line_code='
#{
note
.
line_code
}
']").closest("tr").remove();
var trEl = $(".
#{
note
.
line_code
}
").parent();
trEl.after("
#{
escape_javascript
(
render
:partial
=>
"notes/per_line_show"
,
:locals
=>
{
:note
=>
note
})
}
");
trEl.after("
#{
escape_javascript
(
render
:partial
=>
"notes/reply_button"
,
:locals
=>
{
:line_code
=>
note
.
line_code
})
}
");
app/views/notes/_notes.html.haml
View file @
21c141af
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
=
render
"notes/form"
=
render
"notes/form"
.clear
.clear
%hr
%hr
%ul
#notes-list
=
render
"notes/notes_list"
%ul
#notes-list
.loading
:javascript
:javascript
$
(
'
.delete-note
'
).
live
(
'
ajax:success
'
,
function
()
{
$
(
'
.delete-note
'
).
live
(
'
ajax:success
'
,
function
()
{
...
@@ -22,5 +24,5 @@
...
@@ -22,5 +24,5 @@
$
(
'
.attach_holder
'
).
show
();
$
(
'
.attach_holder
'
).
show
();
});
});
NoteList
.
init
(
"
wall
"
,
#{
@notes
.
last
.
try
(
:id
)
||
0
}
,
#{
@notes
.
first
.
try
(
:id
)
||
0
}
);
NoteList
.
init
(
"
#{
tid
}
"
,
"
#{
tt
}
"
,
"
#{
project_notes_path
(
@project
)
}
"
);
});
});
app/views/notes/_reply_button.html.haml
0 → 100644
View file @
21c141af
%tr
.line_notes_row.reply
%td
{
:colspan
=>
3
}
=
link_to
"Reply"
,
"#"
,
:class
=>
"line_note_reply_link"
,
"line_code"
=>
line_code
,
:title
=>
"Add note for this line"
app/views/notes/_show.html.haml
View file @
21c141af
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
=
time_ago_in_words
(
note
.
updated_at
)
=
time_ago_in_words
(
note
.
updated_at
)
ago
ago
-
if
(
note
.
author_id
==
current_user
.
id
)
||
can?
(
current_user
,
:admin_note
,
@project
)
-
if
(
note
.
author_id
==
current_user
.
id
)
||
can?
(
current_user
,
:admin_note
,
@project
)
=
link_to
"Remove"
,
[
@project
,
note
],
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
,
:remote
=>
true
,
:class
=>
"cred delete-note right
"
%strong
=
link_to
"Remove"
,
[
@project
,
note
],
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
,
:remote
=>
true
,
:class
=>
"cred delete-note btn small
"
%div
.note-title
%div
.note-title
=
markdown
(
note
.
note
)
=
markdown
(
note
.
note
)
...
...
app/views/notes/create.js.haml
View file @
21c141af
-
if
@note
.
valid?
-
if
@note
.
line_code
-
if
@note
.
line_code
=
render
"create_line"
,
:note
=>
@note
:plain
-
else
$(".per_line_form").hide();
=
render
"create_common"
,
:note
=>
@note
$('#new_note textarea').val("");
$(".
#{
@note
.
line_code
}
").parent().after("
#{
escape_javascript
(
render
:partial
=>
"notes/per_line_show"
,
:locals
=>
{
:note
=>
@note
})
}
");
-
else
:plain
$("#new_note .errors").remove();
$('#new_note textarea').val("");
NoteList.prepend(
#{
@note
.
id
}
, "
#{
escape_javascript
(
render
:partial
=>
"notes/show"
,
:locals
=>
{
:note
=>
@note
})
}
");
-
else
-
unless
@note
.
line_code
:plain
$("#new_note").replaceWith("
#{
escape_javascript
(
render
(
'form'
))
}
");
-# Enable submit button
:plain
:plain
$("#submit_note").removeAttr("disabled");
$("#submit_note").removeAttr("disabled");
app/views/
commits/show
.js.haml
→
app/views/
notes/index
.js.haml
View file @
21c141af
File moved
app/views/projects/wall.html.haml
View file @
21c141af
%div
.wall_page
%div
.wall_page
=
render
"notes/notes"
=
render
"notes/notes"
,
:tid
=>
nil
,
:tt
=>
"wall"
.loading
{
:style
=>
"display:none;"
}
%center
=
image_tag
"ajax-loader.gif"
app/views/projects/wall.js.haml
deleted
100644 → 0
View file @
b1a36b55
=
render
"notes/load"
app/views/snippets/show.html.haml
View file @
21c141af
...
@@ -14,8 +14,5 @@
...
@@ -14,8 +14,5 @@
.data.no-padding
.data.no-padding
:erb
:erb
<%=
raw
@snippet
.
colorize
%>
<%=
raw
@snippet
.
colorize
%>
.clear
%br
.snippet_notes
=
render
"notes/notes"
.clear
=
render
"notes/notes"
,
:tid
=>
@snippet
.
id
,
:tt
=>
"snippet"
config/routes.rb
View file @
21c141af
...
@@ -121,7 +121,7 @@ Gitlab::Application.routes.draw do
...
@@ -121,7 +121,7 @@ Gitlab::Application.routes.draw do
get
:search
get
:search
end
end
end
end
resources
:notes
,
:only
=>
[
:create
,
:destroy
]
resources
:notes
,
:only
=>
[
:
index
,
:
create
,
:destroy
]
end
end
root
:to
=>
"projects#index"
root
:to
=>
"projects#index"
end
end
spec/requests/projects_wall_spec.rb
View file @
21c141af
...
@@ -8,7 +8,7 @@ describe "Projects", "Wall" do
...
@@ -8,7 +8,7 @@ describe "Projects", "Wall" do
project
.
add_access
(
@user
,
:read
,
:write
)
project
.
add_access
(
@user
,
:read
,
:write
)
end
end
describe
"View notes on wall"
do
describe
"View notes on wall"
,
:js
=>
true
do
before
do
before
do
Factory
:note
,
:project
=>
project
,
:note
=>
"Project specs"
,
:author
=>
@user
Factory
:note
,
:project
=>
project
,
:note
=>
"Project specs"
,
:author
=>
@user
visit
wall_project_path
(
project
)
visit
wall_project_path
(
project
)
...
...
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