mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Small cosmetic changes
This commit is contained in:
parent
a2320b892d
commit
78cf40ba64
@ -17,7 +17,7 @@ class EditionListActions {
|
||||
);
|
||||
}
|
||||
|
||||
fetchEditionList({pieceId, page, pageSize, orderBy, orderAsc, filterBy, maxEdition}) {
|
||||
fetchEditionList({ pieceId, page, pageSize, orderBy, orderAsc, filterBy, maxEdition }) {
|
||||
if ((!orderBy && typeof orderAsc === 'undefined') || !orderAsc) {
|
||||
orderBy = 'edition_number';
|
||||
orderAsc = true;
|
||||
@ -39,7 +39,7 @@ class EditionListActions {
|
||||
|
||||
return Q.Promise((resolve, reject) => {
|
||||
EditionListFetcher
|
||||
.fetch({pieceId, page, itemsToFetch, orderBy, orderAsc, filterBy})
|
||||
.fetch({ pieceId, page, itemsToFetch, orderBy, orderAsc, filterBy })
|
||||
.then((res) => {
|
||||
if (res && !res.editions) {
|
||||
throw new Error('Piece has no editions to fetch.');
|
||||
|
@ -15,7 +15,7 @@ class PieceListActions {
|
||||
);
|
||||
}
|
||||
|
||||
fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy}) {
|
||||
fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy }) {
|
||||
// To prevent flickering on a pagination request,
|
||||
// we overwrite the piecelist with an empty list before
|
||||
// pieceListCount === -1 defines the loading state
|
||||
@ -34,7 +34,7 @@ class PieceListActions {
|
||||
// afterwards, we can load the list
|
||||
return Q.Promise((resolve, reject) => {
|
||||
PieceListFetcher
|
||||
.fetch({page, pageSize, search, orderBy, orderAsc, filterBy})
|
||||
.fetch({ page, pageSize, search, orderBy, orderAsc, filterBy })
|
||||
.then((res) => {
|
||||
this.actions.updatePieceList({
|
||||
page,
|
||||
|
@ -19,9 +19,10 @@ import { getLangText } from '../../utils/lang_utils';
|
||||
|
||||
let AccordionListItemEditionWidget = React.createClass({
|
||||
propTypes: {
|
||||
className: React.PropTypes.string,
|
||||
piece: React.PropTypes.object.isRequired,
|
||||
toggleCreateEditionsDialog: React.PropTypes.func.isRequired,
|
||||
|
||||
className: React.PropTypes.string,
|
||||
onPollingSuccess: React.PropTypes.func
|
||||
},
|
||||
|
||||
@ -54,11 +55,11 @@ let AccordionListItemEditionWidget = React.createClass({
|
||||
const { filterBy, isEditionListOpenForPieceId } = this.state;
|
||||
const isEditionListOpen = isEditionListOpenForPieceId[pieceId] ? isEditionListOpenForPieceId[pieceId].show : false;
|
||||
|
||||
if(isEditionListOpen) {
|
||||
if (isEditionListOpen) {
|
||||
EditionListActions.toggleEditionList(pieceId);
|
||||
} else {
|
||||
EditionListActions.toggleEditionList(pieceId);
|
||||
EditionListActions.fetchEditionList({pieceId, filterBy});
|
||||
EditionListActions.fetchEditionList({ pieceId, filterBy });
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -82,11 +82,11 @@ let AccordionListItemTableEditions = React.createClass({
|
||||
|
||||
EditionListActions.fetchEditionList({
|
||||
pieceId,
|
||||
page: page + 1,
|
||||
pageSize,
|
||||
orderBy,
|
||||
orderAsc,
|
||||
filterBy
|
||||
filterBy,
|
||||
page: page + 1
|
||||
});
|
||||
},
|
||||
render() {
|
||||
|
@ -90,10 +90,10 @@ let AccordionListItemWallet = React.createClass({
|
||||
onPollingSuccess(pieceId) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
EditionListActions.toggleEditionList(pieceId);
|
||||
|
||||
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
||||
const notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
|
@ -81,8 +81,8 @@ let EditionActionPanel = React.createClass({
|
||||
refreshCollection() {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
EditionListActions.refreshEditionList({pieceId: this.props.edition.parent});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
EditionListActions.refreshEditionList({ pieceId: this.props.edition.parent });
|
||||
},
|
||||
|
||||
handleSuccess(response) {
|
||||
|
@ -144,14 +144,14 @@ let PieceContainer = React.createClass({
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceActions.updateProperty({key: 'num_editions', value: 0});
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
this.toggleCreateEditionsDialog();
|
||||
},
|
||||
|
||||
handleDeleteSuccess(response) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
// since we're deleting a piece, we just need to close
|
||||
// all editions dialogs and not reload them
|
||||
@ -192,7 +192,7 @@ let PieceContainer = React.createClass({
|
||||
// btw.: It's not sufficient to just set num_editions to numEditions, since a single accordion
|
||||
// list item also uses the firstEdition property which we can only get from the server in that case.
|
||||
// Therefore we need to at least refetch the changed piece from the server or on our case simply all
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
@ -214,14 +214,14 @@ let PieceList = React.createClass({
|
||||
|
||||
applyOrderBy(orderBy) {
|
||||
const { filterBy, orderAsc, page, pageSize, search } = this.state;
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
loadPieceList({ page, filterBy = this.state.filterBy, search = this.state.search }) {
|
||||
const { orderAsc, pageSize } = this.state;
|
||||
const orderBy = this.state.orderBy || this.props.orderBy;
|
||||
|
||||
return PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
return PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
fetchSelectedPieceEditionList() {
|
||||
@ -249,7 +249,7 @@ let PieceList = React.createClass({
|
||||
handleAclSuccess() {
|
||||
const { filterBy, orderBy, orderAsc, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
this.fetchSelectedPieceEditionList()
|
||||
.forEach((pieceId) => {
|
||||
|
@ -73,13 +73,13 @@ let RegisterPiece = React.createClass( {
|
||||
|
||||
// once the user was able to register a piece successfully, we need to make sure to keep
|
||||
// the piece list up to date
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
this.history.push(`/pieces/${response.piece.id}`);
|
||||
},
|
||||
|
||||
getSpecifyEditions() {
|
||||
if(this.state.whitelabel && this.state.whitelabel.acl_create_editions || Object.keys(this.state.whitelabel).length === 0) {
|
||||
if (this.state.whitelabel && this.state.whitelabel.acl_create_editions || Object.keys(this.state.whitelabel).length === 0) {
|
||||
return (
|
||||
<Property
|
||||
name="num_editions"
|
||||
|
@ -60,7 +60,7 @@ let AccordionListItemPrize = React.createClass({
|
||||
handleSubmitPrizeSuccess(response) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
@ -141,7 +141,7 @@ let AccordionListItemPrize = React.createClass({
|
||||
refreshPieceData() {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
onSelectChange(){
|
||||
|
@ -306,7 +306,7 @@ let PrizePieceRatings = React.createClass({
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
this.props.loadPiece();
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
onSelectChange() {
|
||||
|
@ -54,7 +54,7 @@ let CylandAccordionListItem = React.createClass({
|
||||
handleSubmitSuccess(response) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
@ -76,7 +76,7 @@ let CylandPieceContainer = React.createClass({
|
||||
handleDeleteSuccess(response) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
// since we're deleting a piece, we just need to close
|
||||
// all editions dialogs and not reload them
|
||||
|
@ -144,7 +144,7 @@ let CylandRegisterPiece = React.createClass({
|
||||
refreshPieceList() {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
render() {
|
||||
|
@ -55,7 +55,7 @@ let IkonotvAccordionListItem = React.createClass({
|
||||
handleSubmitSuccess(response) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
|
@ -85,7 +85,7 @@ let IkonotvPieceContainer = React.createClass({
|
||||
handleDeleteSuccess(response) {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
|
||||
// since we're deleting a piece, we just need to close
|
||||
// all editions dialogs and not reload them
|
||||
|
@ -149,7 +149,7 @@ let IkonotvRegisterPiece = React.createClass({
|
||||
refreshPieceList() {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
canSubmit() {
|
||||
|
@ -105,7 +105,7 @@ let MarketRegisterPiece = React.createClass({
|
||||
refreshPieceList() {
|
||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||
|
||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
||||
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||
},
|
||||
|
||||
render() {
|
||||
|
@ -9,10 +9,10 @@ let EditionListFetcher = {
|
||||
/**
|
||||
* Fetches a list of editions from the API.
|
||||
*/
|
||||
fetch({pieceId, page, pageSize, orderBy, orderAsc, filterBy}) {
|
||||
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
||||
fetch({ pieceId, page, pageSize, orderBy, orderAsc, filterBy }) {
|
||||
const ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
||||
|
||||
let queryParams = mergeOptions(
|
||||
const queryParams = mergeOptions(
|
||||
{
|
||||
page,
|
||||
pageSize,
|
||||
|
@ -10,12 +10,12 @@ let PieceListFetcher = {
|
||||
* Fetches a list of pieces from the API.
|
||||
* Can be called with all supplied queryparams the API.
|
||||
*/
|
||||
fetch({page, pageSize, search, orderBy, orderAsc, filterBy}) {
|
||||
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
||||
fetch({ page, pageSize, search, orderBy, orderAsc, filterBy }) {
|
||||
const ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
||||
|
||||
// filterBy is an object of acl key-value pairs.
|
||||
// The values are booleans
|
||||
let queryParams = mergeOptions(
|
||||
const queryParams = mergeOptions(
|
||||
{
|
||||
page,
|
||||
pageSize,
|
||||
|
@ -109,12 +109,12 @@ class EditionListStore {
|
||||
|
||||
EditionsListActions
|
||||
.fetchEditionList({
|
||||
filterBy,
|
||||
maxSeen,
|
||||
orderAsc,
|
||||
orderBy,
|
||||
pieceId,
|
||||
pageSize,
|
||||
orderBy,
|
||||
orderAsc,
|
||||
filterBy,
|
||||
maxSeen,
|
||||
page: 1
|
||||
})
|
||||
.catch(console.logGlobal);
|
||||
|
Loading…
Reference in New Issue
Block a user