diff --git a/js/components/ascribe_accordion_list/accordion_list.js b/js/components/ascribe_accordion_list/accordion_list.js
index 85084b5f..471ba9d5 100644
--- a/js/components/ascribe_accordion_list/accordion_list.js
+++ b/js/components/ascribe_accordion_list/accordion_list.js
@@ -28,7 +28,7 @@ let AccordionList = React.createClass({
);
} else {
return (
-
+
{this.props.loadingElement}
);
diff --git a/js/components/ascribe_slides_container/slides_container.js b/js/components/ascribe_slides_container/slides_container.js
index 95c5859f..56f1547f 100644
--- a/js/components/ascribe_slides_container/slides_container.js
+++ b/js/components/ascribe_slides_container/slides_container.js
@@ -21,15 +21,22 @@ let SlidesContainer = React.createClass({
// handle queryParameters
let queryParams = this.getQuery();
let slideNum = -1;
+ let startFrom = -1;
if(queryParams && 'slide_num' in queryParams) {
slideNum = parseInt(queryParams.slide_num, 10);
}
// if slide_num is not set, this will be done in componentDidMount
+ // the query param 'start_from' removes all slide children before the respective number
+ if(queryParams && 'start_from' in queryParams) {
+ startFrom = parseInt(queryParams.start_from, 10);
+ }
+
return {
+ slideNum,
+ startFrom,
containerWidth: 0,
- slideNum: slideNum,
historyLength: window.history.length
};
},
@@ -54,9 +61,23 @@ let SlidesContainer = React.createClass({
window.addEventListener('resize', this.handleContainerResize);
},
- componentDidUpdate() {
- // check if slide_num was defined, and if not then default to 0
+ componentWillReceiveProps() {
let queryParams = this.getQuery();
+
+ // also check if start_from was updated
+ // This applies for example when the user tries to submit a already existing piece
+ // (starting from slide 1 for example) and then clicking on + NEW WORK
+ if(queryParams && !('start_from' in queryParams)) {
+ this.setState({
+ startFrom: -1
+ });
+ }
+ },
+
+ componentDidUpdate() {
+ let queryParams = this.getQuery();
+
+ // check if slide_num was defined, and if not then default to 0
this.setSlideNum(queryParams.slide_num);
},
@@ -137,20 +158,34 @@ let SlidesContainer = React.createClass({
extractBreadcrumbs() {
let breadcrumbs = [];
- ReactAddons.Children.map(this.props.children, (child) => {
- breadcrumbs.push(child.props['data-slide-title']);
+ ReactAddons.Children.map(this.props.children, (child, i) => {
+ if(i >= this.state.startFrom) {
+ breadcrumbs.push(child.props['data-slide-title']);
+ }
});
return breadcrumbs;
},
+ customChildrenCount() {
+ let count = 0;
+ React.Children.forEach(this.props.children, (child, i) => {
+ if(i >= this.state.startFrom) {
+ count++;
+ }
+ });
+
+ return count;
+ },
+
renderBreadcrumbs() {
let breadcrumbs = this.extractBreadcrumbs();
- let numOfChildren = React.Children.count(this.props.children);
+ let numOfChildren = this.customChildrenCount();
// check if every child/slide has a title,
// otherwise do not display the breadcrumbs at all
- if(breadcrumbs.length === numOfChildren) {
+ // Also, if there is only one child, do not display the breadcrumbs
+ if(breadcrumbs.length === numOfChildren && breadcrumbs.length > 1 && numOfChildren > 1) {
let numSlides = breadcrumbs.length;
let columnWidth = Math.floor(12 / numSlides);
@@ -187,13 +222,21 @@ let SlidesContainer = React.createClass({
// Also, a key is nice to have!
renderChildren() {
return ReactAddons.Children.map(this.props.children, (child, i) => {
- return ReactAddons.addons.cloneWithProps(child, {
- className: 'ascribe-slide',
- style: {
- width: this.state.containerWidth
- },
- key: i
- });
+ // since the default parameter of startFrom is -1, we do not need to check
+ // if its actually present in the url bar, as it will just not match
+
+ if(i >= this.state.startFrom) {
+ return ReactAddons.addons.cloneWithProps(child, {
+ className: 'ascribe-slide',
+ style: {
+ width: this.state.containerWidth
+ },
+ key: i
+ });
+ } else {
+ // Abortions are bad mkay
+ return null;
+ }
});
},
diff --git a/js/components/piece_list.js b/js/components/piece_list.js
index eac6ca15..14554ea0 100644
--- a/js/components/piece_list.js
+++ b/js/components/piece_list.js
@@ -138,7 +138,7 @@ let PieceList = React.createClass({
this.transitionTo(this.getPathname(), {page: 1});
},
- applyOrderBy(orderBy, orderAsc) {
+ applyOrderBy(orderBy) {
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
orderBy, this.state.orderAsc, this.state.filterBy);
},
diff --git a/js/components/whitelabel/wallet/components/cyland/ascribe_buttons/cyland_submit_button.js b/js/components/whitelabel/wallet/components/cyland/ascribe_buttons/cyland_submit_button.js
index 8b9a53ef..a4c23e41 100644
--- a/js/components/whitelabel/wallet/components/cyland/ascribe_buttons/cyland_submit_button.js
+++ b/js/components/whitelabel/wallet/components/cyland/ascribe_buttons/cyland_submit_button.js
@@ -39,7 +39,11 @@ let CylandSubmitButton = React.createClass({
return (
{getLangText('Submit to Cyland')}
diff --git a/js/components/whitelabel/wallet/components/cyland/ascribe_detail/cyland_piece_container.js b/js/components/whitelabel/wallet/components/cyland/ascribe_detail/cyland_piece_container.js
index d22d8638..c8011fc7 100644
--- a/js/components/whitelabel/wallet/components/cyland/ascribe_detail/cyland_piece_container.js
+++ b/js/components/whitelabel/wallet/components/cyland/ascribe_detail/cyland_piece_container.js
@@ -20,11 +20,8 @@ import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_de
import DetailProperty from '../../../../../ascribe_detail/detail_property';
import { mergeOptions } from '../../../../../../utils/general_utils';
-import { getLangText } from '../../../../../../utils/lang_utils';
-/**
- * This is the component that implements resource/data specific functionality
- */
+
let CylandPieceContainer = React.createClass({
getInitialState() {
return mergeOptions(
@@ -106,10 +103,11 @@ let CylandPieceDetails = React.createClass({
show={true}
defaultExpanded={true}>