mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
fix wrong feedback for deleting an edition
This commit is contained in:
parent
943c7503ea
commit
39ec4c5b91
@ -29,7 +29,6 @@ import InputTextAreaToggable from './../ascribe_forms/input_textarea_toggable';
|
||||
import EditionFurtherDetails from './further_details';
|
||||
|
||||
import RequestActionForm from './../ascribe_forms/form_request_action';
|
||||
import EditionActions from '../../actions/edition_actions';
|
||||
import AclButtonList from './../ascribe_buttons/acl_button_list';
|
||||
import UnConsignRequestButton from './../ascribe_buttons/unconsign_request_button';
|
||||
import DeleteButton from '../ascribe_buttons/delete_button';
|
||||
@ -80,6 +79,7 @@ let Edition = React.createClass({
|
||||
handleDeleteSuccess(response) {
|
||||
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc);
|
||||
|
||||
console.log(this.props.edition.parent);
|
||||
EditionListActions.refreshEditionList(this.props.edition.parent);
|
||||
EditionListActions.closeAllEditionLists();
|
||||
EditionListActions.clearAllEditionSelections();
|
||||
|
@ -61,6 +61,16 @@ class EditionListStore {
|
||||
* this method provides exactly that functionality without any side effects
|
||||
*/
|
||||
onRefreshEditionList(pieceId) {
|
||||
|
||||
// It may happen that the user enters the site logged in already
|
||||
// through /editions
|
||||
// If he then tries to delete a piece/edition and this method is called,
|
||||
// we'll not be able to refresh his edition list since its not yet there.
|
||||
// Therefore we can just return, since there is no data to be refreshed
|
||||
if(!this.editionList[pieceId]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const prevEditionListLength = this.editionList[pieceId].length;
|
||||
const prevEditionListPage = this.editionList[pieceId].page;
|
||||
const prevEditionListPageSize = this.editionList[pieceId].pageSize;
|
||||
@ -69,6 +79,8 @@ class EditionListStore {
|
||||
// http://davidwalsh.name/empty-array
|
||||
this.editionList[pieceId].length = 0;
|
||||
|
||||
|
||||
|
||||
// refetch editions with adjusted page size
|
||||
EditionsListActions.fetchEditionList(pieceId, 1, prevEditionListLength, this.editionList[pieceId].orderBy, this.editionList[pieceId].orderAsc)
|
||||
.then(() => {
|
||||
|
@ -29,7 +29,7 @@ export function getLangText(s, ...args) {
|
||||
}
|
||||
} catch(err) {
|
||||
//if(!(s in languages[lang])) {
|
||||
console.warn('Language-string is not in constants file. Add: "' + s + '" to the "' + lang + '" language file. Defaulting to keyname');
|
||||
//console.warn('Language-string is not in constants file. Add: "' + s + '" to the "' + lang + '" language file. Defaulting to keyname');
|
||||
return s;
|
||||
//} else {
|
||||
// console.error(err);
|
||||
|
Loading…
Reference in New Issue
Block a user