New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#10: Support post removal #28
Conversation
this solves #10 |
тесты упали:
|
content: [ | ||
{ | ||
block: 'button', | ||
text: i18n(this.block, 'Delete'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
по негласной договоренности порядок ключей: block
, mods
, mix
, text
}, | ||
{ | ||
block: 'modal', | ||
mods: { theme: 'islands', autoclosable: true, visible: false }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
модификатор в значении false
не имеет смысла
@@ -11,6 +13,51 @@ block('issue').content()(function() { | |||
elem: 'date', | |||
content: issue.created_from_now | |||
}, | |||
issue.user.login === currentUser.login && { | |||
block: 'issue', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
здесь и везде ниже вместо хардкода имени блока использовать this.block
(можно закешировать заранее)
mods: { theme: 'islands', size: 'm', view: 'action' }, | ||
mix: { block: 'issue', elem: 'delete-modal-yes' }, | ||
text: i18n(this.block, 'DeleteYes'), | ||
js: { number: issue.number } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
поле js
поднять перед mix
}, | ||
{ | ||
block: 'spin', | ||
mods: { theme: 'islands', size: 'm', visible: false }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false не имеет смысла
_onClickDeleteButton: function(event) { | ||
var modal = this._elem('delete-confirm-modal').findMixedBlock(Modal); | ||
|
||
event.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
какую задачу здесь решает preventDefault
?
var modal = this._elem('delete-confirm-modal').findMixedBlock(Modal); | ||
|
||
event.preventDefault(); | ||
modal.setMod('visible', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
писать не обязательно
$.post('/api/' + event.bemTarget.params.number + '/delete', { | ||
token: '213123123' | ||
}).then(function(response) { | ||
if (response === 'ok') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а если не ок, то что? :)
} | ||
}).catch(function(){ | ||
spinner.delMod('visible'); | ||
modalBody.setMod('visible', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут бы какое-то пояснение для пользователя, что ничего такого не случилось
// deleting issue with 'removed' label | ||
var issueAddLabelRequestUrl = applyToken(issuesRequestUrl + '/' + req.params.id + '/labels', req.body.token); | ||
|
||
makeIssueRemoveRequest(issueAddLabelRequestUrl).then(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removeIssueRequest
@skad0 @tadatuta