diff --git a/packages/cms/src/api/cmsRoute.js b/packages/cms/src/api/cmsRoute.js
index 297029d5d..ff4dfd3d0 100644
--- a/packages/cms/src/api/cmsRoute.js
+++ b/packages/cms/src/api/cmsRoute.js
@@ -123,7 +123,7 @@ const sortStorySection = (db, storysection) => {
storysection.stats = flatSort(db.storysection_stat, storysection.stats);
storysection.descriptions = flatSort(db.storysection_description, storysection.descriptions);
// ordering is nested in section_selector - bubble for top-level sorting
- storysection.selectors = bubbleSortSelectors(db.storysection_selector, storysection.selectors);
+ storysection.selectors = bubbleSortSelectors(db.storysection_selector, storysection.selectors, "storysection_selector");
return storysection;
};
diff --git a/packages/cms/src/components/interface/SelectorUsage.jsx b/packages/cms/src/components/interface/SelectorUsage.jsx
index b6a2565dc..1a09acc35 100644
--- a/packages/cms/src/components/interface/SelectorUsage.jsx
+++ b/packages/cms/src/components/interface/SelectorUsage.jsx
@@ -9,6 +9,8 @@ import scaffoldDynamic from "../../utils/selectors/scaffoldDynamic";
import {newEntity, deleteEntity, swapEntity} from "../../actions/profiles";
import {setStatus} from "../../actions/status";
+import {SELECTOR_TYPES} from "../../utils/consts/cms";
+
import "./SelectorUsage.css";
class SelectorUsage extends Component {
@@ -22,13 +24,19 @@ class SelectorUsage extends Component {
}
removeItem(id) {
- const {minData} = this.props;
- this.props.deleteEntity("section_selector", {section_id: minData.id, selector_id: id});
+ const {minData, type} = this.props;
+ const payload = type === SELECTOR_TYPES.STORYSECTION_SELECTOR
+ ? {storysection_id: minData.id, story_selector_id: id}
+ : {section_id: minData.id, selector_id: id};
+ this.props.deleteEntity(type, payload);
}
addItem(id) {
- const {minData} = this.props;
- this.props.newEntity("section_selector", {section_id: minData.id, selector_id: id});
+ const {minData, type} = this.props;
+ const payload = type === SELECTOR_TYPES.STORYSECTION_SELECTOR
+ ? {storysection_id: minData.id, story_selector_id: id}
+ : {section_id: minData.id, selector_id: id};
+ this.props.newEntity(type, payload);
}
onChange(name, e) {
@@ -40,7 +48,8 @@ class SelectorUsage extends Component {
}
swapSelector(id) {
- this.props.swapEntity("section_selector", id);
+ const {type} = this.props;
+ this.props.swapEntity(type, id);
}
render() {
@@ -59,7 +68,7 @@ class SelectorUsage extends Component {
if (selector.dynamic) {
if (validateDynamic(variables[selector.dynamic]) === "valid") {
return {...selector, options: scaffoldDynamic(variables[selector.dynamic])};
- }
+ }
else return {...selector, options: []};
}
else return selector;
@@ -103,12 +112,12 @@ class SelectorUsage extends Component {
:
All available selectors have been activated
}
- {(showMore || inactiveSelectors.length > inactiveSelectorsVisible.length) &&
-