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
766d011b
Commit
766d011b
authored
Feb 08, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notes use new task_list, and PATCH instead of POST
use data attribute for submit url optional onSuccess
parent
d3e34cd1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
24 deletions
+18
-24
app/assets/javascripts/issue.js
app/assets/javascripts/issue.js
+5
-1
app/assets/javascripts/merge_request.js
app/assets/javascripts/merge_request.js
+5
-1
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+1
-13
app/assets/javascripts/task_list.js.es6
app/assets/javascripts/task_list.js.es6
+6
-8
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+1
-1
No files found.
app/assets/javascripts/issue.js
View file @
766d011b
...
...
@@ -14,7 +14,11 @@ require('./task_list');
if
(
$
(
'
a.btn-close
'
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
dataType
:
'
issue
'
,
selector
:
'
.detail-page-description
'
selector
:
'
.detail-page-description
'
,
onSuccess
:
(
result
)
=>
{
document
.
querySelector
(
'
#task_status
'
).
innerText
=
result
.
task_status
;
document
.
querySelector
(
'
#task_status_short
'
).
innerText
=
result
.
task_status_short
;
}
});
this
.
initIssueBtnEventListeners
();
}
...
...
app/assets/javascripts/merge_request.js
View file @
766d011b
...
...
@@ -29,7 +29,11 @@ require('./merge_request_tabs');
if
(
$
(
"
a.btn-close
"
).
length
)
{
this
.
taskList
=
new
gl
.
TaskList
({
dataType
:
'
merge_request
'
,
selector
:
'
.detail-page-description
'
selector
:
'
.detail-page-description
'
,
onSuccess
:
(
result
)
=>
{
document
.
querySelector
(
'
#task_status
'
).
innerText
=
result
.
task_status
;
document
.
querySelector
(
'
#task_status_short
'
).
innerText
=
result
.
task_status_short
;
}
});
}
}
...
...
app/assets/javascripts/notes.js
View file @
766d011b
...
...
@@ -53,8 +53,7 @@ require('./task_list');
this
.
setupMainTargetNoteForm
();
this
.
taskList
=
new
gl
.
TaskList
({
dataType
:
'
note
'
,
selector
:
'
.notes
'
,
update
:
this
.
updateTaskList
.
bind
(
this
)
selector
:
'
.notes
'
});
this
.
collapseLongCommitList
();
...
...
@@ -889,17 +888,6 @@ require('./task_list');
$editForm
.
find
(
'
.referenced-users
'
).
hide
();
};
Notes
.
prototype
.
updateTaskList
=
function
(
e
)
{
var
$target
=
$
(
e
.
target
);
var
$list
=
$target
.
closest
(
'
.js-task-list-container
'
);
var
$editForm
=
$
(
this
.
getEditFormSelector
(
$target
));
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
)
{
return
this
.
notesCountBadge
.
text
(
parseInt
(
this
.
notesCountBadge
.
text
(),
10
)
+
updateCount
);
};
...
...
app/assets/javascripts/task_list.js.es6
View file @
766d011b
...
...
@@ -7,7 +7,7 @@ class TaskList {
constructor(options = {}) {
this.selector = options.selector;
this.dataType = options.dataType;
this.
update = options.update || this.update.bind(this)
;
this.
onSuccess = options.onSuccess || () => null
;
this.init();
}
...
...
@@ -15,7 +15,7 @@ class TaskList {
// Prevent duplicate event bindings
this.disable();
$(`${this.selector} .js-task-list-container`).taskList('enable');
$(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update);
$(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update
.bind(this)
);
}
disable() {
...
...
@@ -24,18 +24,16 @@ class TaskList {
}
update(e) {
const $target = $(e.target);
const patchData = {};
patchData[this.dataType] = {
description: $
(e.target)
.val(),
description: $
target
.val(),
};
return $.ajax({
type: 'PATCH',
url: $('form.js-issuable-update').attr('action'),
url: $
target.data('update-url') || $
('form.js-issuable-update').attr('action'),
data: patchData,
success: (result) => {
document.querySelector('#task_status').innerText = result.task_status;
document.querySelector('#task_status_short').innerText = result.task_status_short;
},
success: this.onSuccess,
});
}
}
...
...
app/views/projects/notes/_note.html.haml
View file @
766d011b
...
...
@@ -69,7 +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
%textarea
.hidden.js-task-list-field.original-task-list
{
data:
{
update_url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
)
}
}
=
note
.
note
.note-awards
=
render
'award_emoji/awards_block'
,
awardable:
note
,
inline:
false
-
if
note
.
system
...
...
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