1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

fix wrong feedback for deleting an edition

This commit is contained in:
Tim Daubenschütz 2015-07-16 11:50:52 +02:00
parent 943c7503ea
commit 39ec4c5b91
3 changed files with 14 additions and 2 deletions

View File

@ -29,7 +29,6 @@ import InputTextAreaToggable from './../ascribe_forms/input_textarea_toggable';
import EditionFurtherDetails from './further_details'; import EditionFurtherDetails from './further_details';
import RequestActionForm from './../ascribe_forms/form_request_action'; import RequestActionForm from './../ascribe_forms/form_request_action';
import EditionActions from '../../actions/edition_actions';
import AclButtonList from './../ascribe_buttons/acl_button_list'; import AclButtonList from './../ascribe_buttons/acl_button_list';
import UnConsignRequestButton from './../ascribe_buttons/unconsign_request_button'; import UnConsignRequestButton from './../ascribe_buttons/unconsign_request_button';
import DeleteButton from '../ascribe_buttons/delete_button'; import DeleteButton from '../ascribe_buttons/delete_button';
@ -80,6 +79,7 @@ let Edition = React.createClass({
handleDeleteSuccess(response) { handleDeleteSuccess(response) {
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); 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.refreshEditionList(this.props.edition.parent);
EditionListActions.closeAllEditionLists(); EditionListActions.closeAllEditionLists();
EditionListActions.clearAllEditionSelections(); EditionListActions.clearAllEditionSelections();

View File

@ -61,6 +61,16 @@ class EditionListStore {
* this method provides exactly that functionality without any side effects * this method provides exactly that functionality without any side effects
*/ */
onRefreshEditionList(pieceId) { 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 prevEditionListLength = this.editionList[pieceId].length;
const prevEditionListPage = this.editionList[pieceId].page; const prevEditionListPage = this.editionList[pieceId].page;
const prevEditionListPageSize = this.editionList[pieceId].pageSize; const prevEditionListPageSize = this.editionList[pieceId].pageSize;
@ -69,6 +79,8 @@ class EditionListStore {
// http://davidwalsh.name/empty-array // http://davidwalsh.name/empty-array
this.editionList[pieceId].length = 0; this.editionList[pieceId].length = 0;
// refetch editions with adjusted page size // refetch editions with adjusted page size
EditionsListActions.fetchEditionList(pieceId, 1, prevEditionListLength, this.editionList[pieceId].orderBy, this.editionList[pieceId].orderAsc) EditionsListActions.fetchEditionList(pieceId, 1, prevEditionListLength, this.editionList[pieceId].orderBy, this.editionList[pieceId].orderAsc)
.then(() => { .then(() => {

View File

@ -29,7 +29,7 @@ export function getLangText(s, ...args) {
} }
} catch(err) { } catch(err) {
//if(!(s in languages[lang])) { //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; return s;
//} else { //} else {
// console.error(err); // console.error(err);