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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
18165f97
Commit
18165f97
authored
8 years ago
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix task list for single edit note widget changes.
parent
56293399
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
17 deletions
+40
-17
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+36
-17
app/views/projects/notes/_edit_form.html.haml
app/views/projects/notes/_edit_form.html.haml
+3
-0
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+1
-0
No files found.
app/assets/javascripts/notes.js
View file @
18165f97
...
...
@@ -517,7 +517,11 @@
Notes
.
prototype
.
showEditForm
=
function
(
e
,
scrollTo
,
myLastNote
)
{
e
.
preventDefault
();
var
$target
=
$
(
e
.
target
);
var
$editForm
=
$
(
'
.note-edit-form
'
);
var
$note
=
$target
.
closest
(
'
.note
'
);
var
$currentlyEditing
=
$
(
'
.note.is-editting
'
);
if
(
$currentlyEditing
.
length
)
{
var
isEditAllowed
=
this
.
checkContentToAllowEditing
(
$currentlyEditing
);
...
...
@@ -526,21 +530,10 @@
}
}
var
$editForm
=
$
(
'
.note-edit-form
'
);
var
$note
=
$
(
e
.
target
).
closest
(
'
.note
'
);
$editForm
.
insertAfter
(
$note
.
find
(
'
.note-text
'
));
var
$noteText
=
$editForm
.
find
(
'
.js-note-text
'
);
var
$originalContentEl
=
$note
.
find
(
'
.original-note-content
'
);
var
originalContent
=
$originalContentEl
.
text
().
trim
();
var
postUrl
=
$originalContentEl
.
data
(
'
post-url
'
);
$note
.
addClass
(
'
is-editting
'
);
$editForm
.
find
(
'
form
'
).
attr
(
'
action
'
,
postUrl
);
$editForm
.
addClass
(
'
current-note-edit-form
'
);
$note
.
find
(
'
.js-note-attachment-delete
'
).
show
();
// Show the attachment delete link
new
GLForm
(
$editForm
.
find
(
'
form
'
));
$editForm
.
find
(
'
.js-note-text
'
).
focus
().
val
(
originalContent
);
$editForm
.
addClass
(
'
current-note-edit-form
'
);
$note
.
addClass
(
'
is-editting
'
);
this
.
putEditFormInPlace
(
$target
);
};
...
...
@@ -865,15 +858,41 @@
Notes
.
prototype
.
initTaskList
=
function
()
{
this
.
enableTaskList
();
return
$
(
document
).
on
(
'
tasklist:changed
'
,
'
.note .js-task-list-container
'
,
this
.
updateTaskList
);
return
$
(
document
).
on
(
'
tasklist:changed
'
,
'
.note .js-task-list-container
'
,
this
.
updateTaskList
.
bind
(
this
)
);
};
Notes
.
prototype
.
enableTaskList
=
function
()
{
return
$
(
'
.note .js-task-list-container
'
).
taskList
(
'
enable
'
);
};
Notes
.
prototype
.
updateTaskList
=
function
()
{
return
$
(
'
form
'
,
this
).
submit
();
Notes
.
prototype
.
putEditFormInPlace
=
function
(
$el
)
{
var
$editForm
=
$
(
'
.note-edit-form
'
);
var
$note
=
$el
.
closest
(
'
.note
'
);
$editForm
.
insertAfter
(
$note
.
find
(
'
.note-text
'
));
var
$originalContentEl
=
$note
.
find
(
'
.original-note-content
'
);
var
originalContent
=
$originalContentEl
.
text
().
trim
();
var
postUrl
=
$originalContentEl
.
data
(
'
post-url
'
);
var
targetId
=
$originalContentEl
.
data
(
'
target-id
'
);
var
targetType
=
$originalContentEl
.
data
(
'
target-type
'
);
new
GLForm
(
$editForm
.
find
(
'
form
'
));
$editForm
.
find
(
'
form
'
).
attr
(
'
action
'
,
postUrl
);
$editForm
.
find
(
'
.formTargetId
'
).
val
(
targetId
);
$editForm
.
find
(
'
.formTargetType
'
).
val
(
targetType
);
$editForm
.
find
(
'
.js-note-text
'
).
focus
().
val
(
originalContent
);
}
Notes
.
prototype
.
updateTaskList
=
function
(
e
)
{
var
$list
=
$
(
e
.
target
).
closest
(
'
.js-task-list-container
'
);
var
$editForm
=
$
(
'
.note-edit-form
'
);
var
$note
=
$list
.
closest
(
'
.note
'
);
this
.
putEditFormInPlace
(
$list
);
$editForm
.
find
(
'
#note_note
'
).
val
(
$note
.
find
(
'
.original-task-list
'
).
val
());
$
(
'
form
'
,
$list
).
submit
();
};
Notes
.
prototype
.
updateNotesCount
=
function
(
updateCount
)
{
...
...
This diff is collapsed.
Click to expand it.
app/views/projects/notes/_edit_form.html.haml
View file @
18165f97
.note-edit-form
=
form_tag
'#'
,
method: :put
,
remote:
true
,
class:
'edit-note common-note-form js-quick-submit'
do
=
hidden_field_tag
:authenticity_token
,
form_authenticity_token
=
hidden_field_tag
:target_id
,
''
,
class:
'formTargetId'
=
hidden_field_tag
:target_type
,
''
,
class:
'formTargetType'
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
'md-preview'
}
do
=
render
'projects/zen'
,
attr:
'note[note]'
,
classes:
'note-textarea js-note-text js-task-list-field'
,
placeholder:
"Write a comment or drag your files here..."
=
render
'projects/notes/hints'
...
...
This diff is collapsed.
Click to expand it.
app/views/projects/notes/_note.html.haml
View file @
18165f97
...
...
@@ -69,6 +69,7 @@
-
if
note_editable
.original-note-content.hidden
{
data:
{
post_url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
),
target_id:
note
.
noteable
.
id
,
target_type:
note
.
noteable
.
class
.
name
.
underscore
}}
#{
note
.
note
}
%textarea
.hidden.js-task-list-field.original-task-list
#{
note
.
note
}
.note-awards
=
render
'award_emoji/awards_block'
,
awardable:
note
,
inline:
false
-
if
note
.
system
...
...
This diff is collapsed.
Click to expand it.
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