scrivito_content_browser 1.2.0 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@
44
44
  /* 0 */
45
45
  /***/ function(module, exports, __webpack_require__) {
46
46
 
47
- /* WEBPACK VAR INJECTION */(function(React) {var AppComponent, DialogApp, Filter, Provider, ReactDOM, ReactRedux, Redux, configureStore;
47
+ /* WEBPACK VAR INJECTION */(function(React) {var AppComponent, DialogApp, Filter, Provider, ReactDOM, ReactRedux, configureStore;
48
48
 
49
49
  ReactDOM = __webpack_require__(153);
50
50
 
@@ -54,13 +54,11 @@
54
54
 
55
55
  AppComponent = __webpack_require__(168);
56
56
 
57
- ReactRedux = __webpack_require__(182);
58
-
59
- Redux = __webpack_require__(190);
57
+ ReactRedux = __webpack_require__(178);
60
58
 
61
59
  Provider = ReactRedux.Provider;
62
60
 
63
- configureStore = __webpack_require__(249);
61
+ configureStore = __webpack_require__(248);
64
62
 
65
63
  scrivito.content_browser = (function() {
66
64
  return {
@@ -183,15 +181,9 @@
183
181
 
184
182
  scrivito.register_public_api("content_browser", scrivito.content_browser);
185
183
 
186
- scrivito.select_content = function() {
187
- return scrivito.content_browser.open({
188
- selectionMode: 'single'
189
- });
190
- };
191
-
192
184
  scrivito.register_browse_content(function() {
193
185
  return scrivito.content_browser.open({
194
- selectionMode: 'multi',
186
+ selection_mode: 'single',
195
187
  standAlone: true
196
188
  });
197
189
  });
@@ -19244,19 +19236,19 @@
19244
19236
  /* 157 */
19245
19237
  /***/ function(module, exports, __webpack_require__) {
19246
19238
 
19247
- var CheckboxFilter, Filter, Listenable, RadioFilter, SortCriteria, TreeFilter,
19239
+ var ASC_SORT_ORDER, CheckboxFilter, Filter, Listenable, RadioFilter, TreeFilter,
19248
19240
  __hasProp = {}.hasOwnProperty,
19249
19241
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19250
19242
 
19251
19243
  Listenable = __webpack_require__(158);
19252
19244
 
19253
- SortCriteria = __webpack_require__(159);
19245
+ RadioFilter = __webpack_require__(159);
19254
19246
 
19255
- RadioFilter = __webpack_require__(160);
19247
+ TreeFilter = __webpack_require__(163);
19256
19248
 
19257
- TreeFilter = __webpack_require__(164);
19249
+ CheckboxFilter = __webpack_require__(164);
19258
19250
 
19259
- CheckboxFilter = __webpack_require__(165);
19251
+ ASC_SORT_ORDER = __webpack_require__(166).ASC_SORT_ORDER;
19260
19252
 
19261
19253
  Filter = (function(_super) {
19262
19254
  __extends(Filter, _super);
@@ -19280,17 +19272,9 @@
19280
19272
 
19281
19273
  Filter.prototype.setSearchTerm = function(newTerm) {
19282
19274
  this.searchTerm = newTerm;
19283
- this.sortCriteria = new SortCriteria("relevance", void 0, "Relevance");
19284
19275
  return this.changed();
19285
19276
  };
19286
19277
 
19287
- Filter.prototype.setSortCriteria = function(sortCriteria) {
19288
- if (!this.sortCriteria.equals(sortCriteria)) {
19289
- this.sortCriteria = sortCriteria;
19290
- return this.changed();
19291
- }
19292
- };
19293
-
19294
19278
  Filter.prototype.getAllFilters = function() {
19295
19279
  return _.union(this.getHierarchicalFilters(), this.additionalFilters);
19296
19280
  };
@@ -19323,7 +19307,6 @@
19323
19307
  var definition, name, subFilters, _results;
19324
19308
  this.treeFilters = [];
19325
19309
  this.additionalFilters = [];
19326
- this.sortCriteria = new SortCriteria();
19327
19310
  _results = [];
19328
19311
  for (name in filterDefinition) {
19329
19312
  if (!__hasProp.call(filterDefinition, name)) continue;
@@ -19416,72 +19399,15 @@
19416
19399
 
19417
19400
  /***/ },
19418
19401
  /* 159 */
19419
- /***/ function(module, exports) {
19420
-
19421
- var SortCriteria;
19422
-
19423
- SortCriteria = (function() {
19424
- function SortCriteria(type, reverse, activeElement, activeSortItemGroupTitle) {
19425
- if (reverse == null) {
19426
- reverse = true;
19427
- }
19428
- if (type == null) {
19429
- type = "_last_changed";
19430
- }
19431
- if (activeElement == null) {
19432
- activeElement = "Last change: latest first";
19433
- }
19434
- if (activeSortItemGroupTitle == null) {
19435
- activeSortItemGroupTitle = "Sort by date";
19436
- }
19437
- this._activeSortItemGroupTitle = activeSortItemGroupTitle;
19438
- this._activeElement = activeElement;
19439
- this._isReverse = reverse;
19440
- this._type = type;
19441
- }
19442
-
19443
- SortCriteria.prototype.isReverse = function() {
19444
- return this._isReverse;
19445
- };
19446
-
19447
- SortCriteria.prototype.type = function() {
19448
- return this._type;
19449
- };
19450
-
19451
- SortCriteria.prototype.isSortedDesc = function() {
19452
- return this._type === "relevance" || !this._isReverse;
19453
- };
19454
-
19455
- SortCriteria.prototype.activeElement = function() {
19456
- return this._activeElement;
19457
- };
19458
-
19459
- SortCriteria.prototype.activeSortItemGroupTitle = function() {
19460
- return this._activeSortItemGroupTitle;
19461
- };
19462
-
19463
- SortCriteria.prototype.equals = function(sortCriteria) {
19464
- return sortCriteria.type() === this._type && sortCriteria.isReverse() === this._isReverse;
19465
- };
19466
-
19467
- return SortCriteria;
19468
-
19469
- })();
19470
-
19471
- module.exports = SortCriteria;
19472
-
19473
-
19474
- /***/ },
19475
- /* 160 */
19476
19402
  /***/ function(module, exports, __webpack_require__) {
19477
19403
 
19478
19404
  var FilterCollectionNode, RadioFilter, RadioOption,
19479
19405
  __hasProp = {}.hasOwnProperty,
19480
19406
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19481
19407
 
19482
- FilterCollectionNode = __webpack_require__(161);
19408
+ FilterCollectionNode = __webpack_require__(160);
19483
19409
 
19484
- RadioOption = __webpack_require__(163);
19410
+ RadioOption = __webpack_require__(162);
19485
19411
 
19486
19412
  RadioFilter = (function(_super) {
19487
19413
  __extends(RadioFilter, _super);
@@ -19516,14 +19442,14 @@
19516
19442
 
19517
19443
 
19518
19444
  /***/ },
19519
- /* 161 */
19445
+ /* 160 */
19520
19446
  /***/ function(module, exports, __webpack_require__) {
19521
19447
 
19522
19448
  var FilterCollectionNode, FilterNode,
19523
19449
  __hasProp = {}.hasOwnProperty,
19524
19450
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19525
19451
 
19526
- FilterNode = __webpack_require__(162);
19452
+ FilterNode = __webpack_require__(161);
19527
19453
 
19528
19454
  FilterCollectionNode = (function(_super) {
19529
19455
  __extends(FilterCollectionNode, _super);
@@ -19559,7 +19485,7 @@
19559
19485
 
19560
19486
 
19561
19487
  /***/ },
19562
- /* 162 */
19488
+ /* 161 */
19563
19489
  /***/ function(module, exports) {
19564
19490
 
19565
19491
  var FilterNode;
@@ -19588,14 +19514,14 @@
19588
19514
 
19589
19515
 
19590
19516
  /***/ },
19591
- /* 163 */
19517
+ /* 162 */
19592
19518
  /***/ function(module, exports, __webpack_require__) {
19593
19519
 
19594
19520
  var FilterNode, RadioOption,
19595
19521
  __hasProp = {}.hasOwnProperty,
19596
19522
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19597
19523
 
19598
- FilterNode = __webpack_require__(162);
19524
+ FilterNode = __webpack_require__(161);
19599
19525
 
19600
19526
  RadioOption = (function(_super) {
19601
19527
  __extends(RadioOption, _super);
@@ -19623,14 +19549,14 @@
19623
19549
 
19624
19550
 
19625
19551
  /***/ },
19626
- /* 164 */
19552
+ /* 163 */
19627
19553
  /***/ function(module, exports, __webpack_require__) {
19628
19554
 
19629
19555
  var FilterNode, TreeFilter,
19630
19556
  __hasProp = {}.hasOwnProperty,
19631
19557
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19632
19558
 
19633
- FilterNode = __webpack_require__(162);
19559
+ FilterNode = __webpack_require__(161);
19634
19560
 
19635
19561
  TreeFilter = (function(_super) {
19636
19562
  __extends(TreeFilter, _super);
@@ -19690,16 +19616,16 @@
19690
19616
 
19691
19617
 
19692
19618
  /***/ },
19693
- /* 165 */
19619
+ /* 164 */
19694
19620
  /***/ function(module, exports, __webpack_require__) {
19695
19621
 
19696
19622
  var CheckboxFilter, CheckboxOption, FilterCollectionNode,
19697
19623
  __hasProp = {}.hasOwnProperty,
19698
19624
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19699
19625
 
19700
- CheckboxOption = __webpack_require__(166);
19626
+ CheckboxOption = __webpack_require__(165);
19701
19627
 
19702
- FilterCollectionNode = __webpack_require__(161);
19628
+ FilterCollectionNode = __webpack_require__(160);
19703
19629
 
19704
19630
  CheckboxFilter = (function(_super) {
19705
19631
  __extends(CheckboxFilter, _super);
@@ -19722,14 +19648,14 @@
19722
19648
 
19723
19649
 
19724
19650
  /***/ },
19725
- /* 166 */
19651
+ /* 165 */
19726
19652
  /***/ function(module, exports, __webpack_require__) {
19727
19653
 
19728
19654
  var CheckboxOption, FilterNode,
19729
19655
  __hasProp = {}.hasOwnProperty,
19730
19656
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
19731
19657
 
19732
- FilterNode = __webpack_require__(162);
19658
+ FilterNode = __webpack_require__(161);
19733
19659
 
19734
19660
  CheckboxOption = (function(_super) {
19735
19661
  __extends(CheckboxOption, _super);
@@ -19756,6 +19682,55 @@
19756
19682
  module.exports = CheckboxOption;
19757
19683
 
19758
19684
 
19685
+ /***/ },
19686
+ /* 166 */
19687
+ /***/ function(module, exports) {
19688
+
19689
+ var ASC_SORT_ORDER, CHANGE_SORT_ORDER, DESC_SORT_ORDER, sortInAscOrder, sortInDescOrder, _changeSortOrder;
19690
+
19691
+ CHANGE_SORT_ORDER = 'CHANGE_SORT_ORDER';
19692
+
19693
+ ASC_SORT_ORDER = 'asc';
19694
+
19695
+ DESC_SORT_ORDER = 'desc';
19696
+
19697
+ _changeSortOrder = (function(_this) {
19698
+ return function(criteriaType, sortDirection) {
19699
+ return {
19700
+ type: CHANGE_SORT_ORDER,
19701
+ criteriaType: criteriaType,
19702
+ sortDirection: sortDirection
19703
+ };
19704
+ };
19705
+ })(this);
19706
+
19707
+ sortInAscOrder = (function(_this) {
19708
+ return function(criteriaType, filter) {
19709
+ return function(dispatch, getState) {
19710
+ dispatch(_changeSortOrder(criteriaType, ASC_SORT_ORDER));
19711
+ return filter.trigger("reduxStateChanged", filter);
19712
+ };
19713
+ };
19714
+ })(this);
19715
+
19716
+ sortInDescOrder = (function(_this) {
19717
+ return function(criteriaType, filter) {
19718
+ return function(dispatch, getState) {
19719
+ dispatch(_changeSortOrder(criteriaType, DESC_SORT_ORDER));
19720
+ return filter.trigger("reduxStateChanged", filter);
19721
+ };
19722
+ };
19723
+ })(this);
19724
+
19725
+ module.exports = {
19726
+ CHANGE_SORT_ORDER: CHANGE_SORT_ORDER,
19727
+ ASC_SORT_ORDER: ASC_SORT_ORDER,
19728
+ DESC_SORT_ORDER: DESC_SORT_ORDER,
19729
+ sortInDescOrder: sortInDescOrder,
19730
+ sortInAscOrder: sortInAscOrder
19731
+ };
19732
+
19733
+
19759
19734
  /***/ },
19760
19735
  /* 167 */
19761
19736
  /***/ function(module, exports) {
@@ -19821,31 +19796,31 @@
19821
19796
  /* 168 */
19822
19797
  /***/ function(module, exports, __webpack_require__) {
19823
19798
 
19824
- /* WEBPACK VAR INJECTION */(function(React) {var AddedObjsCollection, App, AppContainer, Filter, Footer, InspectorComponent, Items, MoreItemsSpinner, ObjCollection, ReactRedux, TopBar, disableTags, fetchTags, redux, setLastAddedVisibility, _ref;
19799
+ /* WEBPACK VAR INJECTION */(function(React) {var App, AppContainer, Filter, Footer, InspectorComponent, Items, MoreItemsSpinner, ObjCollection, ReactRedux, TopBar, createObj, disableTags, fetchTags, objDeleted, redux, setLastAddedVisibility, _ref, _ref1;
19825
19800
 
19826
- AddedObjsCollection = __webpack_require__(169);
19801
+ ObjCollection = __webpack_require__(169);
19827
19802
 
19828
- ObjCollection = __webpack_require__(178);
19803
+ TopBar = __webpack_require__(176);
19829
19804
 
19830
- TopBar = __webpack_require__(180);
19805
+ Filter = __webpack_require__(201);
19831
19806
 
19832
- Filter = __webpack_require__(205);
19807
+ Items = __webpack_require__(213);
19833
19808
 
19834
- Items = __webpack_require__(217);
19809
+ MoreItemsSpinner = __webpack_require__(239);
19835
19810
 
19836
- MoreItemsSpinner = __webpack_require__(242);
19811
+ InspectorComponent = __webpack_require__(240);
19837
19812
 
19838
- InspectorComponent = __webpack_require__(243);
19813
+ Footer = __webpack_require__(244);
19839
19814
 
19840
- Footer = __webpack_require__(247);
19815
+ ReactRedux = __webpack_require__(178);
19841
19816
 
19842
- ReactRedux = __webpack_require__(182);
19817
+ redux = __webpack_require__(186);
19843
19818
 
19844
- redux = __webpack_require__(190);
19819
+ setLastAddedVisibility = __webpack_require__(245).setLastAddedVisibility;
19845
19820
 
19846
- setLastAddedVisibility = __webpack_require__(248).setLastAddedVisibility;
19821
+ _ref = __webpack_require__(246), createObj = _ref.createObj, objDeleted = _ref.objDeleted;
19847
19822
 
19848
- _ref = __webpack_require__(241), fetchTags = _ref.fetchTags, disableTags = _ref.disableTags;
19823
+ _ref1 = __webpack_require__(238), fetchTags = _ref1.fetchTags, disableTags = _ref1.disableTags;
19849
19824
 
19850
19825
  App = React.createClass({
19851
19826
  displayName: 'App',
@@ -19854,55 +19829,26 @@
19854
19829
  filter: filter
19855
19830
  });
19856
19831
  },
19832
+ createObj: function(attributes, basePreset, preset, activeTags) {
19833
+ this.props.dispatch(createObj(attributes, basePreset, preset, activeTags));
19834
+ return this.refs.filterView.activateLastAddedFilter();
19835
+ },
19857
19836
  updateObjCollection: function(objCollection) {
19858
19837
  return this.setState({
19859
19838
  objCollection: objCollection
19860
19839
  });
19861
19840
  },
19862
- updateAddedObjsCollection: function(addedObjsCollection) {
19863
- this.setState({
19864
- addedObjsCollection: addedObjsCollection
19865
- });
19866
- if (!addedObjsCollection.hasActiveCreations()) {
19867
- if (this.props.lastAdded.isVisible) {
19868
- return this._setObjsCollection();
19869
- } else {
19870
- this._selectLatestAddedObj(addedObjsCollection);
19871
- return this.state.objCollection.reload();
19872
- }
19873
- }
19874
- },
19875
19841
  updateLastAdded: function(showLastAdded) {
19876
- this.props.dispatch(setLastAddedVisibility(showLastAdded));
19877
- if (showLastAdded && !this.state.addedObjsCollection.hasActiveCreations()) {
19878
- return this._setObjsCollection();
19879
- }
19842
+ return this.props.dispatch(setLastAddedVisibility(showLastAdded));
19880
19843
  },
19881
19844
  destroyAddedObj: function(objId) {
19882
- this.state.addedObjsCollection.destroyCreatedObjById(objId);
19883
- if (this.props.lastAdded.isVisible) {
19884
- return this._setObjsCollection();
19885
- }
19845
+ return this.props.dispatch(objDeleted(objId));
19886
19846
  },
19887
19847
  activateInitialFilter: function() {
19888
19848
  if (this.refs.filterView.activateInitialFilter) {
19889
19849
  return this.refs.filterView.activateInitialFilter();
19890
19850
  }
19891
19851
  },
19892
- _setObjsCollection: function() {
19893
- var objs;
19894
- objs = this.state.addedObjsCollection.createdObjs();
19895
- return this.state.objCollection.setObjs(objs);
19896
- },
19897
- _selectLatestAddedObj: function(addedObjsCollection) {
19898
- var lastCreatedObj;
19899
- if (this.refs.filterView.state.selectedFilter === false) {
19900
- lastCreatedObj = _.first(addedObjsCollection.createdObjs());
19901
- if (lastCreatedObj) {
19902
- return this.state.objCollection.toggleSelected(lastCreatedObj.id());
19903
- }
19904
- }
19905
- },
19906
19852
  disableTagBar: function() {
19907
19853
  return this.props.dispatch(disableTags());
19908
19854
  },
@@ -19911,21 +19857,18 @@
19911
19857
  },
19912
19858
  componentDidMount: function() {
19913
19859
  this.state.filter.onChange(this.updateFilter);
19914
- this.state.addedObjsCollection.onChange(this.updateAddedObjsCollection);
19915
19860
  this.state.objCollection.onChange(this.updateObjCollection);
19916
19861
  this.state.objCollection.on('destroy-obj', this.destroyAddedObj);
19917
19862
  return this.activateInitialFilter();
19918
19863
  },
19919
19864
  getInitialState: function() {
19920
- var basePreset, initialSelection, selectionMode;
19865
+ var initialSelection, selectionMode;
19921
19866
  initialSelection = this.props.options.selection || [];
19922
19867
  selectionMode = this.props.options.selection_mode;
19923
- basePreset = this.props.options.base_preset;
19924
19868
  return {
19925
19869
  filter: this.props.initialFilter,
19926
19870
  objs: [],
19927
19871
  sortCriteria: this.props.initialFilter.sortCriteria,
19928
- addedObjsCollection: new AddedObjsCollection(basePreset),
19929
19872
  objCollection: new ObjCollection(initialSelection, selectionMode)
19930
19873
  };
19931
19874
  },
@@ -19944,8 +19887,9 @@
19944
19887
  }, React.createElement("div", {
19945
19888
  "className": "scrivito-content-browser-wrapper"
19946
19889
  }, React.createElement(TopBar, {
19890
+ "dispatch": this.props.dispatch,
19947
19891
  "filter": this.state.filter,
19948
- "sortCriteria": this.state.sortCriteria,
19892
+ "sortCriteria": this.props.sortCriteria,
19949
19893
  "viewMode": this.props.objDisplay.viewMode
19950
19894
  }), React.createElement(Filter, {
19951
19895
  "ref": "filterView",
@@ -19953,22 +19897,25 @@
19953
19897
  "baseQuery": this.props.baseQuery,
19954
19898
  "disableTags": this.disableTagBar,
19955
19899
  "objCollection": this.state.objCollection,
19956
- "activeTags": this.props.tags.activeTags,
19900
+ "tags": this.props.tags,
19957
19901
  "fetchTags": this.fetchTags,
19958
19902
  "standAlone": this.props.options.standAlone,
19959
19903
  "updateLastAdded": this.updateLastAdded,
19960
- "addedObjsCollection": this.state.addedObjsCollection,
19904
+ "sortCriteria": this.props.sortCriteria,
19905
+ "additionCount": this.props.lastAdded.additions.length,
19961
19906
  "dispatch": this.props.dispatch,
19962
19907
  "showLastAdded": this.props.lastAdded.isVisible
19963
19908
  }), React.createElement(Items, {
19909
+ "disableTags": this.disableTagBar,
19964
19910
  "ref": "itemView",
19965
19911
  "objCollection": this.state.objCollection,
19966
- "viewMode": this.props.objDisplay.viewMode,
19967
- "dispatch": this.props.dispatch,
19912
+ "createObj": this.createObj,
19968
19913
  "tags": this.props.tags,
19969
- "addedObjsCollection": this.state.addedObjsCollection,
19970
- "filter": this.state.filter,
19971
- "showLastAdded": this.props.lastAdded.isVisible
19914
+ "dispatch": this.props.dispatch,
19915
+ "basePreset": this.props.options.base_preset,
19916
+ "viewMode": this.props.objDisplay.viewMode,
19917
+ "lastAdded": this.props.lastAdded,
19918
+ "filter": this.state.filter
19972
19919
  }), (this.state.objCollection.isLoadingAdditionalObjs() ? React.createElement(MoreItemsSpinner, {
19973
19920
  "objCollection": this.state.objCollection
19974
19921
  }) : void 0)), React.createElement(InspectorComponent, {
@@ -19996,226 +19943,242 @@
19996
19943
  /* 169 */
19997
19944
  /***/ function(module, exports, __webpack_require__) {
19998
19945
 
19999
- var AddedObj, AddedObjsCollection, Listenable,
19946
+ var Deleter, Listenable, Obj, ObjCollection,
20000
19947
  __hasProp = {}.hasOwnProperty,
20001
19948
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
20002
19949
 
20003
- AddedObj = __webpack_require__(170);
20004
-
20005
19950
  Listenable = __webpack_require__(158);
20006
19951
 
20007
- AddedObjsCollection = (function(_super) {
20008
- __extends(AddedObjsCollection, _super);
19952
+ Obj = __webpack_require__(170);
20009
19953
 
20010
- function AddedObjsCollection(basePreset) {
20011
- if (basePreset == null) {
20012
- basePreset = {};
20013
- }
20014
- AddedObjsCollection.__super__.constructor.call(this);
20015
- this._basePreset = basePreset;
20016
- this._objs = [];
19954
+ Deleter = __webpack_require__(171);
19955
+
19956
+ ObjCollection = (function(_super) {
19957
+ __extends(ObjCollection, _super);
19958
+
19959
+ function ObjCollection(selectedObjsIds, _selectionMode, objs) {
19960
+ this._selectionMode = _selectionMode;
19961
+ ObjCollection.__super__.constructor.call(this);
19962
+ this._selectionMode || (this._selectionMode = 'multi');
19963
+ this._selectedObjsIds = selectedObjsIds || [];
19964
+ this._objs = objs || [];
19965
+ this._isAlreadyReversed = false;
19966
+ this._curQueryNumber = 0;
20017
19967
  }
20018
19968
 
20019
- AddedObjsCollection.prototype.objs = function() {
19969
+ ObjCollection.prototype.objs = function() {
20020
19970
  return this._objs;
20021
19971
  };
20022
19972
 
20023
- AddedObjsCollection.prototype.createdObjs = function() {
20024
- return _.map(this._completedObjs(), function(addedObj) {
20025
- return addedObj.createdObj();
20026
- });
19973
+ ObjCollection.prototype.hasMoreItems = function() {
19974
+ return this._nextQuery != null;
20027
19975
  };
20028
19976
 
20029
- AddedObjsCollection.prototype.count = function() {
20030
- return this.objs().length;
19977
+ ObjCollection.prototype.selectedObjsIds = function() {
19978
+ return this._selectedObjsIds;
20031
19979
  };
20032
19980
 
20033
- AddedObjsCollection.prototype.isEmpty = function() {
20034
- return this.count() === 0;
19981
+ ObjCollection.prototype.isSingleElementSelected = function() {
19982
+ return this.getSelectedObjs().length === 1;
20035
19983
  };
20036
19984
 
20037
- AddedObjsCollection.prototype.addFiles = function(files, presets) {
20038
- if (presets == null) {
20039
- presets = {};
20040
- }
20041
- presets = this._buildPresets(presets);
20042
- _.each(files, (function(_this) {
20043
- return function(file) {
20044
- return _this._objs.unshift(new AddedObj(_this, file, presets));
19985
+ ObjCollection.prototype.getSelectedObjs = function() {
19986
+ var selectedObjs;
19987
+ selectedObjs = [];
19988
+ _.each(this._selectedObjsIds, (function(_this) {
19989
+ return function(selected) {
19990
+ var selectedObj;
19991
+ selectedObj = _.find(_this._objs, function(obj) {
19992
+ if (obj != null) {
19993
+ return obj.id() === selected;
19994
+ }
19995
+ });
19996
+ if (selectedObj != null) {
19997
+ return selectedObjs.push(selectedObj);
19998
+ }
20045
19999
  };
20046
20000
  })(this));
20047
- return this.changed();
20048
- };
20049
-
20050
- AddedObjsCollection.prototype.destroyCreatedObjById = function(objId) {
20051
- var addedObj;
20052
- addedObj = _.find(this._objs, function(addedObj) {
20053
- return addedObj.createdObj().id() === objId;
20054
- });
20055
- if (addedObj != null) {
20056
- return this._objs = _.without(this._objs, addedObj);
20057
- }
20058
- };
20059
-
20060
- AddedObjsCollection.prototype.createObj = function(presets) {
20061
- var addedItem;
20062
- presets = this._buildPresets(presets);
20063
- addedItem = new AddedObj(this, null, presets);
20064
- this._objs.unshift(addedItem);
20065
- this.changed();
20066
- return addedItem;
20067
- };
20068
-
20069
- AddedObjsCollection.prototype.hasActiveCreations = function() {
20070
- return _.some(this._objs, function(upload) {
20071
- return upload.status() === 'active';
20072
- });
20073
- };
20074
-
20075
- AddedObjsCollection.prototype.hasFailedCreations = function() {
20076
- return this.getFailedObjs().length > 0;
20001
+ return selectedObjs;
20077
20002
  };
20078
20003
 
20079
- AddedObjsCollection.prototype.getFailedObjs = function() {
20080
- return _.filter(this._objs, function(upload) {
20081
- return upload.status() === 'failed';
20082
- });
20004
+ ObjCollection.prototype.deselectObjs = function() {
20005
+ return this._selectedObjsIds = [];
20083
20006
  };
20084
20007
 
20085
- AddedObjsCollection.prototype._completedObjs = function() {
20086
- return _.filter(this._objs, function(addedObj) {
20087
- return addedObj.status() === "completed";
20088
- });
20008
+ ObjCollection.prototype.isLoading = function() {
20009
+ return !!this._isLoading;
20089
20010
  };
20090
20011
 
20091
- AddedObjsCollection.prototype._buildPresets = function(presets) {
20092
- return _.extend({}, this._basePreset, presets);
20012
+ ObjCollection.prototype.isLoadingAdditionalObjs = function() {
20013
+ return !!this._isLoadingAdditionalObjs;
20093
20014
  };
20094
20015
 
20095
- return AddedObjsCollection;
20096
-
20097
- })(Listenable);
20098
-
20099
- module.exports = AddedObjsCollection;
20100
-
20101
-
20102
- /***/ },
20103
- /* 170 */
20104
- /***/ function(module, exports, __webpack_require__) {
20105
-
20106
- var AddedObj, Fetcher, Obj, QueryBuilder;
20107
-
20108
- Obj = __webpack_require__(171);
20109
-
20110
- QueryBuilder = __webpack_require__(172);
20111
-
20112
- Fetcher = __webpack_require__(176);
20113
-
20114
- AddedObj = (function() {
20115
- function AddedObj(addedObjsCollection, file, presetAttributes) {
20116
- var objAttributes;
20117
- this.addedObjsCollection = addedObjsCollection;
20118
- this.presetAttributes = presetAttributes != null ? presetAttributes : {};
20119
- this._fetcher = new Fetcher();
20120
- this._fetcher.onChange((function(_this) {
20121
- return function() {
20122
- return _this._setObj();
20123
- };
20124
- })(this));
20125
- this._updateProgressByStatus();
20126
- this._fileName = file != null ? file.name : void 0;
20127
- this._uniqueId = _.uniqueId("added_obj_");
20128
- objAttributes = this._buildObjAttributes(file, this.presetAttributes);
20129
- scrivito.create_obj(objAttributes).done((function(_this) {
20130
- return function(objData) {
20131
- _this._progress = 50;
20132
- _this.addedObjsCollection.changed();
20133
- return _this._fetcher.fetch(objData.id);
20134
- };
20135
- })(this)).fail((function(_this) {
20136
- return function(failure) {
20137
- _this._failureMessage = failure.message;
20138
- return _this._fetcher.fail();
20139
- };
20140
- })(this));
20141
- }
20142
-
20143
- AddedObj.prototype.status = function() {
20144
- return this._fetcher.status();
20016
+ ObjCollection.prototype.reload = function() {
20017
+ if (this._query) {
20018
+ return this.loadFromBackend(this._query);
20019
+ } else {
20020
+ return this._resetObjsCollectionParams();
20021
+ }
20145
20022
  };
20146
20023
 
20147
- AddedObj.prototype.createdObj = function() {
20148
- return this._obj;
20024
+ ObjCollection.prototype.isSingleSelectionMode = function() {
20025
+ return this._selectionMode === 'single';
20149
20026
  };
20150
20027
 
20151
- AddedObj.prototype.failureMessage = function() {
20152
- return this._failureMessage;
20028
+ ObjCollection.prototype.loadFromBackend = function(query) {
20029
+ this._query = query;
20030
+ this._curQueryNumber += 1;
20031
+ this._resetLoadingState();
20032
+ if (query) {
20033
+ this._activateLoading();
20034
+ return this._initialLoadObjs(query, this._curQueryNumber);
20035
+ } else {
20036
+ this._objs = [];
20037
+ return this.changed();
20038
+ }
20153
20039
  };
20154
20040
 
20155
- AddedObj.prototype.fileName = function() {
20156
- return this._fileName;
20041
+ ObjCollection.prototype.toggleSelected = function(obj) {
20042
+ if (this.isSelected(obj.id())) {
20043
+ this._selectedObjsIds = _.without(this._selectedObjsIds, obj.id());
20044
+ } else {
20045
+ if (this.isSingleSelectionMode()) {
20046
+ this._selectedObjsIds = [obj.id()];
20047
+ } else {
20048
+ this._selectedObjsIds.push(obj.id());
20049
+ }
20050
+ }
20051
+ if (!this.isPresentInObjCollection(obj)) {
20052
+ this._objs.push(obj);
20053
+ }
20054
+ return this.changed();
20157
20055
  };
20158
20056
 
20159
- AddedObj.prototype.progress = function() {
20160
- return this._progress;
20057
+ ObjCollection.prototype.isPresentInObjCollection = function(obj) {
20058
+ return _.where(this._objs, obj).length > 0;
20161
20059
  };
20162
20060
 
20163
- AddedObj.prototype.uniqueId = function() {
20164
- return this._uniqueId;
20061
+ ObjCollection.prototype.isSelected = function(objId) {
20062
+ return _.contains(this._selectedObjsIds, objId);
20165
20063
  };
20166
20064
 
20167
- AddedObj.prototype._setObj = function() {
20168
- if (this.status() === 'completed') {
20169
- this._obj = new Obj(this._fetcher.obj());
20065
+ ObjCollection.prototype.loadNextPage = function() {
20066
+ var queryNumber;
20067
+ if (this.hasMoreItems() && !this.isLoadingAdditionalObjs()) {
20068
+ this._activateIsLoadingAdditionalObjs();
20069
+ queryNumber = this._curQueryNumber;
20070
+ return this._nextQuery.load_batch().done((function(_this) {
20071
+ return function(results, next) {
20072
+ return _this._setAndLoadObjs(results, next, queryNumber);
20073
+ };
20074
+ })(this)).fail((function(_this) {
20075
+ return function() {
20076
+ _this._resetLoadingState();
20077
+ return _this.changed();
20078
+ };
20079
+ })(this));
20170
20080
  }
20171
- return this._updateStatus();
20172
20081
  };
20173
20082
 
20174
- AddedObj.prototype._updateProgressByStatus = function() {
20175
- return this._progress = (function() {
20176
- switch (this.status()) {
20177
- case 'active':
20178
- return 10;
20179
- case 'completed':
20180
- return 100;
20181
- case 'failed':
20182
- return 0;
20183
- }
20184
- }).call(this);
20083
+ ObjCollection.prototype.destroySelectedObjs = function() {
20084
+ var deferreds;
20085
+ if (this._selectedObjsIds.length > 0) {
20086
+ deferreds = _.map(this._selectedObjsIds, (function(_this) {
20087
+ return function(objId) {
20088
+ return _this._destroyById(objId);
20089
+ };
20090
+ })(this));
20091
+ $.when.apply($, deferreds).always((function(_this) {
20092
+ return function() {
20093
+ return _this.reload();
20094
+ };
20095
+ })(this));
20096
+ return this._activateLoading();
20097
+ }
20185
20098
  };
20186
20099
 
20187
- AddedObj.prototype._updateStatus = function() {
20188
- this._updateProgressByStatus();
20189
- return this.addedObjsCollection.changed();
20100
+ ObjCollection.prototype._destroyById = function(objId) {
20101
+ var deleter;
20102
+ deleter = new Deleter(objId);
20103
+ return deleter.deleteObj().always((function(_this) {
20104
+ return function() {
20105
+ _this._objs = _this._objs.filter(function(obj) {
20106
+ return obj.id() !== objId;
20107
+ });
20108
+ _this._selectedObjsIds = _this._selectedObjsIds.filter(function(selectedObjId) {
20109
+ return selectedObjId !== objId;
20110
+ });
20111
+ return _this.trigger('destroy-obj', objId);
20112
+ };
20113
+ })(this));
20190
20114
  };
20191
20115
 
20192
- AddedObj.prototype._buildObjAttributes = function(file, presetAttributes) {
20193
- var objAttributes;
20194
- objAttributes = {};
20195
- if (file) {
20196
- _.extend(objAttributes, this._fileAttributes(file));
20197
- }
20198
- return _.extend(objAttributes, presetAttributes);
20116
+ ObjCollection.prototype._resetLoadingState = function() {
20117
+ this._nextQuery = null;
20118
+ this._isLoadingAdditionalObjs = false;
20119
+ return this._isLoading = false;
20199
20120
  };
20200
20121
 
20201
- AddedObj.prototype._fileAttributes = function(file) {
20202
- var objClass;
20203
- objClass = scrivito.default_obj_class_for_content_type(file.type);
20204
- return {
20205
- blob: file,
20206
- _obj_class: objClass
20207
- };
20122
+ ObjCollection.prototype._initialLoadObjs = function(query, queryNumber) {
20123
+ return query.load_batch().done((function(_this) {
20124
+ return function(results, next) {
20125
+ _this._isLoading = false;
20126
+ if (queryNumber === _this._curQueryNumber) {
20127
+ _this._objs = [];
20128
+ return _this._setAndLoadObjs(results, next, queryNumber);
20129
+ }
20130
+ };
20131
+ })(this)).fail((function(_this) {
20132
+ return function() {
20133
+ _this._resetLoadingState();
20134
+ return _this.changed();
20135
+ };
20136
+ })(this));
20137
+ };
20138
+
20139
+ ObjCollection.prototype._setAndLoadObjs = function(results, next, queryNumber) {
20140
+ var curObjs;
20141
+ if (queryNumber === this._curQueryNumber) {
20142
+ this._isLoadingAdditionalObjs = false;
20143
+ curObjs = _.map(results.hits, function(attr) {
20144
+ return new Obj(attr);
20145
+ });
20146
+ this._objs = this._objs.concat(curObjs);
20147
+ this._nextQuery = next;
20148
+ return this.changed();
20149
+ }
20208
20150
  };
20209
20151
 
20210
- return AddedObj;
20152
+ ObjCollection.prototype._activateLoading = function() {
20153
+ if (!this.isLoading()) {
20154
+ this._isLoading = true;
20155
+ return this.changed();
20156
+ }
20157
+ };
20211
20158
 
20212
- })();
20159
+ ObjCollection.prototype._resetObjsCollectionParams = function() {
20160
+ this._query = null;
20161
+ this.deselectObjs();
20162
+ this._resetLoadingState();
20163
+ return this.changed();
20164
+ };
20213
20165
 
20214
- module.exports = AddedObj;
20166
+ ObjCollection.prototype._activateIsLoadingAdditionalObjs = function() {
20167
+ if (!this.isLoadingAdditionalObjs()) {
20168
+ this._isLoadingAdditionalObjs = true;
20169
+ return this.changed();
20170
+ }
20171
+ };
20172
+
20173
+ return ObjCollection;
20174
+
20175
+ })(Listenable);
20176
+
20177
+ module.exports = ObjCollection;
20215
20178
 
20216
20179
 
20217
20180
  /***/ },
20218
- /* 171 */
20181
+ /* 170 */
20219
20182
  /***/ function(module, exports) {
20220
20183
 
20221
20184
  var Obj;
@@ -20282,21 +20245,91 @@
20282
20245
  module.exports = Obj;
20283
20246
 
20284
20247
 
20248
+ /***/ },
20249
+ /* 171 */
20250
+ /***/ function(module, exports, __webpack_require__) {
20251
+
20252
+ var Deleter, QueryBuilder;
20253
+
20254
+ QueryBuilder = __webpack_require__(172);
20255
+
20256
+ Deleter = (function() {
20257
+ Deleter.prototype.MAX_RETRY = 5;
20258
+
20259
+ Deleter.prototype.TIMEOUT = 500;
20260
+
20261
+ function Deleter(objId) {
20262
+ this.objId = objId;
20263
+ this._promise = $.Deferred();
20264
+ }
20265
+
20266
+ Deleter.prototype.deleteObj = function() {
20267
+ scrivito.delete_obj(this.objId).then((function(_this) {
20268
+ return function() {
20269
+ return _this._checkDelete();
20270
+ };
20271
+ })(this), (function(_this) {
20272
+ return function() {
20273
+ return _this._promise.reject();
20274
+ };
20275
+ })(this));
20276
+ return this._promise;
20277
+ };
20278
+
20279
+ Deleter.prototype._checkDelete = function(retryCount) {
20280
+ if (retryCount == null) {
20281
+ retryCount = 0;
20282
+ }
20283
+ return QueryBuilder.byId(this.objId).load_batch().then(((function(_this) {
20284
+ return function(searchResult) {
20285
+ if (searchResult.hits.length === 0) {
20286
+ return _this._promise.resolve();
20287
+ } else {
20288
+ return _this._reCheck(retryCount, function() {
20289
+ return _this._checkDelete(retryCount + 1);
20290
+ });
20291
+ }
20292
+ };
20293
+ })(this)));
20294
+ };
20295
+
20296
+ Deleter.prototype._reCheck = function(retryCount, fetchObjFunction) {
20297
+ if (retryCount < this.MAX_RETRY) {
20298
+ return window.setTimeout(fetchObjFunction, this.TIMEOUT);
20299
+ } else {
20300
+ return this._promise.reject();
20301
+ }
20302
+ };
20303
+
20304
+ return Deleter;
20305
+
20306
+ })();
20307
+
20308
+ module.exports = Deleter;
20309
+
20310
+
20285
20311
  /***/ },
20286
20312
  /* 172 */
20287
20313
  /***/ function(module, exports, __webpack_require__) {
20288
20314
 
20289
- var ActiveNodeConfigCollector, NullQuery, QueryBuilder;
20315
+ var ASC_SORT_ORDER, ActiveNodeConfigCollector, DESC_SORT_ORDER, NullQuery, QueryBuilder, _ref;
20290
20316
 
20291
20317
  ActiveNodeConfigCollector = __webpack_require__(173);
20292
20318
 
20293
20319
  NullQuery = __webpack_require__(175);
20294
20320
 
20321
+ _ref = __webpack_require__(166), DESC_SORT_ORDER = _ref.DESC_SORT_ORDER, ASC_SORT_ORDER = _ref.ASC_SORT_ORDER;
20322
+
20295
20323
  QueryBuilder = (function() {
20296
- function QueryBuilder(filter, baseQuery, tags) {
20324
+ function QueryBuilder(filter, baseQuery, tags, sortCriteria) {
20297
20325
  this.filter = filter;
20298
20326
  this.tags = tags;
20327
+ this.sortCriteria = sortCriteria;
20299
20328
  this._collector = new ActiveNodeConfigCollector(this.filter);
20329
+ this.sortCriteria || (this.sortCriteria = {
20330
+ sortField: '_last_changed',
20331
+ sortDirection: DESC_SORT_ORDER
20332
+ });
20300
20333
  if (baseQuery) {
20301
20334
  this._baseQuery = QueryBuilder.prepareQuery(baseQuery);
20302
20335
  }
@@ -20321,11 +20354,11 @@
20321
20354
  };
20322
20355
 
20323
20356
  QueryBuilder.prototype._addFilterQueries = function(baseQuery) {
20324
- var activeConfig, combinedQuery, searchQuery, _i, _len, _ref;
20357
+ var activeConfig, combinedQuery, searchQuery, _i, _len, _ref1;
20325
20358
  combinedQuery = baseQuery;
20326
- _ref = this._collector.findActiveFilterItems();
20327
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
20328
- activeConfig = _ref[_i];
20359
+ _ref1 = this._collector.findActiveFilterItems();
20360
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
20361
+ activeConfig = _ref1[_i];
20329
20362
  searchQuery = this._buildActiveChildrenSearchQuery(activeConfig);
20330
20363
  if (searchQuery) {
20331
20364
  combinedQuery = this._addOrCreateQuery(combinedQuery, searchQuery);
@@ -20336,8 +20369,8 @@
20336
20369
 
20337
20370
  QueryBuilder.prototype._sortQuery = function(query) {
20338
20371
  if ((query != null) && this._needOrder()) {
20339
- query = query.order(this.filter.sortCriteria.type());
20340
- if (this.filter.sortCriteria.isReverse()) {
20372
+ query = query.order(this.sortCriteria.sortField);
20373
+ if (this.sortCriteria.sortDirection === DESC_SORT_ORDER) {
20341
20374
  if (!query.orderReversed) {
20342
20375
  query.reverse_order();
20343
20376
  }
@@ -20347,13 +20380,17 @@
20347
20380
  };
20348
20381
 
20349
20382
  QueryBuilder.prototype._needOrder = function() {
20350
- return this.filter.sortCriteria.type() !== "relevance";
20383
+ return this.sortCriteria.sortField !== "relevance";
20351
20384
  };
20352
20385
 
20353
20386
  QueryBuilder.prototype._addSearchTermQuery = function(query) {
20354
20387
  var searchQuery;
20355
20388
  if (this.filter.searchTerm && this.filter.searchTerm.length > 0) {
20356
20389
  searchQuery = scrivito.obj_where('*', 'contains_prefix', this.filter.searchTerm);
20390
+ this.sortCriteria = {
20391
+ sortField: "relevance",
20392
+ sortDirection: ASC_SORT_ORDER
20393
+ };
20357
20394
  return this._addOrCreateQuery(query, searchQuery);
20358
20395
  } else {
20359
20396
  return query;
@@ -20517,501 +20554,90 @@
20517
20554
  ActiveNodeConfig.prototype.field = function() {
20518
20555
  return this._findConfig('field');
20519
20556
  };
20520
-
20521
- ActiveNodeConfig.prototype.hasField = function() {
20522
- return !!this.field();
20523
- };
20524
-
20525
- ActiveNodeConfig.prototype.preventsCreation = function() {
20526
- return this.nodesPreventingCreation().length > 0;
20527
- };
20528
-
20529
- ActiveNodeConfig.prototype.nodesPreventingCreation = function() {
20530
- return _.select(this.activeNodes(), function(node) {
20531
- return node.enable_create === false;
20532
- });
20533
- };
20534
-
20535
- ActiveNodeConfig.prototype.enablesCreation = function() {
20536
- return _.some(this.activeNodes(), function(node) {
20537
- return node.enable_create === true;
20538
- });
20539
- };
20540
-
20541
- ActiveNodeConfig.prototype.operator = function() {
20542
- return this._findConfig('operator') || 'equals';
20543
- };
20544
-
20545
- ActiveNodeConfig.prototype._valueForNode = function(node) {
20546
- return node.value || node.name;
20547
- };
20548
-
20549
- ActiveNodeConfig.prototype._findConfig = function(attrName) {
20550
- var activeNode, parentWithAttribute;
20551
- activeNode = this._activeNodes[0];
20552
- if (this._filter().type !== 'checkbox' && activeNode[attrName]) {
20553
- return activeNode[attrName];
20554
- } else {
20555
- parentWithAttribute = _.find(this._parents, function(node) {
20556
- return node[attrName];
20557
- });
20558
- return parentWithAttribute && parentWithAttribute[attrName];
20559
- }
20560
- };
20561
-
20562
- ActiveNodeConfig.prototype._filter = function() {
20563
- return _.last(this._parents);
20564
- };
20565
-
20566
- return ActiveNodeConfig;
20567
-
20568
- })();
20569
-
20570
- module.exports = ActiveNodeConfig;
20571
-
20572
-
20573
- /***/ },
20574
- /* 175 */
20575
- /***/ function(module, exports) {
20576
-
20577
- var NullQuery;
20578
-
20579
- NullQuery = (function() {
20580
- function NullQuery() {}
20581
-
20582
- NullQuery.prototype.load_batch = function() {
20583
- return $.Deferred().resolve({
20584
- hits: []
20585
- });
20586
- };
20587
-
20588
- return NullQuery;
20589
-
20590
- })();
20591
-
20592
- module.exports = NullQuery;
20593
-
20594
-
20595
- /***/ },
20596
- /* 176 */
20597
- /***/ function(module, exports, __webpack_require__) {
20598
-
20599
- var Fetcher, FetcherStatus, Listenable, QueryBuilder,
20600
- __hasProp = {}.hasOwnProperty,
20601
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
20602
-
20603
- QueryBuilder = __webpack_require__(172);
20604
-
20605
- Listenable = __webpack_require__(158);
20606
-
20607
- FetcherStatus = __webpack_require__(177);
20608
-
20609
- Fetcher = (function(_super) {
20610
- __extends(Fetcher, _super);
20611
-
20612
- Fetcher.prototype.MAX_RETRY = 2;
20613
-
20614
- Fetcher.prototype.status = function() {
20615
- return this._fetcherStatus.status();
20616
- };
20617
-
20618
- function Fetcher() {
20619
- Fetcher.__super__.constructor.call(this);
20620
- this._fetcherStatus = new FetcherStatus();
20621
- }
20622
-
20623
- Fetcher.prototype.obj = function() {
20624
- return this._obj;
20625
- };
20626
-
20627
- Fetcher.prototype.fail = function() {
20628
- this._fetcherStatus.fail();
20629
- return this.changed();
20630
- };
20631
-
20632
- Fetcher.prototype.complete = function() {
20633
- this._fetcherStatus.complete();
20634
- return this.changed();
20635
- };
20636
-
20637
- Fetcher.prototype.fetch = function(id, retryCount) {
20638
- if (retryCount == null) {
20639
- retryCount = 0;
20640
- }
20641
- return QueryBuilder.byId(id).load_batch(id).then(((function(_this) {
20642
- return function(searchResult) {
20643
- if (searchResult.hits.length > 0) {
20644
- _this._obj = searchResult.hits[0];
20645
- return _this.complete();
20646
- } else {
20647
- return _this._objNotYetIndexed(retryCount, function() {
20648
- return _this.fetch(id, retryCount + 1);
20649
- });
20650
- }
20651
- };
20652
- })(this)), (function(_this) {
20653
- return function() {
20654
- return _this.fail();
20655
- };
20656
- })(this));
20657
- };
20658
-
20659
- Fetcher.prototype._objNotYetIndexed = function(retryCount, fetchObjFunction) {
20660
- if (retryCount < this.MAX_RETRY) {
20661
- return window.setTimeout(fetchObjFunction, 500);
20662
- } else {
20663
- this.fail();
20664
- return $.Deferred().reject();
20665
- }
20666
- };
20667
-
20668
- return Fetcher;
20669
-
20670
- })(Listenable);
20671
-
20672
- module.exports = Fetcher;
20673
-
20674
-
20675
- /***/ },
20676
- /* 177 */
20677
- /***/ function(module, exports) {
20678
-
20679
- var FetcherStatus;
20680
-
20681
- FetcherStatus = (function() {
20682
- FetcherStatus.prototype.status = function() {
20683
- return this._status;
20684
- };
20685
-
20686
- function FetcherStatus() {
20687
- this._status = 'active';
20688
- }
20689
-
20690
- FetcherStatus.prototype.fail = function() {
20691
- return this._status = 'failed';
20692
- };
20693
-
20694
- FetcherStatus.prototype.complete = function() {
20695
- return this._status = 'completed';
20696
- };
20697
-
20698
- return FetcherStatus;
20699
-
20700
- })();
20701
-
20702
- module.exports = FetcherStatus;
20703
-
20704
-
20705
- /***/ },
20706
- /* 178 */
20707
- /***/ function(module, exports, __webpack_require__) {
20708
-
20709
- var Deleter, Listenable, Obj, ObjCollection, SortCriteria,
20710
- __hasProp = {}.hasOwnProperty,
20711
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
20712
-
20713
- Listenable = __webpack_require__(158);
20714
-
20715
- Obj = __webpack_require__(171);
20716
-
20717
- SortCriteria = __webpack_require__(159);
20718
-
20719
- Deleter = __webpack_require__(179);
20720
-
20721
- ObjCollection = (function(_super) {
20722
- __extends(ObjCollection, _super);
20723
-
20724
- function ObjCollection(selectedObjsIds, _selectionMode, objs, sortCriteria) {
20725
- this._selectionMode = _selectionMode;
20726
- ObjCollection.__super__.constructor.call(this);
20727
- this._selectionMode || (this._selectionMode = 'multi');
20728
- sortCriteria || (sortCriteria = new SortCriteria());
20729
- this._sortCriteria = sortCriteria;
20730
- this._selectedObjsIds = selectedObjsIds || [];
20731
- this._objs = objs || [];
20732
- this._isAlreadyReversed = false;
20733
- this._curQueryNumber = 0;
20734
- }
20735
-
20736
- ObjCollection.prototype.objs = function() {
20737
- return this._objs;
20738
- };
20739
-
20740
- ObjCollection.prototype.hasMoreItems = function() {
20741
- return this._nextQuery != null;
20742
- };
20743
-
20744
- ObjCollection.prototype.selectedObjsIds = function() {
20745
- return this._selectedObjsIds;
20746
- };
20747
-
20748
- ObjCollection.prototype.isSingleElementSelected = function() {
20749
- return this.getSelectedObjs().length === 1;
20750
- };
20751
-
20752
- ObjCollection.prototype.getSelectedObjs = function() {
20753
- var selectedObjs;
20754
- selectedObjs = [];
20755
- _.each(this._selectedObjsIds, (function(_this) {
20756
- return function(selected) {
20757
- var selectedObj;
20758
- selectedObj = _.find(_this._objs, function(obj) {
20759
- if (obj != null) {
20760
- return obj.id() === selected;
20761
- }
20762
- });
20763
- if (selectedObj != null) {
20764
- return selectedObjs.push(selectedObj);
20765
- }
20766
- };
20767
- })(this));
20768
- return selectedObjs;
20769
- };
20770
-
20771
- ObjCollection.prototype.deselectObjs = function() {
20772
- return this._selectedObjsIds = [];
20773
- };
20774
-
20775
- ObjCollection.prototype.isLoading = function() {
20776
- return !!this._isLoading;
20777
- };
20778
-
20779
- ObjCollection.prototype.isLoadingAdditionalObjs = function() {
20780
- return !!this._isLoadingAdditionalObjs;
20781
- };
20782
-
20783
- ObjCollection.prototype.reload = function() {
20784
- if (this._query) {
20785
- return this.loadFromBackend(this._query);
20786
- }
20787
- };
20788
-
20789
- ObjCollection.prototype.setObjs = function(objs) {
20790
- this._objs = objs;
20791
- return this._resetObjsCollectionParams();
20792
- };
20793
-
20794
- ObjCollection.prototype.reset = function() {
20795
- this._objs = [];
20796
- return this._resetObjsCollectionParams();
20797
- };
20798
-
20799
- ObjCollection.prototype.isSingleSelectionMode = function() {
20800
- return this._selectionMode === 'single';
20801
- };
20802
-
20803
- ObjCollection.prototype.loadFromBackend = function(query) {
20804
- this._query = query;
20805
- this._curQueryNumber += 1;
20806
- this._resetLoadingState();
20807
- if (query) {
20808
- this._activateLoading();
20809
- return this._initialLoadObjs(query, this._curQueryNumber);
20810
- } else {
20811
- this._objs = [];
20812
- return this.changed();
20813
- }
20814
- };
20815
-
20816
- ObjCollection.prototype.toggleSelected = function(objId) {
20817
- if (this.isSelected(objId)) {
20818
- this._selectedObjsIds = _.without(this._selectedObjsIds, objId);
20819
- } else {
20820
- if (this.isSingleSelectionMode()) {
20821
- this._selectedObjsIds = [objId];
20822
- } else {
20823
- this._selectedObjsIds.push(objId);
20824
- }
20825
- }
20826
- return this.changed();
20827
- };
20828
-
20829
- ObjCollection.prototype.isSelected = function(objId) {
20830
- return _.contains(this._selectedObjsIds, objId);
20831
- };
20832
-
20833
- ObjCollection.prototype.loadNextPage = function() {
20834
- var queryNumber;
20835
- if (this.hasMoreItems() && !this.isLoadingAdditionalObjs()) {
20836
- this._activateIsLoadingAdditionalObjs();
20837
- queryNumber = this._curQueryNumber;
20838
- return this._nextQuery.load_batch().done((function(_this) {
20839
- return function(results, next) {
20840
- return _this._setAndLoadObjs(results, next, queryNumber);
20841
- };
20842
- })(this)).fail((function(_this) {
20843
- return function() {
20844
- _this._isLoadingAdditionalObjs = false;
20845
- return _this.changed();
20846
- };
20847
- })(this));
20848
- }
20849
- };
20850
-
20851
- ObjCollection.prototype.destroySelectedObjs = function() {
20852
- var deferreds;
20853
- if (this._selectedObjsIds.length > 0) {
20854
- deferreds = _.map(this._selectedObjsIds, (function(_this) {
20855
- return function(objId) {
20856
- return _this._destroyById(objId);
20857
- };
20858
- })(this));
20859
- $.when.apply($, deferreds).always((function(_this) {
20860
- return function() {
20861
- return _this.reload();
20862
- };
20863
- })(this));
20864
- return this._activateLoading();
20865
- }
20866
- };
20867
-
20868
- ObjCollection.prototype._destroyById = function(objId) {
20869
- var deleter;
20870
- deleter = new Deleter(objId);
20871
- return deleter.deleteObj().always((function(_this) {
20872
- return function() {
20873
- _this._objs = _this._objs.filter(function(obj) {
20874
- return obj.id() !== objId;
20875
- });
20876
- _this._selectedObjsIds = _this._selectedObjsIds.filter(function(selectedObjId) {
20877
- return selectedObjId !== objId;
20878
- });
20879
- return _this.trigger('destroy-obj', objId);
20880
- };
20881
- })(this));
20882
- };
20883
-
20884
- ObjCollection.prototype._resetLoadingState = function() {
20885
- this._nextQuery = null;
20886
- this._isLoadingAdditionalObjs = false;
20887
- return this._isLoading = false;
20888
- };
20889
-
20890
- ObjCollection.prototype._initialLoadObjs = function(query, queryNumber) {
20891
- return query.load_batch().then((function(_this) {
20892
- return function(results, next) {
20893
- _this._isLoading = false;
20894
- if (queryNumber === _this._curQueryNumber) {
20895
- _this._objs = [];
20896
- return _this._setAndLoadObjs(results, next, queryNumber);
20897
- }
20898
- };
20899
- })(this));
20900
- };
20901
-
20902
- ObjCollection.prototype._setAndLoadObjs = function(results, next, queryNumber) {
20903
- var curObjs;
20904
- if (queryNumber === this._curQueryNumber) {
20905
- this._isLoadingAdditionalObjs = false;
20906
- curObjs = _.map(results.hits, function(attr) {
20907
- return new Obj(attr);
20908
- });
20909
- this._objs = this._objs.concat(curObjs);
20910
- this._nextQuery = next;
20911
- return this.changed();
20912
- }
20913
- };
20914
-
20915
- ObjCollection.prototype._activateLoading = function() {
20916
- if (!this.isLoading()) {
20917
- this._isLoading = true;
20918
- return this.changed();
20919
- }
20557
+
20558
+ ActiveNodeConfig.prototype.hasField = function() {
20559
+ return !!this.field();
20920
20560
  };
20921
20561
 
20922
- ObjCollection.prototype._resetObjsCollectionParams = function() {
20923
- this._query = null;
20924
- this.deselectObjs();
20925
- this._resetLoadingState();
20926
- return this.changed();
20562
+ ActiveNodeConfig.prototype.preventsCreation = function() {
20563
+ return this.nodesPreventingCreation().length > 0;
20927
20564
  };
20928
20565
 
20929
- ObjCollection.prototype._activateIsLoadingAdditionalObjs = function() {
20930
- if (!this.isLoadingAdditionalObjs()) {
20931
- this._isLoadingAdditionalObjs = true;
20932
- return this.changed();
20933
- }
20566
+ ActiveNodeConfig.prototype.nodesPreventingCreation = function() {
20567
+ return _.select(this.activeNodes(), function(node) {
20568
+ return node.enable_create === false;
20569
+ });
20934
20570
  };
20935
20571
 
20936
- return ObjCollection;
20572
+ ActiveNodeConfig.prototype.enablesCreation = function() {
20573
+ return _.some(this.activeNodes(), function(node) {
20574
+ return node.enable_create === true;
20575
+ });
20576
+ };
20937
20577
 
20938
- })(Listenable);
20578
+ ActiveNodeConfig.prototype.operator = function() {
20579
+ return this._findConfig('operator') || 'equals';
20580
+ };
20939
20581
 
20940
- module.exports = ObjCollection;
20582
+ ActiveNodeConfig.prototype._valueForNode = function(node) {
20583
+ return node.value || node.name;
20584
+ };
20941
20585
 
20586
+ ActiveNodeConfig.prototype._findConfig = function(attrName) {
20587
+ var activeNode, parentWithAttribute;
20588
+ activeNode = this._activeNodes[0];
20589
+ if (this._filter().type !== 'checkbox' && activeNode[attrName]) {
20590
+ return activeNode[attrName];
20591
+ } else {
20592
+ parentWithAttribute = _.find(this._parents, function(node) {
20593
+ return node[attrName];
20594
+ });
20595
+ return parentWithAttribute && parentWithAttribute[attrName];
20596
+ }
20597
+ };
20942
20598
 
20943
- /***/ },
20944
- /* 179 */
20945
- /***/ function(module, exports, __webpack_require__) {
20599
+ ActiveNodeConfig.prototype._filter = function() {
20600
+ return _.last(this._parents);
20601
+ };
20946
20602
 
20947
- var Deleter, QueryBuilder;
20603
+ return ActiveNodeConfig;
20948
20604
 
20949
- QueryBuilder = __webpack_require__(172);
20605
+ })();
20950
20606
 
20951
- Deleter = (function() {
20952
- Deleter.prototype.MAX_RETRY = 5;
20607
+ module.exports = ActiveNodeConfig;
20953
20608
 
20954
- Deleter.prototype.TIMEOUT = 500;
20955
20609
 
20956
- function Deleter(objId) {
20957
- this.objId = objId;
20958
- this._promise = $.Deferred();
20959
- }
20610
+ /***/ },
20611
+ /* 175 */
20612
+ /***/ function(module, exports) {
20960
20613
 
20961
- Deleter.prototype.deleteObj = function() {
20962
- scrivito.delete_obj(this.objId).then((function(_this) {
20963
- return function() {
20964
- return _this._checkDelete();
20965
- };
20966
- })(this), (function(_this) {
20967
- return function() {
20968
- return _this._promise.reject();
20969
- };
20970
- })(this));
20971
- return this._promise;
20972
- };
20614
+ var NullQuery;
20973
20615
 
20974
- Deleter.prototype._checkDelete = function(retryCount) {
20975
- if (retryCount == null) {
20976
- retryCount = 0;
20977
- }
20978
- return QueryBuilder.byId(this.objId).load_batch().then(((function(_this) {
20979
- return function(searchResult) {
20980
- if (searchResult.hits.length === 0) {
20981
- return _this._promise.resolve();
20982
- } else {
20983
- return _this._reCheck(retryCount, function() {
20984
- return _this._checkDelete(retryCount + 1);
20985
- });
20986
- }
20987
- };
20988
- })(this)));
20989
- };
20616
+ NullQuery = (function() {
20617
+ function NullQuery() {}
20990
20618
 
20991
- Deleter.prototype._reCheck = function(retryCount, fetchObjFunction) {
20992
- if (retryCount < this.MAX_RETRY) {
20993
- return window.setTimeout(fetchObjFunction, this.TIMEOUT);
20994
- } else {
20995
- return this._promise.reject();
20996
- }
20619
+ NullQuery.prototype.load_batch = function() {
20620
+ return $.Deferred().resolve({
20621
+ hits: []
20622
+ });
20997
20623
  };
20998
20624
 
20999
- return Deleter;
20625
+ return NullQuery;
21000
20626
 
21001
20627
  })();
21002
20628
 
21003
- module.exports = Deleter;
20629
+ module.exports = NullQuery;
21004
20630
 
21005
20631
 
21006
20632
  /***/ },
21007
- /* 180 */
20633
+ /* 176 */
21008
20634
  /***/ function(module, exports, __webpack_require__) {
21009
20635
 
21010
20636
  /* WEBPACK VAR INJECTION */(function(React) {var ActiveNodeConfigCollector, SortMenu, TopBar, ViewModeBar;
21011
20637
 
21012
- ViewModeBar = __webpack_require__(181);
20638
+ ViewModeBar = __webpack_require__(177);
21013
20639
 
21014
- SortMenu = __webpack_require__(203);
20640
+ SortMenu = __webpack_require__(199);
21015
20641
 
21016
20642
  ActiveNodeConfigCollector = __webpack_require__(173);
21017
20643
 
@@ -21092,6 +20718,8 @@
21092
20718
  }, "Search")), React.createElement(ViewModeBar, {
21093
20719
  "viewMode": this.props.viewMode
21094
20720
  }), React.createElement(SortMenu, {
20721
+ "dispatch": this.props.dispatch,
20722
+ "sortCriteria": this.props.sortCriteria,
21095
20723
  "filter": this.props.filter
21096
20724
  }));
21097
20725
  }
@@ -21102,16 +20730,16 @@
21102
20730
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
21103
20731
 
21104
20732
  /***/ },
21105
- /* 181 */
20733
+ /* 177 */
21106
20734
  /***/ function(module, exports, __webpack_require__) {
21107
20735
 
21108
20736
  /* WEBPACK VAR INJECTION */(function(React) {var ReactRedux, TABLE_VIEW, THUMBNAIL_VIEW, ViewModeBar, ViewModeBarItem, setViewMode, _ref;
21109
20737
 
21110
- ReactRedux = __webpack_require__(182);
20738
+ ReactRedux = __webpack_require__(178);
21111
20739
 
21112
- ViewModeBarItem = __webpack_require__(201);
20740
+ ViewModeBarItem = __webpack_require__(197);
21113
20741
 
21114
- _ref = __webpack_require__(202), THUMBNAIL_VIEW = _ref.THUMBNAIL_VIEW, TABLE_VIEW = _ref.TABLE_VIEW, setViewMode = _ref.setViewMode;
20742
+ _ref = __webpack_require__(198), THUMBNAIL_VIEW = _ref.THUMBNAIL_VIEW, TABLE_VIEW = _ref.TABLE_VIEW, setViewMode = _ref.setViewMode;
21115
20743
 
21116
20744
  ViewModeBar = React.createClass({
21117
20745
  displayName: 'ViewModeBar',
@@ -21144,7 +20772,7 @@
21144
20772
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
21145
20773
 
21146
20774
  /***/ },
21147
- /* 182 */
20775
+ /* 178 */
21148
20776
  /***/ function(module, exports, __webpack_require__) {
21149
20777
 
21150
20778
  'use strict';
@@ -21157,7 +20785,7 @@
21157
20785
 
21158
20786
  var _react2 = _interopRequireDefault(_react);
21159
20787
 
21160
- var _componentsCreateAll = __webpack_require__(183);
20788
+ var _componentsCreateAll = __webpack_require__(179);
21161
20789
 
21162
20790
  var _componentsCreateAll2 = _interopRequireDefault(_componentsCreateAll);
21163
20791
 
@@ -21169,7 +20797,7 @@
21169
20797
  exports.connect = connect;
21170
20798
 
21171
20799
  /***/ },
21172
- /* 183 */
20800
+ /* 179 */
21173
20801
  /***/ function(module, exports, __webpack_require__) {
21174
20802
 
21175
20803
  'use strict';
@@ -21179,11 +20807,11 @@
21179
20807
 
21180
20808
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
21181
20809
 
21182
- var _createProvider = __webpack_require__(184);
20810
+ var _createProvider = __webpack_require__(180);
21183
20811
 
21184
20812
  var _createProvider2 = _interopRequireDefault(_createProvider);
21185
20813
 
21186
- var _createConnect = __webpack_require__(186);
20814
+ var _createConnect = __webpack_require__(182);
21187
20815
 
21188
20816
  var _createConnect2 = _interopRequireDefault(_createConnect);
21189
20817
 
@@ -21197,7 +20825,7 @@
21197
20825
  module.exports = exports['default'];
21198
20826
 
21199
20827
  /***/ },
21200
- /* 184 */
20828
+ /* 180 */
21201
20829
  /***/ function(module, exports, __webpack_require__) {
21202
20830
 
21203
20831
  'use strict';
@@ -21214,7 +20842,7 @@
21214
20842
 
21215
20843
  function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
21216
20844
 
21217
- var _utilsCreateStoreShape = __webpack_require__(185);
20845
+ var _utilsCreateStoreShape = __webpack_require__(181);
21218
20846
 
21219
20847
  var _utilsCreateStoreShape2 = _interopRequireDefault(_utilsCreateStoreShape);
21220
20848
 
@@ -21329,7 +20957,7 @@
21329
20957
  module.exports = exports['default'];
21330
20958
 
21331
20959
  /***/ },
21332
- /* 185 */
20960
+ /* 181 */
21333
20961
  /***/ function(module, exports) {
21334
20962
 
21335
20963
  "use strict";
@@ -21348,7 +20976,7 @@
21348
20976
  module.exports = exports["default"];
21349
20977
 
21350
20978
  /***/ },
21351
- /* 186 */
20979
+ /* 182 */
21352
20980
  /***/ function(module, exports, __webpack_require__) {
21353
20981
 
21354
20982
  'use strict';
@@ -21367,23 +20995,23 @@
21367
20995
 
21368
20996
  function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
21369
20997
 
21370
- var _utilsCreateStoreShape = __webpack_require__(185);
20998
+ var _utilsCreateStoreShape = __webpack_require__(181);
21371
20999
 
21372
21000
  var _utilsCreateStoreShape2 = _interopRequireDefault(_utilsCreateStoreShape);
21373
21001
 
21374
- var _utilsShallowEqual = __webpack_require__(187);
21002
+ var _utilsShallowEqual = __webpack_require__(183);
21375
21003
 
21376
21004
  var _utilsShallowEqual2 = _interopRequireDefault(_utilsShallowEqual);
21377
21005
 
21378
- var _utilsIsPlainObject = __webpack_require__(188);
21006
+ var _utilsIsPlainObject = __webpack_require__(184);
21379
21007
 
21380
21008
  var _utilsIsPlainObject2 = _interopRequireDefault(_utilsIsPlainObject);
21381
21009
 
21382
- var _utilsWrapActionCreators = __webpack_require__(189);
21010
+ var _utilsWrapActionCreators = __webpack_require__(185);
21383
21011
 
21384
21012
  var _utilsWrapActionCreators2 = _interopRequireDefault(_utilsWrapActionCreators);
21385
21013
 
21386
- var _invariant = __webpack_require__(200);
21014
+ var _invariant = __webpack_require__(196);
21387
21015
 
21388
21016
  var _invariant2 = _interopRequireDefault(_invariant);
21389
21017
 
@@ -21622,7 +21250,7 @@
21622
21250
  module.exports = exports['default'];
21623
21251
 
21624
21252
  /***/ },
21625
- /* 187 */
21253
+ /* 183 */
21626
21254
  /***/ function(module, exports) {
21627
21255
 
21628
21256
  "use strict";
@@ -21656,7 +21284,7 @@
21656
21284
  module.exports = exports["default"];
21657
21285
 
21658
21286
  /***/ },
21659
- /* 188 */
21287
+ /* 184 */
21660
21288
  /***/ function(module, exports) {
21661
21289
 
21662
21290
  'use strict';
@@ -21691,7 +21319,7 @@
21691
21319
  module.exports = exports['default'];
21692
21320
 
21693
21321
  /***/ },
21694
- /* 189 */
21322
+ /* 185 */
21695
21323
  /***/ function(module, exports, __webpack_require__) {
21696
21324
 
21697
21325
  'use strict';
@@ -21699,7 +21327,7 @@
21699
21327
  exports.__esModule = true;
21700
21328
  exports['default'] = wrapActionCreators;
21701
21329
 
21702
- var _redux = __webpack_require__(190);
21330
+ var _redux = __webpack_require__(186);
21703
21331
 
21704
21332
  function wrapActionCreators(actionCreators) {
21705
21333
  return function (dispatch) {
@@ -21710,7 +21338,7 @@
21710
21338
  module.exports = exports['default'];
21711
21339
 
21712
21340
  /***/ },
21713
- /* 190 */
21341
+ /* 186 */
21714
21342
  /***/ function(module, exports, __webpack_require__) {
21715
21343
 
21716
21344
  'use strict';
@@ -21718,27 +21346,27 @@
21718
21346
  exports.__esModule = true;
21719
21347
  exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined;
21720
21348
 
21721
- var _createStore = __webpack_require__(191);
21349
+ var _createStore = __webpack_require__(187);
21722
21350
 
21723
21351
  var _createStore2 = _interopRequireDefault(_createStore);
21724
21352
 
21725
- var _combineReducers = __webpack_require__(195);
21353
+ var _combineReducers = __webpack_require__(191);
21726
21354
 
21727
21355
  var _combineReducers2 = _interopRequireDefault(_combineReducers);
21728
21356
 
21729
- var _bindActionCreators = __webpack_require__(197);
21357
+ var _bindActionCreators = __webpack_require__(193);
21730
21358
 
21731
21359
  var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators);
21732
21360
 
21733
- var _applyMiddleware = __webpack_require__(198);
21361
+ var _applyMiddleware = __webpack_require__(194);
21734
21362
 
21735
21363
  var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware);
21736
21364
 
21737
- var _compose = __webpack_require__(199);
21365
+ var _compose = __webpack_require__(195);
21738
21366
 
21739
21367
  var _compose2 = _interopRequireDefault(_compose);
21740
21368
 
21741
- var _warning = __webpack_require__(196);
21369
+ var _warning = __webpack_require__(192);
21742
21370
 
21743
21371
  var _warning2 = _interopRequireDefault(_warning);
21744
21372
 
@@ -21761,7 +21389,7 @@
21761
21389
  exports.compose = _compose2["default"];
21762
21390
 
21763
21391
  /***/ },
21764
- /* 191 */
21392
+ /* 187 */
21765
21393
  /***/ function(module, exports, __webpack_require__) {
21766
21394
 
21767
21395
  'use strict';
@@ -21770,7 +21398,7 @@
21770
21398
  exports.ActionTypes = undefined;
21771
21399
  exports["default"] = createStore;
21772
21400
 
21773
- var _isPlainObject = __webpack_require__(192);
21401
+ var _isPlainObject = __webpack_require__(188);
21774
21402
 
21775
21403
  var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
21776
21404
 
@@ -21982,11 +21610,11 @@
21982
21610
  }
21983
21611
 
21984
21612
  /***/ },
21985
- /* 192 */
21613
+ /* 188 */
21986
21614
  /***/ function(module, exports, __webpack_require__) {
21987
21615
 
21988
- var isHostObject = __webpack_require__(193),
21989
- isObjectLike = __webpack_require__(194);
21616
+ var isHostObject = __webpack_require__(189),
21617
+ isObjectLike = __webpack_require__(190);
21990
21618
 
21991
21619
  /** `Object#toString` result references. */
21992
21620
  var objectTag = '[object Object]';
@@ -22056,7 +21684,7 @@
22056
21684
 
22057
21685
 
22058
21686
  /***/ },
22059
- /* 193 */
21687
+ /* 189 */
22060
21688
  /***/ function(module, exports) {
22061
21689
 
22062
21690
  /**
@@ -22082,7 +21710,7 @@
22082
21710
 
22083
21711
 
22084
21712
  /***/ },
22085
- /* 194 */
21713
+ /* 190 */
22086
21714
  /***/ function(module, exports) {
22087
21715
 
22088
21716
  /**
@@ -22116,7 +21744,7 @@
22116
21744
 
22117
21745
 
22118
21746
  /***/ },
22119
- /* 195 */
21747
+ /* 191 */
22120
21748
  /***/ function(module, exports, __webpack_require__) {
22121
21749
 
22122
21750
  'use strict';
@@ -22124,13 +21752,13 @@
22124
21752
  exports.__esModule = true;
22125
21753
  exports["default"] = combineReducers;
22126
21754
 
22127
- var _createStore = __webpack_require__(191);
21755
+ var _createStore = __webpack_require__(187);
22128
21756
 
22129
- var _isPlainObject = __webpack_require__(192);
21757
+ var _isPlainObject = __webpack_require__(188);
22130
21758
 
22131
21759
  var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
22132
21760
 
22133
- var _warning = __webpack_require__(196);
21761
+ var _warning = __webpack_require__(192);
22134
21762
 
22135
21763
  var _warning2 = _interopRequireDefault(_warning);
22136
21764
 
@@ -22248,7 +21876,7 @@
22248
21876
  }
22249
21877
 
22250
21878
  /***/ },
22251
- /* 196 */
21879
+ /* 192 */
22252
21880
  /***/ function(module, exports) {
22253
21881
 
22254
21882
  'use strict';
@@ -22277,7 +21905,7 @@
22277
21905
  }
22278
21906
 
22279
21907
  /***/ },
22280
- /* 197 */
21908
+ /* 193 */
22281
21909
  /***/ function(module, exports) {
22282
21910
 
22283
21911
  'use strict';
@@ -22333,7 +21961,7 @@
22333
21961
  }
22334
21962
 
22335
21963
  /***/ },
22336
- /* 198 */
21964
+ /* 194 */
22337
21965
  /***/ function(module, exports, __webpack_require__) {
22338
21966
 
22339
21967
  'use strict';
@@ -22343,7 +21971,7 @@
22343
21971
  exports.__esModule = true;
22344
21972
  exports["default"] = applyMiddleware;
22345
21973
 
22346
- var _compose = __webpack_require__(199);
21974
+ var _compose = __webpack_require__(195);
22347
21975
 
22348
21976
  var _compose2 = _interopRequireDefault(_compose);
22349
21977
 
@@ -22395,7 +22023,7 @@
22395
22023
  }
22396
22024
 
22397
22025
  /***/ },
22398
- /* 199 */
22026
+ /* 195 */
22399
22027
  /***/ function(module, exports) {
22400
22028
 
22401
22029
  "use strict";
@@ -22429,7 +22057,7 @@
22429
22057
  }
22430
22058
 
22431
22059
  /***/ },
22432
- /* 200 */
22060
+ /* 196 */
22433
22061
  /***/ function(module, exports, __webpack_require__) {
22434
22062
 
22435
22063
  /**
@@ -22486,14 +22114,14 @@
22486
22114
 
22487
22115
 
22488
22116
  /***/ },
22489
- /* 201 */
22117
+ /* 197 */
22490
22118
  /***/ function(module, exports, __webpack_require__) {
22491
22119
 
22492
22120
  /* WEBPACK VAR INJECTION */(function(React) {var ObjDisplayActionCreator, ReactRedux, ViewModeBarItem;
22493
22121
 
22494
- ReactRedux = __webpack_require__(182);
22122
+ ReactRedux = __webpack_require__(178);
22495
22123
 
22496
- ObjDisplayActionCreator = __webpack_require__(202);
22124
+ ObjDisplayActionCreator = __webpack_require__(198);
22497
22125
 
22498
22126
  ViewModeBarItem = React.createClass({
22499
22127
  displayName: 'ViewModeBarItem',
@@ -22541,7 +22169,7 @@
22541
22169
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22542
22170
 
22543
22171
  /***/ },
22544
- /* 202 */
22172
+ /* 198 */
22545
22173
  /***/ function(module, exports) {
22546
22174
 
22547
22175
  var ObjDisplayActionCreator;
@@ -22570,12 +22198,16 @@
22570
22198
 
22571
22199
 
22572
22200
  /***/ },
22573
- /* 203 */
22201
+ /* 199 */
22574
22202
  /***/ function(module, exports, __webpack_require__) {
22575
22203
 
22576
- /* WEBPACK VAR INJECTION */(function(React) {var SortMenu, SortMenuItem;
22204
+ /* WEBPACK VAR INJECTION */(function(React) {var ASC_SORT_ORDER, DESC_SORT_ORDER, ReactRedux, SortMenu, SortMenuItem, sortInAscOrder, sortInDescOrder, _ref;
22577
22205
 
22578
- SortMenuItem = __webpack_require__(204);
22206
+ SortMenuItem = __webpack_require__(200);
22207
+
22208
+ ReactRedux = __webpack_require__(178);
22209
+
22210
+ _ref = __webpack_require__(166), sortInAscOrder = _ref.sortInAscOrder, sortInDescOrder = _ref.sortInDescOrder, DESC_SORT_ORDER = _ref.DESC_SORT_ORDER, ASC_SORT_ORDER = _ref.ASC_SORT_ORDER;
22579
22211
 
22580
22212
  SortMenu = React.createClass({
22581
22213
  displayName: 'SortMenu',
@@ -22585,6 +22217,12 @@
22585
22217
  ascCriteriaTitle: "Relevance",
22586
22218
  sortItemType: "relevance"
22587
22219
  },
22220
+ "filename": {
22221
+ itemTitle: "Sort by filename",
22222
+ descCriteriaTitle: "Filename: From Z to A",
22223
+ ascCriteriaTitle: "Filename: From A to Z",
22224
+ sortItemType: "blob:filename"
22225
+ },
22588
22226
  "date": {
22589
22227
  itemTitle: "Sort by date",
22590
22228
  descCriteriaTitle: "Last change: latest first",
@@ -22595,17 +22233,37 @@
22595
22233
  toggleSortMenu: function() {
22596
22234
  return $('.scrivito-content-browser-sort-menu .scrivito_menu_box').fadeToggle();
22597
22235
  },
22236
+ getSortActiveCriteriaTitle: function() {
22237
+ var activeSortCriteriaItem;
22238
+ activeSortCriteriaItem = _.findWhere(_.values(this.sortItemsData), {
22239
+ sortItemType: this.props.sortCriteria.sortField
22240
+ });
22241
+ if (activeSortCriteriaItem === void 0) {
22242
+ return;
22243
+ }
22244
+ switch (this.props.sortCriteria.sortDirection) {
22245
+ case DESC_SORT_ORDER:
22246
+ return activeSortCriteriaItem.descCriteriaTitle;
22247
+ default:
22248
+ return activeSortCriteriaItem.ascCriteriaTitle;
22249
+ }
22250
+ },
22598
22251
  getSortIconClassName: function() {
22599
- var sortCriteria, sortIcon;
22252
+ var sortIcon;
22600
22253
  sortIcon = "scrivito_icon ";
22601
- sortCriteria = this.props.filter.sortCriteria;
22602
- if (sortCriteria.isSortedDesc()) {
22603
- sortIcon += "scrivito_icon_sort_down";
22604
- } else {
22254
+ if (this.props.sortCriteria.sortDirection === DESC_SORT_ORDER) {
22605
22255
  sortIcon += "scrivito_icon_sort_up";
22256
+ } else {
22257
+ sortIcon += "scrivito_icon_sort_down";
22606
22258
  }
22607
22259
  return sortIcon;
22608
22260
  },
22261
+ setDescSortCriteria: function(type) {
22262
+ return this.props.dispatch(sortInDescOrder(type, this.props.filter));
22263
+ },
22264
+ setAscSortCriteria: function(type) {
22265
+ return this.props.dispatch(sortInAscOrder(type, this.props.filter));
22266
+ },
22609
22267
  render: function() {
22610
22268
  var sortItem;
22611
22269
  return React.createElement("span", {
@@ -22613,20 +22271,25 @@
22613
22271
  "onClick": this.toggleSortMenu
22614
22272
  }, React.createElement("i", {
22615
22273
  "className": this.getSortIconClassName()
22616
- }), this.props.filter.sortCriteria.activeElement(), React.createElement("i", {
22274
+ }), React.createElement("span", {
22275
+ "className": "scrivito-content-browser-sort-menu-title"
22276
+ }, this.getSortActiveCriteriaTitle()), React.createElement("i", {
22617
22277
  "className": "scrivito_icon scrivito-content-browser-menu-icon scrivito_icon_chevron_down"
22618
22278
  }), React.createElement("ul", {
22619
22279
  "className": "scrivito_menu_box scrivito_left"
22620
22280
  }, (function() {
22621
- var _i, _len, _ref, _results;
22622
- _ref = Object.keys(this.sortItemsData);
22281
+ var _i, _len, _ref1, _results;
22282
+ _ref1 = Object.keys(this.sortItemsData);
22623
22283
  _results = [];
22624
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
22625
- sortItem = _ref[_i];
22284
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
22285
+ sortItem = _ref1[_i];
22626
22286
  _results.push(React.createElement(SortMenuItem, {
22627
- "filter": this.props.filter,
22287
+ "sortCriteria": this.props.sortCriteria,
22628
22288
  "key": sortItem,
22629
- "sortItem": this.sortItemsData[sortItem]
22289
+ "sortItem": this.sortItemsData[sortItem],
22290
+ "activeTitle": this.getSortActiveCriteriaTitle(),
22291
+ "setAscSortCriteria": this.setAscSortCriteria,
22292
+ "setDescSortCriteria": this.setDescSortCriteria
22630
22293
  }));
22631
22294
  }
22632
22295
  return _results;
@@ -22641,12 +22304,10 @@
22641
22304
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22642
22305
 
22643
22306
  /***/ },
22644
- /* 204 */
22307
+ /* 200 */
22645
22308
  /***/ function(module, exports, __webpack_require__) {
22646
22309
 
22647
- /* WEBPACK VAR INJECTION */(function(React) {var SortCriteria, SortMenuItem;
22648
-
22649
- SortCriteria = __webpack_require__(159);
22310
+ /* WEBPACK VAR INJECTION */(function(React) {var SortMenuItem;
22650
22311
 
22651
22312
  SortMenuItem = React.createClass({
22652
22313
  displayName: 'SortMenuItem',
@@ -22660,7 +22321,7 @@
22660
22321
  getSortLiClassName: function(activeElement) {
22661
22322
  var itemIcon;
22662
22323
  itemIcon = "scrivito_menu_item";
22663
- if (this.props.filter.sortCriteria.activeElement() === activeElement) {
22324
+ if (this.props.activeTitle === activeElement) {
22664
22325
  itemIcon += " active";
22665
22326
  }
22666
22327
  return itemIcon;
@@ -22674,16 +22335,11 @@
22674
22335
  currentSortItem: function() {
22675
22336
  return this.props.sortItem;
22676
22337
  },
22677
- _changeSortCriteria: function(reverse, activeItemElement) {
22678
- var sortCriteria;
22679
- sortCriteria = new SortCriteria(this.currentSortItem().sortItemType, reverse, activeItemElement, this.currentSortItem().itemTitle);
22680
- return this.props.filter.setSortCriteria(sortCriteria);
22681
- },
22682
22338
  _sortInAscOrder: function() {
22683
- return this._changeSortCriteria(false, this.currentSortItem().ascCriteriaTitle);
22339
+ return this.props.setAscSortCriteria(this.currentSortItem().sortItemType);
22684
22340
  },
22685
22341
  _sortInDescOrder: function() {
22686
- return this._changeSortCriteria(true, this.currentSortItem().descCriteriaTitle);
22342
+ return this.props.setDescSortCriteria(this.currentSortItem().sortItemType);
22687
22343
  },
22688
22344
  render: function() {
22689
22345
  return React.createElement("div", null, React.createElement("li", {
@@ -22707,22 +22363,22 @@
22707
22363
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22708
22364
 
22709
22365
  /***/ },
22710
- /* 205 */
22366
+ /* 201 */
22711
22367
  /***/ function(module, exports, __webpack_require__) {
22712
22368
 
22713
22369
  /* WEBPACK VAR INJECTION */(function(React) {var AdditionalOptionFilter, Filter, FilterMixin, LastAddedFilter, QueryBuilder, SelectedFilter, TreeFilter;
22714
22370
 
22715
- FilterMixin = __webpack_require__(206);
22371
+ FilterMixin = __webpack_require__(202);
22716
22372
 
22717
- AdditionalOptionFilter = __webpack_require__(207);
22373
+ AdditionalOptionFilter = __webpack_require__(203);
22718
22374
 
22719
- TreeFilter = __webpack_require__(214);
22375
+ TreeFilter = __webpack_require__(210);
22720
22376
 
22721
- SelectedFilter = __webpack_require__(215);
22377
+ SelectedFilter = __webpack_require__(211);
22722
22378
 
22723
22379
  QueryBuilder = __webpack_require__(172);
22724
22380
 
22725
- LastAddedFilter = __webpack_require__(216);
22381
+ LastAddedFilter = __webpack_require__(212);
22726
22382
 
22727
22383
  Filter = React.createClass({
22728
22384
  displayName: 'Filter',
@@ -22740,17 +22396,24 @@
22740
22396
  _activeTags: function() {
22741
22397
  return this._activeTags;
22742
22398
  },
22399
+ _triggerReduxStateChanged: function(newProps, oldProps) {
22400
+ if (!_.isEqual(newProps, oldProps)) {
22401
+ return this.props.filter.trigger("reduxStateChanged", this.props.filter);
22402
+ }
22403
+ },
22743
22404
  componentWillReceiveProps: function(nextProps) {
22744
22405
  if (!this.state.selectedFilter) {
22745
- this._activeTags = nextProps.activeTags;
22746
- if (!_.isEqual(this._activeTags, this.props.activeTags)) {
22747
- return this.props.filter.trigger("tagActiveStateChanged", this.props.filter);
22406
+ this._sortCriteria = nextProps.sortCriteria;
22407
+ this._triggerReduxStateChanged(this._sortCriteria, this.props.sortCriteria);
22408
+ if (nextProps.tags.items.length > 0) {
22409
+ this._activeTags = nextProps.tags.activeTags;
22410
+ return this._triggerReduxStateChanged(this._activeTags, this.props.tags.activeTags);
22748
22411
  }
22749
22412
  }
22750
22413
  },
22751
22414
  _buildQuery: function(filter) {
22752
22415
  var queryBder;
22753
- queryBder = new QueryBuilder(filter, this.props.baseQuery, this._activeTags);
22416
+ queryBder = new QueryBuilder(filter, this.props.baseQuery, this._activeTags, this._sortCriteria);
22754
22417
  return queryBder.searchRequest();
22755
22418
  },
22756
22419
  loadObjsByFilterQuery: function(query) {
@@ -22761,9 +22424,6 @@
22761
22424
  this.props.objCollection.deselectObjs();
22762
22425
  return this.props.objCollection.loadFromBackend(query);
22763
22426
  },
22764
- addedObjsCollectionCount: function() {
22765
- return this.props.addedObjsCollection.count();
22766
- },
22767
22427
  loadObjs: function(filter) {
22768
22428
  var query;
22769
22429
  query = this._buildQuery(filter);
@@ -22783,10 +22443,10 @@
22783
22443
  getFilterClassName: function() {
22784
22444
  var filterBrowserClass;
22785
22445
  filterBrowserClass = "scrivito-content-browser-filter";
22786
- if (this.addedObjsCollectionCount() > 0 && this.props.standAlone) {
22446
+ if (this.props.additionCount > 0 && this.props.standAlone) {
22787
22447
  return filterBrowserClass;
22788
22448
  }
22789
- if (this.addedObjsCollectionCount() > 0) {
22449
+ if (this.props.additionCount > 0) {
22790
22450
  filterBrowserClass += " last_added";
22791
22451
  }
22792
22452
  if (this.props.standAlone) {
@@ -22795,9 +22455,9 @@
22795
22455
  return filterBrowserClass;
22796
22456
  },
22797
22457
  componentDidMount: function() {
22798
- this._activeTags = this.props.activeTags;
22458
+ this._activeTags = this.props.tags.activeTags;
22799
22459
  this.props.filter.onChange(this.loadObjsAndTags);
22800
- return this.props.filter.on("tagActiveStateChanged", this.loadObjs);
22460
+ return this.props.filter.on("reduxStateChanged", this.loadObjs);
22801
22461
  },
22802
22462
  activateInitialFilter: function() {
22803
22463
  if (this.props.objCollection.selectedObjsIds().length > 0) {
@@ -22810,8 +22470,9 @@
22810
22470
  this.setState({
22811
22471
  selectedFilter: false
22812
22472
  });
22813
- this.props.updateLastAdded(true);
22814
22473
  this.props.disableTags();
22474
+ this.props.updateLastAdded(true);
22475
+ this.props.objCollection.deselectObjs();
22815
22476
  return this.props.filter.deselectHierarchicalFilters();
22816
22477
  },
22817
22478
  activateSelectedFilter: function() {
@@ -22820,8 +22481,8 @@
22820
22481
  this.setState({
22821
22482
  selectedFilter: true
22822
22483
  });
22823
- this.props.updateLastAdded(false);
22824
22484
  this.props.disableTags();
22485
+ this.props.updateLastAdded(false);
22825
22486
  query = QueryBuilder.byId(this.props.objCollection.selectedObjsIds());
22826
22487
  return this.props.objCollection.loadFromBackend(query);
22827
22488
  },
@@ -22856,8 +22517,8 @@
22856
22517
  "selectedCount": selectedObjsCount,
22857
22518
  "active": this.state.selectedFilter,
22858
22519
  "activateSelectedFilter": this.activateSelectedFilter
22859
- }) : void 0), (this.addedObjsCollectionCount() > 0 ? React.createElement(LastAddedFilter, {
22860
- "addedCount": this.addedObjsCollectionCount(),
22520
+ }) : void 0), (this.props.additionCount > 0 ? React.createElement(LastAddedFilter, {
22521
+ "addedCount": this.props.additionCount,
22861
22522
  "active": this.props.showLastAdded,
22862
22523
  "activateLastAddedFilter": this.activateLastAddedFilter
22863
22524
  }) : void 0)), React.createElement("div", {
@@ -22871,7 +22532,7 @@
22871
22532
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22872
22533
 
22873
22534
  /***/ },
22874
- /* 206 */
22535
+ /* 202 */
22875
22536
  /***/ function(module, exports, __webpack_require__) {
22876
22537
 
22877
22538
  /* WEBPACK VAR INJECTION */(function(React) {var FilterMixin;
@@ -22894,18 +22555,18 @@
22894
22555
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22895
22556
 
22896
22557
  /***/ },
22897
- /* 207 */
22558
+ /* 203 */
22898
22559
  /***/ function(module, exports, __webpack_require__) {
22899
22560
 
22900
22561
  /* WEBPACK VAR INJECTION */(function(React) {var AdditionalOptionFilter, CheckBoxOptionFilter, DeselectAllRadioOptionFilter, ExpandableFilterNodeMixin, RadioOptionFilter;
22901
22562
 
22902
- ExpandableFilterNodeMixin = __webpack_require__(208);
22563
+ ExpandableFilterNodeMixin = __webpack_require__(204);
22903
22564
 
22904
- DeselectAllRadioOptionFilter = __webpack_require__(209);
22565
+ DeselectAllRadioOptionFilter = __webpack_require__(205);
22905
22566
 
22906
- RadioOptionFilter = __webpack_require__(211);
22567
+ RadioOptionFilter = __webpack_require__(207);
22907
22568
 
22908
- CheckBoxOptionFilter = __webpack_require__(213);
22569
+ CheckBoxOptionFilter = __webpack_require__(209);
22909
22570
 
22910
22571
  AdditionalOptionFilter = React.createClass({
22911
22572
  displayName: 'AdditionalOptionFilter',
@@ -22961,7 +22622,7 @@
22961
22622
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22962
22623
 
22963
22624
  /***/ },
22964
- /* 208 */
22625
+ /* 204 */
22965
22626
  /***/ function(module, exports, __webpack_require__) {
22966
22627
 
22967
22628
  /* WEBPACK VAR INJECTION */(function(React) {var ExpandableFilterNodeMixin;
@@ -22997,12 +22658,12 @@
22997
22658
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
22998
22659
 
22999
22660
  /***/ },
23000
- /* 209 */
22661
+ /* 205 */
23001
22662
  /***/ function(module, exports, __webpack_require__) {
23002
22663
 
23003
22664
  /* WEBPACK VAR INJECTION */(function(React) {var DeselectAllRadioOptionFilter, OptionFilterLabelRenderMixin;
23004
22665
 
23005
- OptionFilterLabelRenderMixin = __webpack_require__(210);
22666
+ OptionFilterLabelRenderMixin = __webpack_require__(206);
23006
22667
 
23007
22668
  DeselectAllRadioOptionFilter = React.createClass({
23008
22669
  displayName: 'DeselectAllRadioOptionFilter',
@@ -23032,7 +22693,7 @@
23032
22693
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23033
22694
 
23034
22695
  /***/ },
23035
- /* 210 */
22696
+ /* 206 */
23036
22697
  /***/ function(module, exports, __webpack_require__) {
23037
22698
 
23038
22699
  /* WEBPACK VAR INJECTION */(function(React) {var OptionFilterLabelRenderMixin;
@@ -23050,12 +22711,12 @@
23050
22711
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23051
22712
 
23052
22713
  /***/ },
23053
- /* 211 */
22714
+ /* 207 */
23054
22715
  /***/ function(module, exports, __webpack_require__) {
23055
22716
 
23056
22717
  /* WEBPACK VAR INJECTION */(function(React) {var OptionFilterMixin, RadioOptionFilter;
23057
22718
 
23058
- OptionFilterMixin = __webpack_require__(212);
22719
+ OptionFilterMixin = __webpack_require__(208);
23059
22720
 
23060
22721
  RadioOptionFilter = React.createClass({
23061
22722
  displayName: 'RadioOptionFilter',
@@ -23080,12 +22741,12 @@
23080
22741
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23081
22742
 
23082
22743
  /***/ },
23083
- /* 212 */
22744
+ /* 208 */
23084
22745
  /***/ function(module, exports, __webpack_require__) {
23085
22746
 
23086
22747
  var OptionFilterLabelRenderMixin, OptionFilterMixin;
23087
22748
 
23088
- OptionFilterLabelRenderMixin = __webpack_require__(210);
22749
+ OptionFilterLabelRenderMixin = __webpack_require__(206);
23089
22750
 
23090
22751
  OptionFilterMixin = {
23091
22752
  mixins: [OptionFilterLabelRenderMixin],
@@ -23108,12 +22769,12 @@
23108
22769
 
23109
22770
 
23110
22771
  /***/ },
23111
- /* 213 */
22772
+ /* 209 */
23112
22773
  /***/ function(module, exports, __webpack_require__) {
23113
22774
 
23114
22775
  /* WEBPACK VAR INJECTION */(function(React) {var CheckBoxOptionFilter, OptionFilterMixin;
23115
22776
 
23116
- OptionFilterMixin = __webpack_require__(212);
22777
+ OptionFilterMixin = __webpack_require__(208);
23117
22778
 
23118
22779
  CheckBoxOptionFilter = React.createClass({
23119
22780
  displayName: 'CheckBoxOptionFilter',
@@ -23133,12 +22794,12 @@
23133
22794
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23134
22795
 
23135
22796
  /***/ },
23136
- /* 214 */
22797
+ /* 210 */
23137
22798
  /***/ function(module, exports, __webpack_require__) {
23138
22799
 
23139
22800
  /* WEBPACK VAR INJECTION */(function(React) {var ExpandableFilterNodeMixin, QueryBuilder, TreeFilter;
23140
22801
 
23141
- ExpandableFilterNodeMixin = __webpack_require__(208);
22802
+ ExpandableFilterNodeMixin = __webpack_require__(204);
23142
22803
 
23143
22804
  QueryBuilder = __webpack_require__(172);
23144
22805
 
@@ -23207,7 +22868,7 @@
23207
22868
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23208
22869
 
23209
22870
  /***/ },
23210
- /* 215 */
22871
+ /* 211 */
23211
22872
  /***/ function(module, exports, __webpack_require__) {
23212
22873
 
23213
22874
  /* WEBPACK VAR INJECTION */(function(React) {var SelectedFilter;
@@ -23241,7 +22902,7 @@
23241
22902
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23242
22903
 
23243
22904
  /***/ },
23244
- /* 216 */
22905
+ /* 212 */
23245
22906
  /***/ function(module, exports, __webpack_require__) {
23246
22907
 
23247
22908
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedFilter;
@@ -23275,26 +22936,28 @@
23275
22936
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23276
22937
 
23277
22938
  /***/ },
23278
- /* 217 */
22939
+ /* 213 */
23279
22940
  /***/ function(module, exports, __webpack_require__) {
23280
22941
 
23281
- /* WEBPACK VAR INJECTION */(function(React) {var Items, LastAddedItems, PresetBuilder, TableView, TableViewContent, TagBar, ThumbnailItems, objDisplayAction, toggleExpandTagBar, toggleTag, _ref;
22942
+ /* WEBPACK VAR INJECTION */(function(React) {var Items, LastAddedItems, Obj, PresetBuilder, TableView, TableViewContent, TagBar, ThumbnailItems, objDisplayAction, toggleExpandTagBar, toggleTag, _ref;
23282
22943
 
23283
- TableView = __webpack_require__(218);
22944
+ TableView = __webpack_require__(214);
23284
22945
 
23285
- ThumbnailItems = __webpack_require__(219);
22946
+ ThumbnailItems = __webpack_require__(215);
23286
22947
 
23287
- PresetBuilder = __webpack_require__(227);
22948
+ PresetBuilder = __webpack_require__(223);
23288
22949
 
23289
- LastAddedItems = __webpack_require__(228);
22950
+ LastAddedItems = __webpack_require__(224);
23290
22951
 
23291
- TableViewContent = __webpack_require__(238);
22952
+ TableViewContent = __webpack_require__(235);
23292
22953
 
23293
- TagBar = __webpack_require__(240);
22954
+ TagBar = __webpack_require__(237);
23294
22955
 
23295
- objDisplayAction = __webpack_require__(202);
22956
+ objDisplayAction = __webpack_require__(198);
23296
22957
 
23297
- _ref = __webpack_require__(241), toggleExpandTagBar = _ref.toggleExpandTagBar, toggleTag = _ref.toggleTag;
22958
+ _ref = __webpack_require__(238), toggleExpandTagBar = _ref.toggleExpandTagBar, toggleTag = _ref.toggleTag;
22959
+
22960
+ Obj = __webpack_require__(170);
23298
22961
 
23299
22962
  Items = React.createClass({
23300
22963
  displayName: 'Items',
@@ -23303,6 +22966,15 @@
23303
22966
  dragInProgress: false
23304
22967
  };
23305
22968
  },
22969
+ componentWillReceiveProps: function(nextProps) {
22970
+ var obj;
22971
+ if (this.props.lastAdded.isVisible && nextProps.lastAdded.lastAddedObj) {
22972
+ if (this.props.lastAdded.lastAddedObj !== nextProps.lastAdded.lastAddedObj) {
22973
+ obj = new Obj(nextProps.lastAdded.lastAddedObj);
22974
+ return this.props.objCollection.toggleSelected(obj);
22975
+ }
22976
+ }
22977
+ },
23306
22978
  baseItemsClass: function() {
23307
22979
  var baseItemClass;
23308
22980
  baseItemClass = "scrivito-content-browser-items";
@@ -23324,7 +22996,7 @@
23324
22996
  var className;
23325
22997
  className = this.baseItemsClass();
23326
22998
  if (this.state.dragInProgress) {
23327
- if (this.props.showLastAdded) {
22999
+ if (this.props.lastAdded.isVisible) {
23328
23000
  className += " uploader-drag-over-forbiden";
23329
23001
  } else {
23330
23002
  className += " uploader-drag-over";
@@ -23358,10 +23030,18 @@
23358
23030
  return "\"" + field_name + "\" options";
23359
23031
  }
23360
23032
  },
23033
+ _fileAttributes: function(file) {
23034
+ var objClass;
23035
+ objClass = scrivito.default_obj_class_for_content_type(file.type);
23036
+ return {
23037
+ blob: file,
23038
+ _obj_class: objClass
23039
+ };
23040
+ },
23361
23041
  uploadFiles: function(event) {
23362
23042
  var dataTransfer, files, preset;
23363
23043
  this.changeDragState(false)(event);
23364
- if (this.props.showLastAdded) {
23044
+ if (this.props.lastAdded.isVisible) {
23365
23045
  return;
23366
23046
  }
23367
23047
  dataTransfer = event.dataTransfer;
@@ -23372,7 +23052,15 @@
23372
23052
  if (files.length > 0) {
23373
23053
  preset = this.buildPreset();
23374
23054
  if (preset.isValid()) {
23375
- return this.props.addedObjsCollection.addFiles(files, preset.values());
23055
+ this.props.disableTags();
23056
+ return _.each(files, (function(_this) {
23057
+ return function(file) {
23058
+ var attributes;
23059
+ attributes = _this._fileAttributes(file);
23060
+ _this.props.createObj(attributes, _this.props.basePreset, preset.values(), _this.props.tags.activeTags);
23061
+ return _this.props.filter.deselectHierarchicalFilters();
23062
+ };
23063
+ })(this));
23376
23064
  } else {
23377
23065
  return this._showConflictingPresetsAlert(preset.errors());
23378
23066
  }
@@ -23394,34 +23082,43 @@
23394
23082
  };
23395
23083
  })(this);
23396
23084
  },
23085
+ renderTagBar: function() {
23086
+ if (this.props.tags.items.length > 0) {
23087
+ return React.createElement(TagBar, {
23088
+ "tags": this.props.tags,
23089
+ "toggleTag": this.toggleTagAction,
23090
+ "toggleExpandTagBar": this.toggleExpandTagBar
23091
+ });
23092
+ }
23093
+ },
23397
23094
  render: function() {
23398
23095
  return React.createElement("div", {
23399
23096
  "className": this.dropZoneClass(),
23400
23097
  "onDragOver": this.changeDragState(true),
23401
23098
  "onDrop": this.uploadFiles,
23402
23099
  "onDragLeave": this.changeDragState(false)
23403
- }, React.createElement(TagBar, {
23404
- "tags": this.props.tags,
23405
- "toggleTag": this.toggleTagAction,
23406
- "toggleExpandTagBar": this.toggleExpandTagBar
23407
- }), (this.props.objCollection.isLoading() ? React.createElement("div", {
23100
+ }, this.renderTagBar(), (this.props.objCollection.isLoading() ? React.createElement("div", {
23408
23101
  "className": "scrivito-content-browser-loading"
23409
23102
  }, React.createElement("i", {
23410
23103
  "className": "scrivito_icon scrivito_icon_refresh"
23411
- })) : this.props.showLastAdded || this.props.addedObjsCollection.hasActiveCreations() ? React.createElement(LastAddedItems, React.__spread({}, this.props, {
23104
+ })) : this.props.lastAdded.isVisible ? React.createElement(LastAddedItems, React.__spread({}, this.props, {
23412
23105
  "viewMode": this.props.viewMode,
23413
23106
  "dragInProgress": this.state.dragInProgress,
23414
- "addedObjsCollection": this.props.addedObjsCollection
23107
+ "additions": this.props.lastAdded.additions
23415
23108
  })) : this.props.viewMode === objDisplayAction.TABLE_VIEW ? React.createElement(TableView, {
23416
23109
  "objCollection": this.props.objCollection,
23110
+ "activeTags": this.props.tags.activeTags,
23417
23111
  "toggleSelected": this.props.toggleSelected,
23418
23112
  "filter": this.props.filter,
23419
- "addedObjsCollection": this.props.addedObjsCollection
23113
+ "createObj": this.props.createObj,
23114
+ "basePreset": this.props.basePreset
23420
23115
  }, React.createElement(TableViewContent, React.__spread({}, this.props))) : React.createElement(ThumbnailItems, {
23421
23116
  "objCollection": this.props.objCollection,
23422
23117
  "viewMode": this.props.viewMode,
23118
+ "activeTags": this.props.tags.activeTags,
23119
+ "basePreset": this.props.basePreset,
23423
23120
  "filter": this.props.filter,
23424
- "addedObjsCollection": this.props.addedObjsCollection
23121
+ "createObj": this.props.createObj
23425
23122
  })));
23426
23123
  }
23427
23124
  });
@@ -23431,7 +23128,7 @@
23431
23128
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23432
23129
 
23433
23130
  /***/ },
23434
- /* 218 */
23131
+ /* 214 */
23435
23132
  /***/ function(module, exports, __webpack_require__) {
23436
23133
 
23437
23134
  /* WEBPACK VAR INJECTION */(function(React) {var TableView;
@@ -23451,18 +23148,18 @@
23451
23148
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23452
23149
 
23453
23150
  /***/ },
23454
- /* 219 */
23151
+ /* 215 */
23455
23152
  /***/ function(module, exports, __webpack_require__) {
23456
23153
 
23457
23154
  /* WEBPACK VAR INJECTION */(function(React) {var ActiveNodeConfigCollector, InfiniteScrollMixin, ObjCreation, ReactDOM, ThumbnailAddItem, ThumbnailItem, ThumbnailItems;
23458
23155
 
23459
- InfiniteScrollMixin = __webpack_require__(220);
23156
+ InfiniteScrollMixin = __webpack_require__(216);
23460
23157
 
23461
- ThumbnailItem = __webpack_require__(221);
23158
+ ThumbnailItem = __webpack_require__(217);
23462
23159
 
23463
- ThumbnailAddItem = __webpack_require__(224);
23160
+ ThumbnailAddItem = __webpack_require__(220);
23464
23161
 
23465
- ObjCreation = __webpack_require__(226);
23162
+ ObjCreation = __webpack_require__(222);
23466
23163
 
23467
23164
  ActiveNodeConfigCollector = __webpack_require__(173);
23468
23165
 
@@ -23500,8 +23197,14 @@
23500
23197
  return React.createElement("ul", {
23501
23198
  "className": this.getSizeClassName()
23502
23199
  }, (this.objCreation().showCreationItem() ? React.createElement(ThumbnailAddItem, {
23200
+ "activeTags": this.props.activeTags,
23503
23201
  "objCreation": this.objCreation(),
23504
- "addedObjsCollection": this.props.addedObjsCollection
23202
+ "basePreset": true,
23203
+ "props": true,
23204
+ "ps": true,
23205
+ "basePreset": true,
23206
+ "t": true,
23207
+ "createObj": this.props.createObj
23505
23208
  }) : void 0), this.buildItems());
23506
23209
  }
23507
23210
  });
@@ -23511,7 +23214,7 @@
23511
23214
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23512
23215
 
23513
23216
  /***/ },
23514
- /* 220 */
23217
+ /* 216 */
23515
23218
  /***/ function(module, exports) {
23516
23219
 
23517
23220
  var InfiniteScrollMixin;
@@ -23578,14 +23281,14 @@
23578
23281
 
23579
23282
 
23580
23283
  /***/ },
23581
- /* 221 */
23284
+ /* 217 */
23582
23285
  /***/ function(module, exports, __webpack_require__) {
23583
23286
 
23584
23287
  /* WEBPACK VAR INJECTION */(function(React) {var InspectedItemMixin, MimeTypeIcon, ThumbnailItem;
23585
23288
 
23586
- InspectedItemMixin = __webpack_require__(222);
23289
+ InspectedItemMixin = __webpack_require__(218);
23587
23290
 
23588
- MimeTypeIcon = __webpack_require__(223);
23291
+ MimeTypeIcon = __webpack_require__(219);
23589
23292
 
23590
23293
  ThumbnailItem = React.createClass({
23591
23294
  displayName: 'ThumbnailItem',
@@ -23644,7 +23347,7 @@
23644
23347
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23645
23348
 
23646
23349
  /***/ },
23647
- /* 222 */
23350
+ /* 218 */
23648
23351
  /***/ function(module, exports) {
23649
23352
 
23650
23353
  var InspectedItemMixin;
@@ -23667,7 +23370,7 @@
23667
23370
  return className;
23668
23371
  },
23669
23372
  handleSelectClick: function() {
23670
- return this.props.objCollection.toggleSelected(this.props.obj.id());
23373
+ return this.props.objCollection.toggleSelected(this.props.obj);
23671
23374
  }
23672
23375
  };
23673
23376
 
@@ -23675,7 +23378,7 @@
23675
23378
 
23676
23379
 
23677
23380
  /***/ },
23678
- /* 223 */
23381
+ /* 219 */
23679
23382
  /***/ function(module, exports) {
23680
23383
 
23681
23384
  var MimeTypeIcon;
@@ -23722,12 +23425,12 @@
23722
23425
 
23723
23426
 
23724
23427
  /***/ },
23725
- /* 224 */
23428
+ /* 220 */
23726
23429
  /***/ function(module, exports, __webpack_require__) {
23727
23430
 
23728
23431
  /* WEBPACK VAR INJECTION */(function(React) {var AddItemMixin, ThumbnailAddItem;
23729
23432
 
23730
- AddItemMixin = __webpack_require__(225);
23433
+ AddItemMixin = __webpack_require__(221);
23731
23434
 
23732
23435
  ThumbnailAddItem = React.createClass({
23733
23436
  displayName: 'ThumbnailAddItem',
@@ -23752,7 +23455,7 @@
23752
23455
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23753
23456
 
23754
23457
  /***/ },
23755
- /* 225 */
23458
+ /* 221 */
23756
23459
  /***/ function(module, exports, __webpack_require__) {
23757
23460
 
23758
23461
  /* WEBPACK VAR INJECTION */(function(React) {var AddItemMixin;
@@ -23835,7 +23538,7 @@
23835
23538
  },
23836
23539
  createClick: function() {
23837
23540
  if (this.props.objCreation.isActive()) {
23838
- return this.props.addedObjsCollection.createObj(this.props.objCreation.preset());
23541
+ return this.props.createObj(null, this.props.basePreset, this.props.objCreation.preset(), this.props.activeTags);
23839
23542
  } else {
23840
23543
  return this.showErrorAlert(this.props.objCreation.error());
23841
23544
  }
@@ -23847,14 +23550,14 @@
23847
23550
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
23848
23551
 
23849
23552
  /***/ },
23850
- /* 226 */
23553
+ /* 222 */
23851
23554
  /***/ function(module, exports, __webpack_require__) {
23852
23555
 
23853
23556
  var ActiveNodeConfigCollector, ObjCreation, PresetBuilder;
23854
23557
 
23855
23558
  ActiveNodeConfigCollector = __webpack_require__(173);
23856
23559
 
23857
- PresetBuilder = __webpack_require__(227);
23560
+ PresetBuilder = __webpack_require__(223);
23858
23561
 
23859
23562
  ObjCreation = (function() {
23860
23563
  function ObjCreation(filter) {
@@ -23934,7 +23637,7 @@
23934
23637
 
23935
23638
 
23936
23639
  /***/ },
23937
- /* 227 */
23640
+ /* 223 */
23938
23641
  /***/ function(module, exports, __webpack_require__) {
23939
23642
 
23940
23643
  var ActiveNodeConfigCollector, PresetBuilder;
@@ -24030,18 +23733,18 @@
24030
23733
 
24031
23734
 
24032
23735
  /***/ },
24033
- /* 228 */
23736
+ /* 224 */
24034
23737
  /***/ function(module, exports, __webpack_require__) {
24035
23738
 
24036
23739
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedItems, LastAddedTableViewContent, LastAddedThumbnailItems, TableView, objDisplayAction;
24037
23740
 
24038
- LastAddedTableViewContent = __webpack_require__(229);
23741
+ LastAddedTableViewContent = __webpack_require__(225);
24039
23742
 
24040
- LastAddedThumbnailItems = __webpack_require__(235);
23743
+ LastAddedThumbnailItems = __webpack_require__(232);
24041
23744
 
24042
- TableView = __webpack_require__(218);
23745
+ TableView = __webpack_require__(214);
24043
23746
 
24044
- objDisplayAction = __webpack_require__(202);
23747
+ objDisplayAction = __webpack_require__(198);
24045
23748
 
24046
23749
  LastAddedItems = React.createClass({
24047
23750
  displayName: 'LastAddedItems',
@@ -24064,39 +23767,47 @@
24064
23767
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24065
23768
 
24066
23769
  /***/ },
24067
- /* 229 */
23770
+ /* 225 */
24068
23771
  /***/ function(module, exports, __webpack_require__) {
24069
23772
 
24070
- /* WEBPACK VAR INJECTION */(function(React) {var LastAddedTableViewContent, LastAddedTableViewErrorItem, LastAddedTableViewItem, TableViewItem;
23773
+ /* WEBPACK VAR INJECTION */(function(React) {var LastAddedTableViewContent, LastAddedTableViewErrorItem, LastAddedTableViewItem, Obj, TableViewItem, failed, isActive, isCompleted, _ref;
23774
+
23775
+ LastAddedTableViewErrorItem = __webpack_require__(226);
24071
23776
 
24072
- LastAddedTableViewErrorItem = __webpack_require__(230);
23777
+ LastAddedTableViewItem = __webpack_require__(228);
24073
23778
 
24074
- LastAddedTableViewItem = __webpack_require__(232);
23779
+ TableViewItem = __webpack_require__(231);
24075
23780
 
24076
- TableViewItem = __webpack_require__(234);
23781
+ Obj = __webpack_require__(170);
23782
+
23783
+ _ref = __webpack_require__(230), isCompleted = _ref.isCompleted, isActive = _ref.isActive, failed = _ref.failed;
24077
23784
 
24078
23785
  LastAddedTableViewContent = React.createClass({
24079
23786
  displayName: 'LastAddedTableViewContent',
24080
23787
  renderedLastAddedErrorThumbComponent: function() {
24081
- if (this.props.addedObjsCollection.hasFailedCreations()) {
23788
+ var failedAdditions;
23789
+ failedAdditions = failed(this.props.additions);
23790
+ if (failedAdditions.length) {
24082
23791
  return React.createElement(LastAddedTableViewErrorItem, {
24083
- "addedObjsCollection": this.props.addedObjsCollection
23792
+ "failedAdditions": failedAdditions
24084
23793
  });
24085
23794
  }
24086
23795
  },
24087
23796
  getLastAddedTableViewItems: function() {
24088
23797
  var items;
24089
- return items = _.map(this.props.addedObjsCollection.objs(), (function(_this) {
24090
- return function(obj) {
24091
- if (obj.status() === "active") {
23798
+ return items = _.map(this.props.additions, (function(_this) {
23799
+ return function(addition) {
23800
+ var obj;
23801
+ if (isActive(addition)) {
24092
23802
  return React.createElement(LastAddedTableViewItem, {
24093
- "key": obj.uniqueId(),
24094
- "addedItem": obj
23803
+ "key": addition.additionId,
23804
+ "addedItem": addition
24095
23805
  });
24096
- } else if (obj.status() === "completed") {
23806
+ } else if (isCompleted(addition)) {
23807
+ obj = new Obj(addition.obj);
24097
23808
  return React.createElement(TableViewItem, {
24098
- "key": obj.createdObj().id(),
24099
- "obj": obj.createdObj(),
23809
+ "key": obj.id(),
23810
+ "obj": obj,
24100
23811
  "objCollection": _this.props.objCollection
24101
23812
  });
24102
23813
  }
@@ -24115,12 +23826,12 @@
24115
23826
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24116
23827
 
24117
23828
  /***/ },
24118
- /* 230 */
23829
+ /* 226 */
24119
23830
  /***/ function(module, exports, __webpack_require__) {
24120
23831
 
24121
23832
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedErrorItemMixin, LastAddedTableViewErrorItem;
24122
23833
 
24123
- LastAddedErrorItemMixin = __webpack_require__(231);
23834
+ LastAddedErrorItemMixin = __webpack_require__(227);
24124
23835
 
24125
23836
  LastAddedTableViewErrorItem = React.createClass({
24126
23837
  displayName: 'LastAddedTableViewError',
@@ -24143,20 +23854,19 @@
24143
23854
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24144
23855
 
24145
23856
  /***/ },
24146
- /* 231 */
23857
+ /* 227 */
24147
23858
  /***/ function(module, exports, __webpack_require__) {
24148
23859
 
24149
23860
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedErrorItemMixin;
24150
23861
 
24151
23862
  LastAddedErrorItemMixin = {
24152
23863
  failureMessage: function() {
24153
- var defaultError, failedObjs, message;
23864
+ var defaultError, message;
24154
23865
  defaultError = "Upload failed. Please check your network connection.";
24155
- failedObjs = this.props.addedObjsCollection.getFailedObjs();
24156
- message = React.createElement("ul", null, _.map(failedObjs, function(obj) {
23866
+ message = React.createElement("ul", null, _.map(this.props.failedAdditions, function(obj) {
24157
23867
  return React.createElement("div", {
24158
23868
  "className": "content-browser-alert"
24159
- }, React.createElement("h4", null, obj.fileName()), React.createElement("li", null, obj.failureMessage() || defaultError));
23869
+ }, React.createElement("h4", null, obj.filename), React.createElement("li", null, obj.failureMessage || defaultError));
24160
23870
  }));
24161
23871
  return message;
24162
23872
  },
@@ -24167,9 +23877,7 @@
24167
23877
  });
24168
23878
  },
24169
23879
  getErrorsCount: function() {
24170
- var failedObjs;
24171
- failedObjs = this.props.addedObjsCollection.getFailedObjs();
24172
- return "" + failedObjs.length + " Error(s)";
23880
+ return "" + this.props.failedAdditions.length + " Error(s)";
24173
23881
  },
24174
23882
  _titleInfo: function() {
24175
23883
  return "Display full upload error message";
@@ -24181,18 +23889,18 @@
24181
23889
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24182
23890
 
24183
23891
  /***/ },
24184
- /* 232 */
23892
+ /* 228 */
24185
23893
  /***/ function(module, exports, __webpack_require__) {
24186
23894
 
24187
23895
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedItemMixin, LastAddedTableViewItem;
24188
23896
 
24189
- LastAddedItemMixin = __webpack_require__(233);
23897
+ LastAddedItemMixin = __webpack_require__(229);
24190
23898
 
24191
23899
  LastAddedTableViewItem = React.createClass({
24192
23900
  displayName: 'LastAddedTableViewItem',
24193
23901
  mixins: [LastAddedItemMixin],
24194
23902
  getUploadTitle: function() {
24195
- return "uploading file " + (this.props.addedItem.fileName()) + " ...";
23903
+ return "uploading file " + this.props.addedItem.filename + " ...";
24196
23904
  },
24197
23905
  render: function() {
24198
23906
  return React.createElement("tr", null, React.createElement("td", {
@@ -24211,21 +23919,23 @@
24211
23919
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24212
23920
 
24213
23921
  /***/ },
24214
- /* 233 */
23922
+ /* 229 */
24215
23923
  /***/ function(module, exports, __webpack_require__) {
24216
23924
 
24217
- /* WEBPACK VAR INJECTION */(function(React) {var LastAddedItemMixin;
23925
+ /* WEBPACK VAR INJECTION */(function(React) {var LastAddedItemMixin, isActive;
23926
+
23927
+ isActive = __webpack_require__(230).isActive;
24218
23928
 
24219
23929
  LastAddedItemMixin = {
24220
23930
  uploadInProgress: function() {
24221
- return this.props.addedItem.status() === "active";
23931
+ return isActive(this.props.addedItem);
24222
23932
  },
24223
23933
  renderUploadStateProgress: function() {
24224
23934
  if (this.uploadInProgress()) {
24225
23935
  return React.createElement("div", {
24226
23936
  "className": "upload_state",
24227
23937
  "style": {
24228
- width: "" + (this.props.addedItem.progress()) + "%"
23938
+ width: "" + this.props.addedItem.progress + "%"
24229
23939
  }
24230
23940
  });
24231
23941
  }
@@ -24237,12 +23947,53 @@
24237
23947
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24238
23948
 
24239
23949
  /***/ },
24240
- /* 234 */
23950
+ /* 230 */
23951
+ /***/ function(module, exports) {
23952
+
23953
+ var failed, isActive, isCompleted, isFailed, status;
23954
+
23955
+ status = function(addition) {
23956
+ if (addition.progress === 0) {
23957
+ return "failed";
23958
+ } else if (addition.progress === 100) {
23959
+ return "completed";
23960
+ } else {
23961
+ return "active";
23962
+ }
23963
+ };
23964
+
23965
+ isActive = function(addition) {
23966
+ return status(addition) === "active";
23967
+ };
23968
+
23969
+ isCompleted = function(addition) {
23970
+ return status(addition) === "completed";
23971
+ };
23972
+
23973
+ isFailed = function(addition) {
23974
+ return status(addition) === "failed";
23975
+ };
23976
+
23977
+ failed = function(additions) {
23978
+ return _.filter(additions, isFailed);
23979
+ };
23980
+
23981
+ module.exports = {
23982
+ status: status,
23983
+ failed: failed,
23984
+ isActive: isActive,
23985
+ isCompleted: isCompleted,
23986
+ isFailed: isFailed
23987
+ };
23988
+
23989
+
23990
+ /***/ },
23991
+ /* 231 */
24241
23992
  /***/ function(module, exports, __webpack_require__) {
24242
23993
 
24243
23994
  /* WEBPACK VAR INJECTION */(function(React) {var InspectedItemMixin, TableViewItem;
24244
23995
 
24245
- InspectedItemMixin = __webpack_require__(222);
23996
+ InspectedItemMixin = __webpack_require__(218);
24246
23997
 
24247
23998
  TableViewItem = React.createClass({
24248
23999
  displayName: 'TableViewItem',
@@ -24286,23 +24037,29 @@
24286
24037
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24287
24038
 
24288
24039
  /***/ },
24289
- /* 235 */
24040
+ /* 232 */
24290
24041
  /***/ function(module, exports, __webpack_require__) {
24291
24042
 
24292
- /* WEBPACK VAR INJECTION */(function(React) {var LastAddedThumbnailErrorItem, LastAddedThumbnailItem, LastAddedThumbnailItems, ThumbnailItem;
24043
+ /* WEBPACK VAR INJECTION */(function(React) {var LastAddedThumbnailErrorItem, LastAddedThumbnailItem, LastAddedThumbnailItems, Obj, ThumbnailItem, failed, isActive, isCompleted, _ref;
24293
24044
 
24294
- LastAddedThumbnailErrorItem = __webpack_require__(236);
24045
+ LastAddedThumbnailErrorItem = __webpack_require__(233);
24295
24046
 
24296
- LastAddedThumbnailItem = __webpack_require__(237);
24047
+ LastAddedThumbnailItem = __webpack_require__(234);
24297
24048
 
24298
- ThumbnailItem = __webpack_require__(221);
24049
+ ThumbnailItem = __webpack_require__(217);
24050
+
24051
+ Obj = __webpack_require__(170);
24052
+
24053
+ _ref = __webpack_require__(230), isCompleted = _ref.isCompleted, isActive = _ref.isActive, failed = _ref.failed;
24299
24054
 
24300
24055
  LastAddedThumbnailItems = React.createClass({
24301
24056
  displayName: "LastAddedThumbnailItems",
24302
24057
  renderedLastAddedErrorThumbComponent: function() {
24303
- if (this.props.addedObjsCollection.hasFailedCreations()) {
24058
+ var failedAdditions;
24059
+ failedAdditions = failed(this.props.additions);
24060
+ if (failedAdditions.length) {
24304
24061
  return React.createElement(LastAddedThumbnailErrorItem, {
24305
- "addedObjsCollection": this.props.addedObjsCollection
24062
+ "failedAdditions": failedAdditions
24306
24063
  });
24307
24064
  }
24308
24065
  },
@@ -24310,17 +24067,19 @@
24310
24067
  return "items scrivito-content-browser-thumbnails small";
24311
24068
  },
24312
24069
  buildItems: function() {
24313
- return _.map(this.props.addedObjsCollection.objs(), (function(_this) {
24314
- return function(obj) {
24315
- if (obj.status() === "active") {
24070
+ return _.map(this.props.additions, (function(_this) {
24071
+ return function(addition) {
24072
+ var obj;
24073
+ if (isActive(addition)) {
24316
24074
  return React.createElement(LastAddedThumbnailItem, {
24317
- "key": obj.uniqueId(),
24318
- "addedItem": obj
24075
+ "key": addition.additionId,
24076
+ "addedItem": addition
24319
24077
  });
24320
- } else if (obj.status() === "completed") {
24078
+ } else if (isCompleted(addition)) {
24079
+ obj = new Obj(addition.obj);
24321
24080
  return React.createElement(ThumbnailItem, {
24322
- "key": obj.createdObj().id(),
24323
- "obj": obj.createdObj(),
24081
+ "key": obj.id(),
24082
+ "obj": obj,
24324
24083
  "objCollection": _this.props.objCollection
24325
24084
  });
24326
24085
  }
@@ -24339,12 +24098,12 @@
24339
24098
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24340
24099
 
24341
24100
  /***/ },
24342
- /* 236 */
24101
+ /* 233 */
24343
24102
  /***/ function(module, exports, __webpack_require__) {
24344
24103
 
24345
24104
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedErrorItemMixin, LastAddedThumbnailErrorItem;
24346
24105
 
24347
- LastAddedErrorItemMixin = __webpack_require__(231);
24106
+ LastAddedErrorItemMixin = __webpack_require__(227);
24348
24107
 
24349
24108
  LastAddedThumbnailErrorItem = React.createClass({
24350
24109
  displayName: 'LastAddedThumbnailErrorItem',
@@ -24369,12 +24128,12 @@
24369
24128
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24370
24129
 
24371
24130
  /***/ },
24372
- /* 237 */
24131
+ /* 234 */
24373
24132
  /***/ function(module, exports, __webpack_require__) {
24374
24133
 
24375
24134
  /* WEBPACK VAR INJECTION */(function(React) {var LastAddedItemMixin, LastAddedThumbnailItem;
24376
24135
 
24377
- LastAddedItemMixin = __webpack_require__(233);
24136
+ LastAddedItemMixin = __webpack_require__(229);
24378
24137
 
24379
24138
  LastAddedThumbnailItem = React.createClass({
24380
24139
  displayName: 'LastAddedThumbnailItem',
@@ -24396,7 +24155,7 @@
24396
24155
  "className": "scrivito-content-browser-preview"
24397
24156
  }), React.createElement("span", {
24398
24157
  "className": "scrivito-content-browser-thumbnails-name"
24399
- }, this.props.addedItem.fileName())));
24158
+ }, this.props.addedItem.filename)));
24400
24159
  }
24401
24160
  });
24402
24161
 
@@ -24405,18 +24164,18 @@
24405
24164
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24406
24165
 
24407
24166
  /***/ },
24408
- /* 238 */
24167
+ /* 235 */
24409
24168
  /***/ function(module, exports, __webpack_require__) {
24410
24169
 
24411
24170
  /* WEBPACK VAR INJECTION */(function(React) {var InfiniteScrollMixin, ObjCreation, ReactDOM, TableViewAddItem, TableViewContent, TableViewItem;
24412
24171
 
24413
- TableViewItem = __webpack_require__(234);
24172
+ TableViewItem = __webpack_require__(231);
24414
24173
 
24415
- TableViewAddItem = __webpack_require__(239);
24174
+ TableViewAddItem = __webpack_require__(236);
24416
24175
 
24417
- ObjCreation = __webpack_require__(226);
24176
+ ObjCreation = __webpack_require__(222);
24418
24177
 
24419
- InfiniteScrollMixin = __webpack_require__(220);
24178
+ InfiniteScrollMixin = __webpack_require__(216);
24420
24179
 
24421
24180
  ReactDOM = __webpack_require__(153);
24422
24181
 
@@ -24444,8 +24203,14 @@
24444
24203
  return React.createElement("div", {
24445
24204
  "className": "scrivito-content-browser-list-content"
24446
24205
  }, React.createElement("table", null, React.createElement("tbody", null, (this.objCreation().showCreationItem() ? React.createElement(TableViewAddItem, {
24206
+ "activeTags": this.props.activeTags,
24447
24207
  "objCreation": this.objCreation(),
24448
- "addedObjsCollection": this.props.addedObjsCollection
24208
+ "basePreset": true,
24209
+ "props": true,
24210
+ "ps": true,
24211
+ "basePreset": true,
24212
+ "t": true,
24213
+ "createObj": this.props.createObj
24449
24214
  }) : void 0), this.getTableViewItems())));
24450
24215
  }
24451
24216
  });
@@ -24455,12 +24220,12 @@
24455
24220
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24456
24221
 
24457
24222
  /***/ },
24458
- /* 239 */
24223
+ /* 236 */
24459
24224
  /***/ function(module, exports, __webpack_require__) {
24460
24225
 
24461
24226
  /* WEBPACK VAR INJECTION */(function(React) {var AddItemMixin, TableViewAddItem;
24462
24227
 
24463
- AddItemMixin = __webpack_require__(225);
24228
+ AddItemMixin = __webpack_require__(221);
24464
24229
 
24465
24230
  TableViewAddItem = React.createClass({
24466
24231
  mixins: [AddItemMixin],
@@ -24485,7 +24250,7 @@
24485
24250
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24486
24251
 
24487
24252
  /***/ },
24488
- /* 240 */
24253
+ /* 237 */
24489
24254
  /***/ function(module, exports, __webpack_require__) {
24490
24255
 
24491
24256
  /* WEBPACK VAR INJECTION */(function(React) {var TagBar;
@@ -24536,7 +24301,7 @@
24536
24301
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24537
24302
 
24538
24303
  /***/ },
24539
- /* 241 */
24304
+ /* 238 */
24540
24305
  /***/ function(module, exports) {
24541
24306
 
24542
24307
  var TagsActionCreator;
@@ -24576,7 +24341,7 @@
24576
24341
  TagsActionCreator.toggleTag = function(tag, filter) {
24577
24342
  return function(dispatch, getState) {
24578
24343
  dispatch(TagsActionCreator._startToggleTag(tag));
24579
- return filter.trigger("tagActiveStateChanged", filter);
24344
+ return filter.trigger("reduxStateChanged", filter);
24580
24345
  };
24581
24346
  };
24582
24347
 
@@ -24612,7 +24377,7 @@
24612
24377
 
24613
24378
 
24614
24379
  /***/ },
24615
- /* 242 */
24380
+ /* 239 */
24616
24381
  /***/ function(module, exports, __webpack_require__) {
24617
24382
 
24618
24383
  /* WEBPACK VAR INJECTION */(function(React) {var MoreItemsSpinner;
@@ -24633,18 +24398,18 @@
24633
24398
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24634
24399
 
24635
24400
  /***/ },
24636
- /* 243 */
24401
+ /* 240 */
24637
24402
  /***/ function(module, exports, __webpack_require__) {
24638
24403
 
24639
24404
  /* WEBPACK VAR INJECTION */(function(React) {var Inspector, InspectorAction, MaximizeInspectorToggle, ModalDialogsModule, ReactRedux;
24640
24405
 
24641
- ModalDialogsModule = __webpack_require__(244);
24406
+ ModalDialogsModule = __webpack_require__(241);
24642
24407
 
24643
- MaximizeInspectorToggle = __webpack_require__(245);
24408
+ MaximizeInspectorToggle = __webpack_require__(242);
24644
24409
 
24645
- InspectorAction = __webpack_require__(246);
24410
+ InspectorAction = __webpack_require__(243);
24646
24411
 
24647
- ReactRedux = __webpack_require__(182);
24412
+ ReactRedux = __webpack_require__(178);
24648
24413
 
24649
24414
  Inspector = React.createClass({
24650
24415
  displayName: 'Inspector',
@@ -24712,7 +24477,7 @@
24712
24477
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24713
24478
 
24714
24479
  /***/ },
24715
- /* 244 */
24480
+ /* 241 */
24716
24481
  /***/ function(module, exports, __webpack_require__) {
24717
24482
 
24718
24483
  /* WEBPACK VAR INJECTION */(function(React) {var ModalDialogsModule;
@@ -24739,7 +24504,7 @@
24739
24504
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24740
24505
 
24741
24506
  /***/ },
24742
- /* 245 */
24507
+ /* 242 */
24743
24508
  /***/ function(module, exports, __webpack_require__) {
24744
24509
 
24745
24510
  /* WEBPACK VAR INJECTION */(function(React) {var MaximizeInspectorToggle;
@@ -24765,7 +24530,7 @@
24765
24530
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24766
24531
 
24767
24532
  /***/ },
24768
- /* 246 */
24533
+ /* 243 */
24769
24534
  /***/ function(module, exports) {
24770
24535
 
24771
24536
  var InspectorActionCreator;
@@ -24789,12 +24554,12 @@
24789
24554
 
24790
24555
 
24791
24556
  /***/ },
24792
- /* 247 */
24557
+ /* 244 */
24793
24558
  /***/ function(module, exports, __webpack_require__) {
24794
24559
 
24795
24560
  /* WEBPACK VAR INJECTION */(function(React) {var Footer, ModalDialogsModule;
24796
24561
 
24797
- ModalDialogsModule = __webpack_require__(244);
24562
+ ModalDialogsModule = __webpack_require__(241);
24798
24563
 
24799
24564
  Footer = React.createClass({
24800
24565
  displayName: 'Footer',
@@ -24861,7 +24626,7 @@
24861
24626
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
24862
24627
 
24863
24628
  /***/ },
24864
- /* 248 */
24629
+ /* 245 */
24865
24630
  /***/ function(module, exports) {
24866
24631
 
24867
24632
  var LastAddedActionCreator;
@@ -24886,16 +24651,176 @@
24886
24651
 
24887
24652
 
24888
24653
  /***/ },
24889
- /* 249 */
24654
+ /* 246 */
24655
+ /***/ function(module, exports, __webpack_require__) {
24656
+
24657
+ var CREATE_OBJ_FAILED, CREATE_OBJ_FINISH, CREATE_OBJ_PROGRESS_UPDATE, CREATE_OBJ_START, DELETE_OBJ_FINISH, Fetcher, createObj, objDeleted, _createObjFailed, _createObjFinish, _createObjProgressUpdate, _createObjStart, _getTagsAttributes, _hasCorrectTagAttribute;
24658
+
24659
+ Fetcher = __webpack_require__(247);
24660
+
24661
+ CREATE_OBJ_START = 'CREATE_OBJ_START';
24662
+
24663
+ CREATE_OBJ_FINISH = 'CREATE_OBJ_FINISH';
24664
+
24665
+ CREATE_OBJ_PROGRESS_UPDATE = 'CREATE_OBJ_PROGRESS_UPDATE';
24666
+
24667
+ CREATE_OBJ_FAILED = 'CREATE_OBJ_FAILED';
24668
+
24669
+ DELETE_OBJ_FINISH = 'DELETE_OBJ_FINISH';
24670
+
24671
+ _createObjStart = function(additionId, filename) {
24672
+ return {
24673
+ type: CREATE_OBJ_START,
24674
+ additionId: additionId,
24675
+ filename: filename,
24676
+ progress: 10
24677
+ };
24678
+ };
24679
+
24680
+ _createObjProgressUpdate = function(additionId, progress) {
24681
+ return {
24682
+ type: CREATE_OBJ_PROGRESS_UPDATE,
24683
+ additionId: additionId,
24684
+ progress: progress
24685
+ };
24686
+ };
24687
+
24688
+ _createObjFinish = function(additionId, obj) {
24689
+ return {
24690
+ type: CREATE_OBJ_FINISH,
24691
+ additionId: additionId,
24692
+ obj: obj
24693
+ };
24694
+ };
24695
+
24696
+ _createObjFailed = function(additionId, message) {
24697
+ return {
24698
+ type: CREATE_OBJ_FAILED,
24699
+ additionId: additionId,
24700
+ message: message
24701
+ };
24702
+ };
24703
+
24704
+ _hasCorrectTagAttribute = function(objClass) {
24705
+ var _ref;
24706
+ return (objClass != null ? (_ref = objClass.attribute('tags')) != null ? _ref.type : void 0 : void 0) === 'stringlist';
24707
+ };
24708
+
24709
+ _getTagsAttributes = function(objClassName, activeTags) {
24710
+ var objClass;
24711
+ objClass = scrivito.ObjClass.find(objClassName);
24712
+ if (activeTags.length > 0 && _hasCorrectTagAttribute(objClass)) {
24713
+ return {
24714
+ tags: activeTags
24715
+ };
24716
+ }
24717
+ };
24718
+
24719
+ objDeleted = function(objId) {
24720
+ return {
24721
+ type: DELETE_OBJ_FINISH,
24722
+ objId: objId
24723
+ };
24724
+ };
24725
+
24726
+ createObj = function(attributes, basePreset, preset, activeTags) {
24727
+ if (attributes == null) {
24728
+ attributes = {};
24729
+ }
24730
+ if (basePreset == null) {
24731
+ basePreset = {};
24732
+ }
24733
+ if (preset == null) {
24734
+ preset = {};
24735
+ }
24736
+ if (activeTags == null) {
24737
+ activeTags = [];
24738
+ }
24739
+ return function(dispatch) {
24740
+ var additionId, filename, objClassName, tags, _ref;
24741
+ additionId = _.uniqueId('addition');
24742
+ objClassName = attributes._obj_class || preset._obj_class || basePreset._obj_class;
24743
+ tags = _getTagsAttributes(objClassName, activeTags) || {};
24744
+ attributes = _.extend({}, basePreset, tags, preset, attributes);
24745
+ filename = (_ref = attributes.blob) != null ? _ref.name : void 0;
24746
+ dispatch(_createObjStart(additionId, filename));
24747
+ return scrivito.create_obj(attributes).then(function(_arg) {
24748
+ var id;
24749
+ id = _arg.id;
24750
+ dispatch(_createObjProgressUpdate(additionId, 50));
24751
+ return Fetcher.fetchObjData(id);
24752
+ }).then(function(obj) {
24753
+ return dispatch(_createObjFinish(additionId, obj));
24754
+ }).fail(function(error) {
24755
+ return dispatch(_createObjFailed(additionId, error != null ? error.message : void 0));
24756
+ });
24757
+ };
24758
+ };
24759
+
24760
+ module.exports = {
24761
+ CREATE_OBJ_START: CREATE_OBJ_START,
24762
+ CREATE_OBJ_FINISH: CREATE_OBJ_FINISH,
24763
+ CREATE_OBJ_PROGRESS_UPDATE: CREATE_OBJ_PROGRESS_UPDATE,
24764
+ CREATE_OBJ_FAILED: CREATE_OBJ_FAILED,
24765
+ DELETE_OBJ_FINISH: DELETE_OBJ_FINISH,
24766
+ _createObjStart: _createObjStart,
24767
+ _createObjFinish: _createObjFinish,
24768
+ _createObjProgressUpdate: _createObjProgressUpdate,
24769
+ _createObjFailed: _createObjFailed,
24770
+ createObj: createObj,
24771
+ objDeleted: objDeleted
24772
+ };
24773
+
24774
+
24775
+ /***/ },
24776
+ /* 247 */
24777
+ /***/ function(module, exports, __webpack_require__) {
24778
+
24779
+ var QueryBuilder, fetchObjData;
24780
+
24781
+ QueryBuilder = __webpack_require__(172);
24782
+
24783
+ fetchObjData = function(id, retryCount, promise) {
24784
+ if (retryCount == null) {
24785
+ retryCount = 0;
24786
+ }
24787
+ if (promise == null) {
24788
+ promise = $.Deferred();
24789
+ }
24790
+ QueryBuilder.byId(id).load_batch().done(function(searchResult) {
24791
+ if (searchResult.hits.length) {
24792
+ return promise.resolve(searchResult.hits[0]);
24793
+ } else {
24794
+ if (retryCount < 2) {
24795
+ return window.setTimeout((function() {
24796
+ return fetchObjData(id, retryCount + 1, promise);
24797
+ }), 500);
24798
+ } else {
24799
+ return promise.reject();
24800
+ }
24801
+ }
24802
+ }).fail(function() {
24803
+ return promise.reject();
24804
+ });
24805
+ return promise;
24806
+ };
24807
+
24808
+ module.exports = {
24809
+ fetchObjData: fetchObjData
24810
+ };
24811
+
24812
+
24813
+ /***/ },
24814
+ /* 248 */
24890
24815
  /***/ function(module, exports, __webpack_require__) {
24891
24816
 
24892
24817
  var applyMiddleware, combinedReducer, configureStore, createStore, thunkMiddleware, _ref;
24893
24818
 
24894
- thunkMiddleware = __webpack_require__(250);
24819
+ thunkMiddleware = __webpack_require__(249);
24895
24820
 
24896
- _ref = __webpack_require__(190), createStore = _ref.createStore, applyMiddleware = _ref.applyMiddleware;
24821
+ _ref = __webpack_require__(186), createStore = _ref.createStore, applyMiddleware = _ref.applyMiddleware;
24897
24822
 
24898
- combinedReducer = __webpack_require__(251);
24823
+ combinedReducer = __webpack_require__(250);
24899
24824
 
24900
24825
  configureStore = function(initialState) {
24901
24826
  var createStoreWithMiddleware;
@@ -24907,7 +24832,7 @@
24907
24832
 
24908
24833
 
24909
24834
  /***/ },
24910
- /* 250 */
24835
+ /* 249 */
24911
24836
  /***/ function(module, exports) {
24912
24837
 
24913
24838
  'use strict';
@@ -24926,25 +24851,28 @@
24926
24851
  module.exports = thunkMiddleware;
24927
24852
 
24928
24853
  /***/ },
24929
- /* 251 */
24854
+ /* 250 */
24930
24855
  /***/ function(module, exports, __webpack_require__) {
24931
24856
 
24932
- var Redux, TagsReducer, combinedReducer, inspectorReducer, lastAddedReducer, objDisplayReducer;
24857
+ var Redux, TagsReducer, combinedReducer, inspectorReducer, lastAddedReducer, objDisplayReducer, sortCriteria;
24858
+
24859
+ Redux = __webpack_require__(186);
24933
24860
 
24934
- Redux = __webpack_require__(190);
24861
+ inspectorReducer = __webpack_require__(251);
24935
24862
 
24936
- inspectorReducer = __webpack_require__(252);
24863
+ lastAddedReducer = __webpack_require__(252);
24937
24864
 
24938
- lastAddedReducer = __webpack_require__(253);
24865
+ objDisplayReducer = __webpack_require__(255);
24939
24866
 
24940
- objDisplayReducer = __webpack_require__(254);
24867
+ sortCriteria = __webpack_require__(256);
24941
24868
 
24942
- TagsReducer = __webpack_require__(255);
24869
+ TagsReducer = __webpack_require__(257);
24943
24870
 
24944
24871
  combinedReducer = Redux.combineReducers({
24945
24872
  objDisplay: objDisplayReducer,
24946
24873
  inspector: inspectorReducer,
24947
24874
  lastAdded: lastAddedReducer,
24875
+ sortCriteria: sortCriteria,
24948
24876
  tags: TagsReducer
24949
24877
  });
24950
24878
 
@@ -24952,12 +24880,12 @@
24952
24880
 
24953
24881
 
24954
24882
  /***/ },
24955
- /* 252 */
24883
+ /* 251 */
24956
24884
  /***/ function(module, exports, __webpack_require__) {
24957
24885
 
24958
24886
  var inspectorActions, inspectorReducer;
24959
24887
 
24960
- inspectorActions = __webpack_require__(246);
24888
+ inspectorActions = __webpack_require__(243);
24961
24889
 
24962
24890
  inspectorReducer = function(state, action) {
24963
24891
  if (state == null) {
@@ -24979,17 +24907,55 @@
24979
24907
 
24980
24908
 
24981
24909
  /***/ },
24982
- /* 253 */
24910
+ /* 252 */
24983
24911
  /***/ function(module, exports, __webpack_require__) {
24984
24912
 
24985
- var LAST_ADDED_TOOGLE, LastAddedReducer;
24913
+ var CREATE_OBJ_FAILED, CREATE_OBJ_FINISH, CREATE_OBJ_PROGRESS_UPDATE, CREATE_OBJ_START, DELETE_OBJ_FINISH, LAST_ADDED_TOOGLE, LastAddedReducer, deleteAdition, update, updateAddition, _ref;
24914
+
24915
+ LAST_ADDED_TOOGLE = __webpack_require__(245).LAST_ADDED_TOOGLE;
24916
+
24917
+ _ref = __webpack_require__(246), CREATE_OBJ_START = _ref.CREATE_OBJ_START, CREATE_OBJ_PROGRESS_UPDATE = _ref.CREATE_OBJ_PROGRESS_UPDATE, CREATE_OBJ_FINISH = _ref.CREATE_OBJ_FINISH, CREATE_OBJ_FAILED = _ref.CREATE_OBJ_FAILED, DELETE_OBJ_FINISH = _ref.DELETE_OBJ_FINISH;
24918
+
24919
+ update = __webpack_require__(253);
24920
+
24921
+ deleteAdition = function(state, objId) {
24922
+ var addedObjIndex;
24923
+ addedObjIndex = _.findIndex(state.additions, function(addedObj) {
24924
+ return addedObj.progress === 100 && addedObj.obj.id === objId;
24925
+ });
24926
+ if (addedObjIndex > -1) {
24927
+ return update(state, {
24928
+ additions: {
24929
+ $splice: [[addedObjIndex, 1]]
24930
+ }
24931
+ });
24932
+ } else {
24933
+ return state;
24934
+ }
24935
+ };
24986
24936
 
24987
- LAST_ADDED_TOOGLE = __webpack_require__(248).LAST_ADDED_TOOGLE;
24937
+ updateAddition = function(state, id, newProps) {
24938
+ var addition, index;
24939
+ index = _.findIndex(state.additions, {
24940
+ additionId: id
24941
+ });
24942
+ addition = state.additions[index];
24943
+ addition = update(addition, {
24944
+ $merge: newProps
24945
+ });
24946
+ return update(state, {
24947
+ additions: {
24948
+ $splice: [[index, 1, addition]]
24949
+ }
24950
+ });
24951
+ };
24988
24952
 
24989
24953
  LastAddedReducer = function(state, action) {
24954
+ var addition;
24990
24955
  if (state == null) {
24991
24956
  state = {
24992
- isVisible: false
24957
+ isVisible: false,
24958
+ additions: []
24993
24959
  };
24994
24960
  }
24995
24961
  switch (action.type) {
@@ -24997,6 +24963,34 @@
24997
24963
  return _.extend({}, state, {
24998
24964
  isVisible: action.isVisible
24999
24965
  });
24966
+ case CREATE_OBJ_START:
24967
+ addition = _.omit(action, 'type');
24968
+ return update(state, {
24969
+ additions: {
24970
+ $unshift: [addition]
24971
+ }
24972
+ });
24973
+ case CREATE_OBJ_PROGRESS_UPDATE:
24974
+ return updateAddition(state, action.additionId, {
24975
+ progress: action.progress
24976
+ });
24977
+ case CREATE_OBJ_FINISH:
24978
+ state = updateAddition(state, action.additionId, {
24979
+ obj: action.obj,
24980
+ progress: 100
24981
+ });
24982
+ return update(state, {
24983
+ lastAddedObj: {
24984
+ $set: action.obj
24985
+ }
24986
+ });
24987
+ case CREATE_OBJ_FAILED:
24988
+ return updateAddition(state, action.additionId, {
24989
+ failureMessage: action.message,
24990
+ progress: 0
24991
+ });
24992
+ case DELETE_OBJ_FINISH:
24993
+ return deleteAdition(state, action.objId);
25000
24994
  default:
25001
24995
  return state;
25002
24996
  }
@@ -25005,13 +24999,131 @@
25005
24999
  module.exports = LastAddedReducer;
25006
25000
 
25007
25001
 
25002
+ /***/ },
25003
+ /* 253 */
25004
+ /***/ function(module, exports, __webpack_require__) {
25005
+
25006
+ module.exports = __webpack_require__(254);
25007
+
25008
25008
  /***/ },
25009
25009
  /* 254 */
25010
+ /***/ function(module, exports, __webpack_require__) {
25011
+
25012
+ /**
25013
+ * Copyright 2013-2015, Facebook, Inc.
25014
+ * All rights reserved.
25015
+ *
25016
+ * This source code is licensed under the BSD-style license found in the
25017
+ * LICENSE file in the root directory of this source tree. An additional grant
25018
+ * of patent rights can be found in the PATENTS file in the same directory.
25019
+ *
25020
+ * @providesModule update
25021
+ */
25022
+
25023
+ /* global hasOwnProperty:true */
25024
+
25025
+ 'use strict';
25026
+
25027
+ var assign = __webpack_require__(38);
25028
+ var keyOf = __webpack_require__(78);
25029
+ var invariant = __webpack_require__(12);
25030
+ var hasOwnProperty = ({}).hasOwnProperty;
25031
+
25032
+ function shallowCopy(x) {
25033
+ if (Array.isArray(x)) {
25034
+ return x.concat();
25035
+ } else if (x && typeof x === 'object') {
25036
+ return assign(new x.constructor(), x);
25037
+ } else {
25038
+ return x;
25039
+ }
25040
+ }
25041
+
25042
+ var COMMAND_PUSH = keyOf({ $push: null });
25043
+ var COMMAND_UNSHIFT = keyOf({ $unshift: null });
25044
+ var COMMAND_SPLICE = keyOf({ $splice: null });
25045
+ var COMMAND_SET = keyOf({ $set: null });
25046
+ var COMMAND_MERGE = keyOf({ $merge: null });
25047
+ var COMMAND_APPLY = keyOf({ $apply: null });
25048
+
25049
+ var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
25050
+
25051
+ var ALL_COMMANDS_SET = {};
25052
+
25053
+ ALL_COMMANDS_LIST.forEach(function (command) {
25054
+ ALL_COMMANDS_SET[command] = true;
25055
+ });
25056
+
25057
+ function invariantArrayCase(value, spec, command) {
25058
+ !Array.isArray(value) ? false ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
25059
+ var specValue = spec[command];
25060
+ !Array.isArray(specValue) ? false ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
25061
+ }
25062
+
25063
+ function update(value, spec) {
25064
+ !(typeof spec === 'object') ? false ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
25065
+
25066
+ if (hasOwnProperty.call(spec, COMMAND_SET)) {
25067
+ !(Object.keys(spec).length === 1) ? false ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
25068
+
25069
+ return spec[COMMAND_SET];
25070
+ }
25071
+
25072
+ var nextValue = shallowCopy(value);
25073
+
25074
+ if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
25075
+ var mergeObj = spec[COMMAND_MERGE];
25076
+ !(mergeObj && typeof mergeObj === 'object') ? false ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
25077
+ !(nextValue && typeof nextValue === 'object') ? false ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
25078
+ assign(nextValue, spec[COMMAND_MERGE]);
25079
+ }
25080
+
25081
+ if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
25082
+ invariantArrayCase(value, spec, COMMAND_PUSH);
25083
+ spec[COMMAND_PUSH].forEach(function (item) {
25084
+ nextValue.push(item);
25085
+ });
25086
+ }
25087
+
25088
+ if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
25089
+ invariantArrayCase(value, spec, COMMAND_UNSHIFT);
25090
+ spec[COMMAND_UNSHIFT].forEach(function (item) {
25091
+ nextValue.unshift(item);
25092
+ });
25093
+ }
25094
+
25095
+ if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
25096
+ !Array.isArray(value) ? false ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
25097
+ !Array.isArray(spec[COMMAND_SPLICE]) ? false ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
25098
+ spec[COMMAND_SPLICE].forEach(function (args) {
25099
+ !Array.isArray(args) ? false ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
25100
+ nextValue.splice.apply(nextValue, args);
25101
+ });
25102
+ }
25103
+
25104
+ if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
25105
+ !(typeof spec[COMMAND_APPLY] === 'function') ? false ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
25106
+ nextValue = spec[COMMAND_APPLY](nextValue);
25107
+ }
25108
+
25109
+ for (var k in spec) {
25110
+ if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
25111
+ nextValue[k] = update(value[k], spec[k]);
25112
+ }
25113
+ }
25114
+
25115
+ return nextValue;
25116
+ }
25117
+
25118
+ module.exports = update;
25119
+
25120
+ /***/ },
25121
+ /* 255 */
25010
25122
  /***/ function(module, exports, __webpack_require__) {
25011
25123
 
25012
25124
  var SET_VIEW_MODE, THUMBNAIL_VIEW, objDisplayReducer, _ref;
25013
25125
 
25014
- _ref = __webpack_require__(202), THUMBNAIL_VIEW = _ref.THUMBNAIL_VIEW, SET_VIEW_MODE = _ref.SET_VIEW_MODE;
25126
+ _ref = __webpack_require__(198), THUMBNAIL_VIEW = _ref.THUMBNAIL_VIEW, SET_VIEW_MODE = _ref.SET_VIEW_MODE;
25015
25127
 
25016
25128
  objDisplayReducer = function(state, action) {
25017
25129
  if (state == null) {
@@ -25033,12 +25145,41 @@
25033
25145
 
25034
25146
 
25035
25147
  /***/ },
25036
- /* 255 */
25148
+ /* 256 */
25149
+ /***/ function(module, exports, __webpack_require__) {
25150
+
25151
+ var CHANGE_SORT_ORDER, DESC_SORT_ORDER, sortCriteriaReducer, _ref;
25152
+
25153
+ _ref = __webpack_require__(166), CHANGE_SORT_ORDER = _ref.CHANGE_SORT_ORDER, DESC_SORT_ORDER = _ref.DESC_SORT_ORDER;
25154
+
25155
+ sortCriteriaReducer = function(state, action) {
25156
+ if (state == null) {
25157
+ state = {
25158
+ sortField: '_last_changed',
25159
+ sortDirection: DESC_SORT_ORDER
25160
+ };
25161
+ }
25162
+ switch (action.type) {
25163
+ case CHANGE_SORT_ORDER:
25164
+ return {
25165
+ sortField: action.criteriaType,
25166
+ sortDirection: action.sortDirection
25167
+ };
25168
+ default:
25169
+ return state;
25170
+ }
25171
+ };
25172
+
25173
+ module.exports = sortCriteriaReducer;
25174
+
25175
+
25176
+ /***/ },
25177
+ /* 257 */
25037
25178
  /***/ function(module, exports, __webpack_require__) {
25038
25179
 
25039
25180
  var COMPLETE_FETCHING_TAGS, DISABLE_TAGS, EXPAND_TOGGLE, START_FETCHING_TAGS, TOGGLE_TAG, TagsReducer, defaultState, getActiveTags, _ref;
25040
25181
 
25041
- _ref = __webpack_require__(241), START_FETCHING_TAGS = _ref.START_FETCHING_TAGS, EXPAND_TOGGLE = _ref.EXPAND_TOGGLE, TOGGLE_TAG = _ref.TOGGLE_TAG, COMPLETE_FETCHING_TAGS = _ref.COMPLETE_FETCHING_TAGS, DISABLE_TAGS = _ref.DISABLE_TAGS;
25182
+ _ref = __webpack_require__(238), START_FETCHING_TAGS = _ref.START_FETCHING_TAGS, EXPAND_TOGGLE = _ref.EXPAND_TOGGLE, TOGGLE_TAG = _ref.TOGGLE_TAG, COMPLETE_FETCHING_TAGS = _ref.COMPLETE_FETCHING_TAGS, DISABLE_TAGS = _ref.DISABLE_TAGS;
25042
25183
 
25043
25184
  getActiveTags = function(currentActiveTags, actionTag) {
25044
25185
  var activeTags;