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
iv
gitlab-ce
Commits
0546b9c6
Commit
0546b9c6
authored
Sep 15, 2012
by
randx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'riyad-change-notes-order'
parents
a82977c6
348def03
Changes
34
Show whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
397 additions
and
264 deletions
+397
-264
app/assets/javascripts/note.js
app/assets/javascripts/note.js
+0
-182
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+251
-0
app/assets/stylesheets/sections/notes.scss
app/assets/stylesheets/sections/notes.scss
+19
-5
app/contexts/notes/load_context.rb
app/contexts/notes/load_context.rb
+17
-16
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+9
-0
app/models/note.rb
app/models/note.rb
+1
-1
app/models/project.rb
app/models/project.rb
+4
-0
app/models/wiki.rb
app/models/wiki.rb
+0
-1
app/views/commits/_text_file.html.haml
app/views/commits/_text_file.html.haml
+3
-6
app/views/commits/show.html.haml
app/views/commits/show.html.haml
+1
-1
app/views/issues/show.html.haml
app/views/issues/show.html.haml
+1
-1
app/views/merge_requests/_show.html.haml
app/views/merge_requests/_show.html.haml
+1
-1
app/views/merge_requests/diffs.html.haml
app/views/merge_requests/diffs.html.haml
+4
-0
app/views/merge_requests/diffs.js.haml
app/views/merge_requests/diffs.js.haml
+3
-0
app/views/merge_requests/show.js.haml
app/views/merge_requests/show.js.haml
+1
-1
app/views/notes/_common_form.html.haml
app/views/notes/_common_form.html.haml
+0
-0
app/views/notes/_create_common_note.js.haml
app/views/notes/_create_common_note.js.haml
+3
-2
app/views/notes/_create_line.js.haml
app/views/notes/_create_line.js.haml
+0
-8
app/views/notes/_create_per_line_note.js.haml
app/views/notes/_create_per_line_note.js.haml
+19
-0
app/views/notes/_load.js.haml
app/views/notes/_load.js.haml
+0
-17
app/views/notes/_note.html.haml
app/views/notes/_note.html.haml
+0
-0
app/views/notes/_notes.html.haml
app/views/notes/_notes.html.haml
+3
-12
app/views/notes/_notes_list.html.haml
app/views/notes/_notes_list.html.haml
+0
-4
app/views/notes/_notes_with_form.html.haml
app/views/notes/_notes_with_form.html.haml
+11
-0
app/views/notes/_per_line_note.html.haml
app/views/notes/_per_line_note.html.haml
+5
-0
app/views/notes/_per_line_note_link.html.haml
app/views/notes/_per_line_note_link.html.haml
+1
-0
app/views/notes/_per_line_notes_with_reply.html.haml
app/views/notes/_per_line_notes_with_reply.html.haml
+3
-0
app/views/notes/_per_line_reply_button.html.haml
app/views/notes/_per_line_reply_button.html.haml
+4
-0
app/views/notes/_reversed_notes_with_form.html.haml
app/views/notes/_reversed_notes_with_form.html.haml
+11
-0
app/views/notes/create.js.haml
app/views/notes/create.js.haml
+2
-2
app/views/notes/index.js.haml
app/views/notes/index.js.haml
+17
-1
app/views/projects/wall.html.haml
app/views/projects/wall.html.haml
+1
-1
app/views/snippets/show.html.haml
app/views/snippets/show.html.haml
+1
-1
app/views/wikis/show.html.haml
app/views/wikis/show.html.haml
+1
-1
No files found.
app/assets/javascripts/note.js
deleted
100644 → 0
View file @
a82977c6
var
NoteList
=
{
notes_path
:
null
,
target_params
:
null
,
target_id
:
0
,
target_type
:
null
,
first_id
:
0
,
last_id
:
0
,
disable
:
false
,
init
:
function
(
tid
,
tt
,
path
)
{
this
.
notes_path
=
path
+
"
.js
"
;
this
.
target_id
=
tid
;
this
.
target_type
=
tt
;
this
.
target_params
=
"
&target_type=
"
+
this
.
target_type
+
"
&target_id=
"
+
this
.
target_id
;
// get notes
this
.
getContent
();
// get new notes every n seconds
this
.
initRefresh
();
$
(
'
.delete-note
'
).
live
(
'
ajax:success
'
,
function
()
{
$
(
this
).
closest
(
'
li
'
).
fadeOut
();
});
$
(
"
.note-form-holder
"
).
live
(
"
ajax:before
"
,
function
(){
$
(
"
.submit_note
"
).
disable
()
})
$
(
"
.note-form-holder
"
).
live
(
"
ajax:complete
"
,
function
(){
$
(
"
.submit_note
"
).
enable
()
})
disableButtonIfEmptyField
(
"
.note-text
"
,
"
.submit_note
"
);
$
(
"
.note-text
"
).
live
(
"
focus
"
,
function
(){
$
(
this
).
css
(
"
height
"
,
"
80px
"
);
$
(
'
.note_advanced_opts
'
).
show
();
});
$
(
"
#note_attachment
"
).
change
(
function
(
e
){
var
val
=
$
(
'
.input-file
'
).
val
();
var
filename
=
val
.
replace
(
/^.*
[\\\/]
/
,
''
);
$
(
"
.file_name
"
).
text
(
filename
);
});
},
/**
* Load new notes to fresh list called 'new_notes_list':
* - Replace 'new_notes_list' with new list every n seconds
* - Append new notes to this list after submit
*/
initRefresh
:
function
()
{
// init timer
var
intNew
=
setInterval
(
"
NoteList.getNew()
"
,
10000
);
},
replace
:
function
(
html
)
{
$
(
"
#new_notes_list
"
).
html
(
html
);
},
prepend
:
function
(
id
,
html
)
{
if
(
id
!=
this
.
last_id
)
{
$
(
"
#new_notes_list
"
).
prepend
(
html
);
}
},
getNew
:
function
()
{
// refersh notes list
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
last_id=
"
+
this
.
last_id
+
this
.
target_params
,
dataType
:
"
script
"
});
},
refresh
:
function
()
{
// refersh notes list
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
first_id=
"
+
this
.
first_id
+
"
&last_id=
"
+
this
.
last_id
+
this
.
target_params
,
dataType
:
"
script
"
});
},
/**
* Init load of notes:
* 1. Get content with ajax call
* 2. Set content of notes list with loaded one
*/
getContent
:
function
()
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
?
"
+
this
.
target_params
,
complete
:
function
(){
$
(
'
.status
'
).
removeClass
(
"
loading
"
)},
beforeSend
:
function
()
{
$
(
'
.status
'
).
addClass
(
"
loading
"
)
},
dataType
:
"
script
"
});
},
setContent
:
function
(
fid
,
lid
,
html
)
{
this
.
last_id
=
lid
;
this
.
first_id
=
fid
;
$
(
"
#notes-list
"
).
html
(
html
);
// Init infinite scrolling
this
.
initLoadMore
();
},
/**
* Paging for old notes when scroll to bottom:
* 1. Init scroll events with 'initLoadMore'
* 2. Load onlder notes with 'getOld' method
* 3. append old notes to bottom of list with 'append'
*
*/
getOld
:
function
()
{
$
(
'
.loading
'
).
show
();
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
first_id=
"
+
this
.
first_id
+
this
.
target_params
,
complete
:
function
(){
$
(
'
.status
'
).
removeClass
(
"
loading
"
)},
beforeSend
:
function
()
{
$
(
'
.status
'
).
addClass
(
"
loading
"
)
},
dataType
:
"
script
"
});
},
append
:
function
(
id
,
html
)
{
if
(
this
.
first_id
==
id
)
{
this
.
disable
=
true
;
}
else
{
this
.
first_id
=
id
;
$
(
"
#notes-list
"
).
append
(
html
);
}
},
initLoadMore
:
function
()
{
$
(
document
).
endlessScroll
({
bottomPixels
:
400
,
fireDelay
:
1000
,
fireOnce
:
true
,
ceaseFire
:
function
()
{
return
NoteList
.
disable
;
},
callback
:
function
(
i
)
{
NoteList
.
getOld
();
}
});
}
};
var
PerLineNotes
=
{
init
:
function
()
{
$
(
"
.line_note_link, .line_note_reply_link
"
).
live
(
"
click
"
,
function
(
e
)
{
var
form
=
$
(
"
.per_line_form
"
);
$
(
this
).
closest
(
"
tr
"
).
after
(
form
);
form
.
find
(
"
#note_line_code
"
).
val
(
$
(
this
).
attr
(
"
line_code
"
));
form
.
show
();
return
false
;
});
disableButtonIfEmptyField
(
"
.line-note-text
"
,
"
.submit_inline_note
"
);
}
}
app/assets/javascripts/notes.js
0 → 100644
View file @
0546b9c6
var
NoteList
=
{
notes_path
:
null
,
target_params
:
null
,
target_id
:
0
,
target_type
:
null
,
top_id
:
0
,
bottom_id
:
0
,
loading_more_disabled
:
false
,
reversed
:
false
,
init
:
function
(
tid
,
tt
,
path
)
{
this
.
notes_path
=
path
+
"
.js
"
;
this
.
target_id
=
tid
;
this
.
target_type
=
tt
;
this
.
reversed
=
$
(
"
#notes-list
"
).
hasClass
(
"
reversed
"
);
this
.
target_params
=
"
&target_type=
"
+
this
.
target_type
+
"
&target_id=
"
+
this
.
target_id
;
// get initial set of notes
this
.
getContent
();
$
(
"
#notes-list, #new-notes-list
"
).
on
(
"
ajax:success
"
,
"
.delete-note
"
,
function
()
{
$
(
this
).
closest
(
'
li
'
).
fadeOut
();
});
$
(
"
.note-form-holder
"
).
on
(
"
ajax:before
"
,
function
(){
$
(
"
.submit_note
"
).
disable
()
})
$
(
"
.note-form-holder
"
).
on
(
"
ajax:complete
"
,
function
(){
$
(
"
.submit_note
"
).
enable
()
})
disableButtonIfEmptyField
(
"
.note-text
"
,
"
.submit_note
"
);
$
(
"
.note-text
"
).
on
(
"
focus
"
,
function
(){
$
(
this
).
css
(
"
height
"
,
"
80px
"
);
$
(
'
.note_advanced_opts
'
).
show
();
});
$
(
"
#note_attachment
"
).
change
(
function
(
e
){
var
val
=
$
(
'
.input-file
'
).
val
();
var
filename
=
val
.
replace
(
/^.*
[\\\/]
/
,
''
);
$
(
"
.file_name
"
).
text
(
filename
);
});
},
/**
* Handle loading the initial set of notes.
* And set up loading more notes when scrolling to the bottom of the page.
*/
/**
* Gets an inital set of notes.
*/
getContent
:
function
()
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
?
"
+
this
.
target_params
,
complete
:
function
(){
$
(
'
.notes-status
'
).
removeClass
(
"
loading
"
)},
beforeSend
:
function
()
{
$
(
'
.notes-status
'
).
addClass
(
"
loading
"
)
},
dataType
:
"
script
"
});
},
/**
* Called in response to getContent().
* Replaces the content of #notes-list with the given html.
*/
setContent
:
function
(
first_id
,
last_id
,
html
)
{
this
.
top_id
=
first_id
;
this
.
bottom_id
=
last_id
;
$
(
"
#notes-list
"
).
html
(
html
);
// init infinite scrolling
this
.
initLoadMore
();
// init getting new notes
if
(
this
.
reversed
)
{
this
.
initRefreshNew
();
}
},
/**
* Handle loading more notes when scrolling to the bottom of the page.
* The id of the last note in the list is in this.bottom_id.
*
* Set up refreshing only new notes after all notes have been loaded.
*/
/**
* Initializes loading more notes when scrolling to the bottom of the page.
*/
initLoadMore
:
function
()
{
$
(
document
).
endlessScroll
({
bottomPixels
:
400
,
fireDelay
:
1000
,
fireOnce
:
true
,
ceaseFire
:
function
()
{
return
NoteList
.
loading_more_disabled
;
},
callback
:
function
(
i
)
{
NoteList
.
getMore
();
}
});
},
/**
* Gets an additional set of notes.
*/
getMore
:
function
()
{
// only load more notes if there are no "new" notes
$
(
'
.loading
'
).
show
();
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
loading_more=1&
"
+
(
this
.
reversed
?
"
before_id
"
:
"
after_id
"
)
+
"
=
"
+
this
.
bottom_id
+
this
.
target_params
,
complete
:
function
(){
$
(
'
.notes-status
'
).
removeClass
(
"
loading
"
)},
beforeSend
:
function
()
{
$
(
'
.notes-status
'
).
addClass
(
"
loading
"
)
},
dataType
:
"
script
"
});
},
/**
* Called in response to getMore().
* Append notes to #notes-list.
*/
appendMoreNotes
:
function
(
id
,
html
)
{
if
(
id
!=
this
.
bottom_id
)
{
this
.
bottom_id
=
id
;
$
(
"
#notes-list
"
).
append
(
html
);
}
},
/**
* Called in response to getMore().
* Disables loading more notes when scrolling to the bottom of the page.
* Initalizes refreshing new notes.
*/
finishedLoadingMore
:
function
()
{
this
.
loading_more_disabled
=
true
;
// from now on only get new notes
if
(
!
this
.
reversed
)
{
this
.
initRefreshNew
();
}
},
/**
* Handle refreshing and adding of new notes.
*
* New notes are all notes that are created after the site has been loaded.
* The "old" notes are in #notes-list the "new" ones will be in #new-notes-list.
* The id of the last "old" note is in this.bottom_id.
*/
/**
* Initializes getting new notes every n seconds.
*/
initRefreshNew
:
function
()
{
setInterval
(
"
NoteList.getNew()
"
,
10000
);
},
/**
* Gets the new set of notes.
*/
getNew
:
function
()
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
loading_new=1&after_id=
"
+
(
this
.
reversed
?
this
.
top_id
:
this
.
bottom_id
)
+
this
.
target_params
,
dataType
:
"
script
"
});
},
/**
* Called in response to getNew().
* Replaces the content of #new-notes-list with the given html.
*/
replaceNewNotes
:
function
(
html
)
{
$
(
"
#new-notes-list
"
).
html
(
html
);
},
/**
* Adds a single note to #new-notes-list.
*/
appendNewNote
:
function
(
id
,
html
)
{
if
(
this
.
reversed
)
{
$
(
"
#new-notes-list
"
).
prepend
(
html
);
}
else
{
$
(
"
#new-notes-list
"
).
append
(
html
);
}
}
};
var
PerLineNotes
=
{
init
:
function
()
{
/**
* Called when clicking on the "add note" or "reply" button for a diff line.
*
* Shows the note form below the line.
* Sets some hidden fields in the form.
*/
$
(
"
.diff_file_content
"
).
on
(
"
click
"
,
"
.line_note_link, .line_note_reply_link
"
,
function
(
e
)
{
var
form
=
$
(
"
.per_line_form
"
);
$
(
this
).
closest
(
"
tr
"
).
after
(
form
);
form
.
find
(
"
#note_line_code
"
).
val
(
$
(
this
).
data
(
"
lineCode
"
));
form
.
show
();
return
false
;
});
disableButtonIfEmptyField
(
"
.line-note-text
"
,
"
.submit_inline_note
"
);
/**
* Called in response to successfully deleting a note on a diff line.
*
* Removes the actual note from view.
* Removes the reply button if the last note for that line has been removed.
*/
$
(
"
.diff_file_content
"
).
on
(
"
ajax:success
"
,
"
.delete-note
"
,
function
()
{
var
trNote
=
$
(
this
).
closest
(
"
tr
"
);
trNote
.
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
// check if this is the last note for this line
// elements must really be removed for this to work reliably
var
trLine
=
trNote
.
prev
();
var
trRpl
=
trNote
.
next
();
if
(
trLine
.
hasClass
(
"
line_holder
"
)
&&
trRpl
.
hasClass
(
"
reply
"
))
{
trRpl
.
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
}
});
}
}
app/assets/stylesheets/sections/notes.scss
View file @
0546b9c6
...
...
@@ -3,15 +3,18 @@
*
*/
#notes-list
,
#new
_notes_
list
{
#new
-notes-
list
{
display
:block
;
list-style
:none
;
margin
:
0px
;
padding
:
0px
;
}
#new_notes_list
li
:last-child
{
border-bottom
:
1px
solid
#aaa
;
#new-notes-list
:not
(
.reversed
)
{
border-top
:
1px
solid
#aaa
;
}
#new-notes-list
.reversed
{
border-bottom
:
1px
solid
#ccc
;
}
.issue_notes
,
...
...
@@ -48,7 +51,6 @@
.note
{
padding
:
8px
0
;
border-bottom
:
1px
solid
#eee
;
overflow
:
hidden
;
display
:
block
;
img
{
float
:
left
;
margin-right
:
10px
;}
...
...
@@ -70,6 +72,18 @@
.delete-note
{
display
:block
;
}
}
}
#notes-list
:not
(
.reversed
)
.note
,
#new-notes-list
:not
(
.reversed
)
.note
{
border-bottom
:
1px
solid
#eee
;
}
#notes-list
.reversed
.note
,
#new-notes-list
.reversed
.note
{
border-top
:
1px
solid
#eee
;
}
.notes-status
{
margin
:
18px
;
}
p
.notify_controls
input
{
...
...
app/contexts/notes/load_context.rb
View file @
0546b9c6
...
...
@@ -3,29 +3,30 @@ module Notes
def
execute
target_type
=
params
[
:target_type
]
target_id
=
params
[
:target_id
]
first_id
=
params
[
:first
_id
]
last_id
=
params
[
:last
_id
]
after_id
=
params
[
:after
_id
]
before_id
=
params
[
:before
_id
]
@notes
=
case
target_type
when
"commit"
then
project
.
commit_notes
(
project
.
commit
(
target_id
)).
fresh
.
limit
(
20
)
when
"snippet"
then
project
.
snippets
.
find
(
target_id
).
notes
when
"wall"
then
project
.
common_notes
.
order
(
"created_at DESC"
).
fresh
.
limit
(
50
)
project
.
commit_notes
(
project
.
commit
(
target_id
)).
fresh
.
limit
(
20
)
when
"issue"
then
project
.
issues
.
find
(
target_id
).
notes
.
inc_author
.
order
(
"created_at DESC"
)
.
limit
(
20
)
project
.
issues
.
find
(
target_id
).
notes
.
inc_author
.
fresh
.
limit
(
20
)
when
"merge_request"
then
project
.
merge_requests
.
find
(
target_id
).
notes
.
inc_author
.
order
(
"created_at DESC"
).
limit
(
20
)
project
.
merge_requests
.
find
(
target_id
).
notes
.
inc_author
.
fresh
.
limit
(
20
)
when
"snippet"
project
.
snippets
.
find
(
target_id
).
notes
.
fresh
when
"wall"
# this is the only case, where the order is DESC
project
.
common_notes
.
order
(
"created_at DESC, id DESC"
).
limit
(
50
)
when
"wiki"
then
project
.
wikis
.
reverse
.
map
{
|
w
|
w
.
notes
.
fresh
}.
flatten
[
0
..
20
]
project
.
wiki_notes
.
limit
(
20
)
end
@notes
=
if
last
_id
@notes
.
where
(
"id > ?"
,
last
_id
)
elsif
first
_id
@notes
.
where
(
"id < ?"
,
first
_id
)
@notes
=
if
after
_id
@notes
.
where
(
"id > ?"
,
after
_id
)
elsif
before
_id
@notes
.
where
(
"id < ?"
,
before
_id
)
else
@notes
end
...
...
app/helpers/notes_helper.rb
0 → 100644
View file @
0546b9c6
module
NotesHelper
def
loading_more_notes?
params
[
:loading_more
].
present?
end
def
loading_new_notes?
params
[
:loading_new
].
present?
end
end
app/models/note.rb
View file @
0546b9c6
...
...
@@ -36,7 +36,7 @@ class Note < ActiveRecord::Base
scope
:today
,
where
(
"created_at >= :date"
,
date:
Date
.
today
)
scope
:last_week
,
where
(
"created_at >= :date"
,
date:
(
Date
.
today
-
7
.
days
))
scope
:since
,
lambda
{
|
day
|
where
(
"created_at >= :date"
,
date:
(
day
))
}
scope
:fresh
,
order
(
"created_at
DE
SC"
)
scope
:fresh
,
order
(
"created_at
ASC, id A
SC"
)
scope
:inc_author_project
,
includes
(
:project
,
:author
)
scope
:inc_author
,
includes
(
:author
)
...
...
app/models/project.rb
View file @
0546b9c6
...
...
@@ -171,6 +171,10 @@ class Project < ActiveRecord::Base
end
end
def
wiki_notes
Note
.
where
(
noteable_id:
wikis
.
map
(
&
:id
),
noteable_type:
'Wiki'
,
project_id:
self
.
id
)
end
def
project_id
self
.
id
end
...
...
app/models/wiki.rb
View file @
0546b9c6
...
...
@@ -28,7 +28,6 @@ class Wiki < ActiveRecord::Base
end
new_wiki
end
end
end
# == Schema Information
...
...
app/views/commits/_text_file.html.haml
View file @
0546b9c6
...
...
@@ -13,14 +13,11 @@
%td
.old_line
=
link_to
raw
(
type
==
"new"
?
" "
:
line_old
),
"#
#{
line_code
}
"
,
id:
line_code
-
if
@comments_allowed
=
link_to
""
,
"#"
,
class:
"line_note_link"
,
"line_code"
=>
line_code
,
title:
"Add note for this line"
=
render
"notes/per_line_note_link"
,
line_code:
line_code
%td
.new_line
=
link_to
raw
(
type
==
"old"
?
" "
:
line_new
)
,
"#
#{
line_code
}
"
,
id:
line_code
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
raw
"
#{
line
}
"
-
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
)
-
unless
comments
.
empty?
-
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
-
@line_notes
.
reject!
{
|
n
|
n
==
note
}
=
render
"notes/per_line_notes_with_reply"
,
notes:
comments
app/views/commits/show.html.haml
View file @
0546b9c6
=
render
"commits/commit_box"
=
render
"commits/diffs"
,
diffs:
@commit
.
diffs
=
render
"notes/notes"
,
tid:
@commit
.
id
,
tt:
"commit"
=
render
"notes/notes
_with_form
"
,
tid:
@commit
.
id
,
tt:
"commit"
=
render
"notes/per_line_form"
...
...
app/views/issues/show.html.haml
View file @
0546b9c6
...
...
@@ -61,4 +61,4 @@
=
markdown
@issue
.
description
.issue_notes
#notes
=
render
"notes/notes"
,
tid:
@issue
.
id
,
tt:
"issue"
.issue_notes
#notes
=
render
"notes/notes
_with_form
"
,
tid:
@issue
.
id
,
tt:
"issue"
app/views/merge_requests/_show.html.haml
View file @
0546b9c6
...
...
@@ -16,7 +16,7 @@
Diff
.merge_request_notes
#notes
{
class:
(
controller
.
action_name
==
'show'
)
?
""
:
"hide"
}
=
render
(
"notes/notes"
,
tid:
@merge_request
.
id
,
tt:
"merge_request"
)
=
render
(
"notes/notes
_with_form
"
,
tid:
@merge_request
.
id
,
tt:
"merge_request"
)
.merge-request-diffs
=
render
"merge_requests/show/diffs"
if
@diffs
.status
...
...
app/views/merge_requests/diffs.html.haml
View file @
0546b9c6
=
render
"show"
:javascript
$
(
function
(){
PerLineNotes
.
init
();
});
app/views/merge_requests/diffs.js.haml
View file @
0546b9c6
:plain
$(".merge-request-diffs").html("
#{
escape_javascript
(
render
(
partial:
"merge_requests/show/diffs"
))
}
");
$(function(){
PerLineNotes.init();
});
app/views/merge_requests/show.js.haml
View file @
0546b9c6
:plain
$(".merge-request-notes").html("
#{
escape_javascript
(
render
(
"notes/notes"
,
tid:
@merge_request
.
id
,
tt:
"merge_request"
)
)
}
");
$(".merge-request-notes").html("
#{
escape_javascript
(
render
notes
/
notes_with_form
", tid: @merge_request.id, tt: "
merge_request
"
)
}
");
app/views/notes/_form.html.haml
→
app/views/notes/_
common_
form.html.haml
View file @
0546b9c6
File moved
app/views/notes/_create_common.js.haml
→
app/views/notes/_create_common
_note
.js.haml
View file @
0546b9c6
...
...
@@ -5,8 +5,9 @@
$('.note-form-holder #preview-link').text('Preview');
$('.note-form-holder #preview-note').hide();
$('.note-form-holder').show();
NoteList.prepend(
#{
note
.
id
}
, "
#{
escape_javascript
(
render
partial:
"notes/show"
,
locals:
{
note:
note
})
}
");
NoteList.appendNewNote(
#{
note
.
id
}
, "
#{
escape_javascript
(
render
"notes/note"
,
note:
note
)
}
");
-
else
:plain
$(".note-form-holder").replaceWith("
#{
escape_javascript
(
render
(
'form'
)
)
}
");
$(".note-form-holder").replaceWith("
#{
escape_javascript
(
render
'form'
)
}
");
app/views/notes/_create_line.js.haml
deleted
100644 → 0
View file @
a82977c6
-
if
note
.
valid?
:plain
$(".per_line_form").hide();
$('.line-note-form-holder 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/_create_per_line_note.js.haml
0 → 100644
View file @
0546b9c6
-
if
note
.
valid?
:plain
// hide and reset the form
$(".per_line_form").hide();
$('.line-note-form-holder textarea').val("");
// find the reply button for this line
// (might not be there if this is the first note)
var trRpl = $("a.line_note_reply_link[data-line-code='
#{
note
.
line_code
}
']").closest("tr");
if (trRpl.size() == 0) {
// find the commented line ...
var trEl = $(".
#{
note
.
line_code
}
").parent();
// ... and insert the note and the reply button after it
trEl.after("
#{
escape_javascript
(
render
"notes/per_line_reply_button"
,
line_code:
note
.
line_code
)
}
");
trEl.after("
#{
escape_javascript
(
render
"notes/per_line_note"
,
note:
note
)
}
");
} else {
// instert new note before reply button
trRpl.before("
#{
escape_javascript
(
render
"notes/per_line_note"
,
note:
note
)
}
");
}
app/views/notes/_load.js.haml
deleted
100644 → 0
View file @
a82977c6
-
unless
@notes
.
blank?
-
if
params
[
:last_id
]
:plain
NoteList.replace("
#{
escape_javascript
(
render
(
partial:
'notes/notes_list'
))
}
");
-
elsif
params
[
:first_id
]
:plain
NoteList.append(
#{
@notes
.
last
.
id
}
, "
#{
escape_javascript
(
render
(
partial:
'notes/notes_list'
))
}
");
-
else
:plain
NoteList.setContent(
#{
@notes
.
last
.
id
}
,
#{
@notes
.
first
.
id
}
, "
#{
escape_javascript
(
render
(
partial:
'notes/notes_list'
))
}
");
-
else
-
if
params
[
:first_id
]
:plain
NoteList.append(
#{
params
[
:first_id
]
}
, "");
app/views/notes/_
show
.html.haml
→
app/views/notes/_
note
.html.haml
View file @
0546b9c6
File moved
app/views/notes/_notes.html.haml
View file @
0546b9c6
-
if
can?
current_user
,
:write_note
,
@project
=
render
"notes/form"
.clear
%hr
%ul
#new_notes_list
%ul
#notes-list
.status
-
@notes
.
each
do
|
note
|
-
next
unless
note
.
author
=
render
"note"
,
note:
note
:javascript
$
(
function
(){
NoteList
.
init
(
"
#{
tid
}
"
,
"
#{
tt
}
"
,
"
#{
project_notes_path
(
@project
)
}
"
);
});
app/views/notes/_notes_list.html.haml
deleted
100644 → 0
View file @
a82977c6
-
@notes
.
each
do
|
note
|
-
next
unless
note
.
author
=
render
partial:
"notes/show"
,
locals:
{
note:
note
}
app/views/notes/_notes_with_form.html.haml
0 → 100644
View file @
0546b9c6
%ul
#notes-list
%ul
#new-notes-list
.notes-status
-
if
can?
current_user
,
:write_note
,
@project
=
render
"notes/common_form"
:javascript
$
(
function
(){
NoteList
.
init
(
"
#{
tid
}
"
,
"
#{
tt
}
"
,
"
#{
project_notes_path
(
@project
)
}
"
);
});
app/views/notes/_per_line_
show
.html.haml
→
app/views/notes/_per_line_
note
.html.haml
View file @
0546b9c6
%tr
.line_notes_row
%td
{
colspan:
3
}
%ul
=
render
partial:
"notes/show"
,
locals:
{
note:
note
}
=
render
"notes/note"
,
note:
note
app/views/notes/_per_line_note_link.html.haml
0 → 100644
View file @
0546b9c6
=
link_to
""
,
"#"
,
class:
"line_note_link"
,
data:
{
line_code:
line_code
},
title:
"Add note for this line"
app/views/notes/_per_line_notes_with_reply.html.haml
0 → 100644
View file @
0546b9c6
-
notes
.
each
do
|
note
|
=
render
"notes/per_line_note"
,
note:
note
=
render
"notes/per_line_reply_button"
,
line_code:
notes
.
first
.
line_code
app/views/notes/_reply_button.html.haml
→
app/views/notes/_
per_line_
reply_button.html.haml
View file @
0546b9c6
%tr
.line_notes_row.reply
%td
{
colspan:
3
}
%i
.icon-comment
=
link_to
"Reply"
,
"#"
,
class:
"line_note_reply_link"
,
"line_code"
=>
line_code
,
title:
"Add note for this line"
=
link_to
"Reply"
,
"#"
,
class:
"line_note_reply_link"
,
data:
{
line_code:
line_code
}
,
title:
"Add note for this line"
app/views/notes/_reversed_notes_with_form.html.haml
0 → 100644
View file @
0546b9c6
-
if
can?
current_user
,
:write_note
,
@project
=
render
"notes/common_form"
%ul
.reversed
#new-notes-list
%ul
.reversed
#notes-list
.notes-status
:javascript
$
(
function
(){
NoteList
.
init
(
"
#{
tid
}
"
,
"
#{
tt
}
"
,
"
#{
project_notes_path
(
@project
)
}
"
);
});
\ No newline at end of file
app/views/notes/create.js.haml
View file @
0546b9c6
-
if
@note
.
line_code
=
render
"create_
lin
e"
,
note:
@note
=
render
"create_
per_line_not
e"
,
note:
@note
-
else
=
render
"create_common"
,
note:
@note
=
render
"create_common
_note
"
,
note:
@note
-# Enable submit button
:plain
...
...
app/views/notes/index.js.haml
View file @
0546b9c6
=
render
"notes/load"
-
unless
@notes
.
blank?
-
if
loading_more_notes?
:plain
NoteList.appendMoreNotes(
#{
@notes
.
last
.
id
}
, "
#{
escape_javascript
(
render
'notes/notes'
)
}
");
-
elsif
loading_new_notes?
:plain
NoteList.replaceNewNotes("
#{
escape_javascript
(
render
'notes/notes'
)
}
");
-
else
:plain
NoteList.setContent(
#{
@notes
.
first
.
id
}
,
#{
@notes
.
last
.
id
}
, "
#{
escape_javascript
(
render
'notes/notes'
)
}
");
-
else
-
if
loading_more_notes?
:plain
NoteList.finishedLoadingMore();
app/views/projects/wall.html.haml
View file @
0546b9c6
%div
.wall_page
=
render
"notes/
notes
"
,
tid:
nil
,
tt:
"wall"
=
render
"notes/
reversed_notes_with_form
"
,
tid:
nil
,
tt:
"wall"
app/views/snippets/show.html.haml
View file @
0546b9c6
...
...
@@ -17,4 +17,4 @@
%div
{
class:
current_user
.
dark_scheme
?
"black"
:
""
}
=
raw
@snippet
.
colorize
(
options:
{
linenos:
'True'
})
=
render
"notes/notes"
,
tid:
@snippet
.
id
,
tt:
"snippet"
=
render
"notes/notes
_with_form
"
,
tid:
@snippet
.
id
,
tt:
"snippet"
app/views/wikis/show.html.haml
View file @
0546b9c6
...
...
@@ -21,4 +21,4 @@
Delete this page
%hr
.wiki_notes
#notes
=
render
"notes/notes"
,
tid:
@wiki
.
id
,
tt:
"wiki"
.wiki_notes
#notes
=
render
"notes/notes
_with_form
"
,
tid:
@wiki
.
id
,
tt:
"wiki"
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