-
Notifications
You must be signed in to change notification settings - Fork 27
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
Move confirm delete row and before delete row check to util #1235
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,51 @@ | ||||||||
/** | ||||||||
@module ember-flexberry | ||||||||
*/ | ||||||||
|
||||||||
import Ember from 'ember'; | ||||||||
|
||||||||
/** | ||||||||
Used for check confirm delete rows function and get result. | ||||||||
|
||||||||
@method checkConfirmDeleteRows | ||||||||
@param {Function} confirmDeleteRowsFunction confirm function | ||||||||
@return {RSVP.Promise} Retriveved object from path | ||||||||
*/ | ||||||||
let checkConfirmDeleteRows = function (confirmDeleteRowsFunction) { | ||||||||
let possiblePromise = Ember.RSVP.resolve(); | ||||||||
|
||||||||
if (confirmDeleteRowsFunction) { | ||||||||
Ember.assert('Error: confirmDeleteRows must be a function.', typeof confirmDeleteRowsFunction === 'function'); | ||||||||
possiblePromise = confirmDeleteRowsFunction(); | ||||||||
possiblePromise = (possiblePromise && (possiblePromise instanceof Ember.RSVP.Promise)) ? possiblePromise : null; | ||||||||
} | ||||||||
|
||||||||
return possiblePromise; | ||||||||
}; | ||||||||
|
||||||||
/** | ||||||||
Used for check before delete record function and get result. | ||||||||
|
||||||||
@method checkBeforeDeleteRecord | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
@param {Function} beforeDeleteRecordFunction before function | ||||||||
@param {DS.Model} record A record to delete | ||||||||
@param {Object} data Data object | ||||||||
@return {RSVP.Promise} Retriveved object from path | ||||||||
*/ | ||||||||
let checkBeforeDeleteRecord = function (beforeDeleteRecordFunction, record, data) { | ||||||||
let possiblePromise = Ember.RSVP.resolve(); | ||||||||
|
||||||||
if (beforeDeleteRecordFunction) { | ||||||||
Ember.assert('Error: beforeDeleteRecord must be a function', typeof beforeDeleteRecordFunction === 'function'); | ||||||||
let promis = beforeDeleteRecordFunction(record, data); | ||||||||
possiblePromise = (promis && (promis instanceof Ember.RSVP.Promise)) ? promis : possiblePromise; | ||||||||
possiblePromise = (data.cancel) ? null : possiblePromise; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Проверку |
||||||||
} | ||||||||
|
||||||||
return possiblePromise; | ||||||||
}; | ||||||||
|
||||||||
export { | ||||||||
checkConfirmDeleteRows, | ||||||||
checkBeforeDeleteRecord | ||||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,6 @@ | |
filterByAllWords=filterByAllWords | ||
configurateRow=this.attrs.configurateRow | ||
configurateSelectedRows=this.attrs.configurateSelectedRows | ||
confirmDeleteRow=confirmDeleteRow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Пока только устарело, нужно оставить. |
||
beforeDeleteRecord=beforeDeleteRecord | ||
beforeDeleteAllRecords=beforeDeleteAllRecords | ||
action='objectListViewRowClick' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,7 +120,6 @@ | |
filterByAllWords=filterByAllWords | ||
configurateRow=this.attrs.configurateRow | ||
configurateSelectedRows=this.attrs.configurateSelectedRows | ||
confirmDeleteRow=confirmDeleteRow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. И это. |
||
beforeDeleteRecord=beforeDeleteRecord | ||
beforeDeleteAllRecords=beforeDeleteAllRecords | ||
action='objectListViewRowClick' | ||
|
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.