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
Jérome Perrin
gitlab-ce
Commits
ece56329
Commit
ece56329
authored
Nov 14, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Notes JS
Also fixes #1983
parent
433d2278
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
26 deletions
+29
-26
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+0
-19
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+29
-7
No files found.
app/assets/javascripts/main.js.coffee
View file @
ece56329
...
...
@@ -58,25 +58,6 @@ $ ->
$
(
@
).
next
(
'table'
).
show
()
$
(
@
).
remove
()
# Note markdown preview
$
(
document
).
on
'click'
,
'#preview-link'
,
(
e
)
->
$
(
'#preview-note'
).
text
'Loading...'
previewLinkText
=
if
$
(
@
).
text
()
is
'Preview'
then
'Edit'
else
'Preview'
$
(
@
).
text
previewLinkText
note
=
$
(
'#note_note'
).
val
()
if
note
.
trim
().
length
is
0
$
(
'#preview-note'
).
text
'Nothing to preview.'
else
$
.
post
$
(
@
).
attr
(
'href'
),
{
note
:
note
},
(
data
)
->
$
(
'#preview-note'
).
html
(
data
)
$
(
'#preview-note, #note_note'
).
toggle
()
e
.
preventDefault
()
false
((
$
)
->
_chosen
=
$
.
fn
.
chosen
$
.
fn
.
extend
chosen
:
(
options
)
->
...
...
app/assets/javascripts/notes.js
View file @
ece56329
...
...
@@ -14,8 +14,8 @@ var NoteList = {
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
;
this
.
reversed
=
$
(
"
#notes-list
"
).
is
(
"
.
reversed
"
);
this
.
target_params
=
"
target_type=
"
+
this
.
target_type
+
"
&target_id=
"
+
this
.
target_id
;
// get initial set of notes
this
.
getContent
();
...
...
@@ -33,6 +33,8 @@ var NoteList = {
$
(
"
.note-form-holder
"
).
on
(
"
ajax:complete
"
,
function
(){
$
(
"
.submit_note
"
).
enable
();
$
(
'
#preview-note
'
).
hide
();
$
(
'
#note_note
'
).
show
();
})
disableButtonIfEmptyField
(
"
.note-text
"
,
"
.submit_note
"
);
...
...
@@ -52,6 +54,26 @@ var NoteList = {
$
(
'
.note_advanced_opts
'
).
show
();
});
}
// Setup note preview
$
(
document
).
on
(
'
click
'
,
'
#preview-link
'
,
function
(
e
)
{
$
(
'
#preview-note
'
).
text
(
'
Loading...
'
);
$
(
this
).
text
(
$
(
this
).
text
()
===
"
Edit
"
?
"
Preview
"
:
"
Edit
"
);
var
note_text
=
$
(
'
#note_note
'
).
val
();
if
(
note_text
.
trim
().
length
===
0
)
{
$
(
'
#preview-note
'
).
text
(
'
Nothing to preview.
'
);
}
else
{
$
.
post
(
$
(
this
).
attr
(
'
href
'
),
{
note
:
note_text
}).
success
(
function
(
data
)
{
$
(
'
#preview-note
'
).
html
(
data
);
});
}
$
(
'
#preview-note, #note_note
'
).
toggle
();
e
.
preventDefault
();
});
},
...
...
@@ -69,7 +91,7 @@ var NoteList = {
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
?
"
+
this
.
target_params
,
data
:
this
.
target_params
,
complete
:
function
(){
$
(
'
.notes-status
'
).
removeClass
(
"
loading
"
)},
beforeSend
:
function
()
{
$
(
'
.notes-status
'
).
addClass
(
"
loading
"
)
},
dataType
:
"
script
"
});
...
...
@@ -131,7 +153,7 @@ var NoteList = {
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
loading_more=1&
"
+
(
this
.
reversed
?
"
before_id
"
:
"
after_id
"
)
+
"
=
"
+
this
.
bottom_id
+
this
.
target_params
,
data
:
this
.
target_params
+
"
&loading_more=1&
"
+
(
this
.
reversed
?
"
before_id
"
:
"
after_id
"
)
+
"
=
"
+
this
.
bottom_id
,
complete
:
function
(){
$
(
'
.notes-status
'
).
removeClass
(
"
loading
"
)},
beforeSend
:
function
()
{
$
(
'
.notes-status
'
).
addClass
(
"
loading
"
)
},
dataType
:
"
script
"
});
...
...
@@ -192,7 +214,7 @@ var NoteList = {
$
.
ajax
({
type
:
"
GET
"
,
url
:
this
.
notes_path
,
data
:
"
loading_new=1&after_id=
"
+
(
this
.
reversed
?
this
.
top_id
:
this
.
bottom_id
)
+
this
.
target_params
,
data
:
this
.
target_params
+
"
&loading_new=1&after_id=
"
+
(
this
.
reversed
?
this
.
top_id
:
this
.
bottom_id
)
,
dataType
:
"
script
"
});
},
...
...
@@ -264,7 +286,7 @@ var PerLineNotes = {
$
(
this
).
closest
(
"
tr
"
).
after
(
form
);
form
.
find
(
"
#note_line_code
"
).
val
(
$
(
this
).
data
(
"
lineCode
"
));
form
.
show
();
return
false
;
e
.
preventDefault
()
;
});
disableButtonIfEmptyField
(
"
.line-note-text
"
,
"
.submit_inline_note
"
);
...
...
@@ -285,7 +307,7 @@ var PerLineNotes = {
// 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
"
))
{
if
(
trLine
.
is
(
"
.line_holder
"
)
&&
trRpl
.
is
(
"
.
reply
"
))
{
trRpl
.
fadeOut
(
function
()
{
$
(
this
).
remove
();
});
}
});
...
...
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