scrivito_content_browser 0.40.0.rc1 → 0.40.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5789790d8ffabfe6cbf4e1f0cbb911e29e0d67d0
|
4
|
+
data.tar.gz: 99fa730ccb2d0c63f9f1a2bf0f8cfb7445b9a414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4819017905720bffba4aaba92dc59ace969407cb4e327d42ca39afca2bbe6acf26b0e9b21c875656a5aa4416124bc0dd6256bc038a555d7dfa4a2f42b1a7ed5
|
7
|
+
data.tar.gz: 2c20fbd8d0d588a44cdeb2a15353eb146d7f38309bf9a3e5427fe76934a98025ad1fdbe9ac8d350318c2ff8c3b4db0e5d2741c879a440544e897f6dda1bf4d2a
|
@@ -18,8 +18,10 @@
|
|
18
18
|
scrivito.content_browser = (function() {
|
19
19
|
return {
|
20
20
|
filters: {},
|
21
|
+
base_preset: {},
|
21
22
|
components: {},
|
22
23
|
models: {},
|
24
|
+
base_query: null,
|
23
25
|
_center: function(domElement) {
|
24
26
|
if (domElement) {
|
25
27
|
domElement = $(domElement);
|
@@ -44,11 +46,13 @@
|
|
44
46
|
return new models.Filter(filter_definition);
|
45
47
|
},
|
46
48
|
_startReact: function() {
|
47
|
-
var filter, filterConfig;
|
49
|
+
var baseQuery, filter, filterConfig;
|
48
50
|
filterConfig = this.options.filters || this.filters;
|
51
|
+
baseQuery = this.options.base_query || this.base_query;
|
49
52
|
filter = this._buildFilter(filterConfig);
|
50
53
|
return this._reactApp = React.render(React.createElement(ui.App, {
|
51
54
|
"initialFilter": filter,
|
55
|
+
"baseQuery": baseQuery,
|
52
56
|
"container": this
|
53
57
|
}), document.getElementById('scrivito-content-browser'));
|
54
58
|
},
|
@@ -60,6 +64,9 @@
|
|
60
64
|
if (options == null) {
|
61
65
|
options = {};
|
62
66
|
}
|
67
|
+
if (!options.hasOwnProperty('base_preset')) {
|
68
|
+
options.base_preset = this.base_preset;
|
69
|
+
}
|
63
70
|
this.options = options;
|
64
71
|
this._loadModal();
|
65
72
|
this._startReact();
|
@@ -141,10 +148,10 @@
|
|
141
148
|
};
|
142
149
|
|
143
150
|
models.FilterNode = (function() {
|
144
|
-
function FilterNode(filter, name,
|
151
|
+
function FilterNode(filter, name, filterDefinition) {
|
145
152
|
this.filter = filter;
|
146
153
|
this.name = name;
|
147
|
-
this.title =
|
154
|
+
this.title = filterDefinition.title;
|
148
155
|
this.title || (this.title = this._fallbackTitle());
|
149
156
|
}
|
150
157
|
|
@@ -160,6 +167,34 @@
|
|
160
167
|
|
161
168
|
})();
|
162
169
|
|
170
|
+
models.FilterCollectionNode = (function(_super) {
|
171
|
+
__extends(FilterCollectionNode, _super);
|
172
|
+
|
173
|
+
function FilterCollectionNode(filter, name, filterDefinition) {
|
174
|
+
FilterCollectionNode.__super__.constructor.call(this, filter, name, filterDefinition);
|
175
|
+
this.children = [];
|
176
|
+
}
|
177
|
+
|
178
|
+
FilterCollectionNode.prototype.deselect = function() {
|
179
|
+
return _.each(this.children, function(child) {
|
180
|
+
return child.active = false;
|
181
|
+
});
|
182
|
+
};
|
183
|
+
|
184
|
+
FilterCollectionNode.prototype.isExpanded = function() {
|
185
|
+
return !!this.expanded;
|
186
|
+
};
|
187
|
+
|
188
|
+
FilterCollectionNode.prototype.hasActiveChildren = function() {
|
189
|
+
return _.some(this.children, function(child) {
|
190
|
+
return child.isActive();
|
191
|
+
});
|
192
|
+
};
|
193
|
+
|
194
|
+
return FilterCollectionNode;
|
195
|
+
|
196
|
+
})(models.FilterNode);
|
197
|
+
|
163
198
|
models.Listenable = (function() {
|
164
199
|
function Listenable() {
|
165
200
|
this._callbacks = {};
|
@@ -221,7 +256,7 @@
|
|
221
256
|
|
222
257
|
return CheckboxFilter;
|
223
258
|
|
224
|
-
})(models.
|
259
|
+
})(models.FilterCollectionNode);
|
225
260
|
|
226
261
|
models.CheckboxOption = (function(_super) {
|
227
262
|
__extends(CheckboxOption, _super);
|
@@ -264,11 +299,20 @@
|
|
264
299
|
return this.changed();
|
265
300
|
};
|
266
301
|
|
267
|
-
Filter.prototype.
|
302
|
+
Filter.prototype.deactivateAllFilters = function() {
|
268
303
|
this.deselectHierarchicalFilters();
|
304
|
+
this._deselectAdditionalFilters();
|
269
305
|
return this.changed();
|
270
306
|
};
|
271
307
|
|
308
|
+
Filter.prototype._deselectAdditionalFilters = function() {
|
309
|
+
if (this.hasAdditionalFilters()) {
|
310
|
+
return _.each(this.additionalFilters, function(filter) {
|
311
|
+
return filter.deselect();
|
312
|
+
});
|
313
|
+
}
|
314
|
+
};
|
315
|
+
|
272
316
|
Filter.prototype.hasActiveChildren = function() {
|
273
317
|
return _.some(_.union(this.getHierarchicalFilters(), this.additionalFilters), function(subFilter) {
|
274
318
|
return subFilter.hasActiveChildren();
|
@@ -331,17 +375,14 @@
|
|
331
375
|
}
|
332
376
|
|
333
377
|
Inspector.prototype.fileDetail = function() {
|
334
|
-
var fileDetail;
|
335
|
-
fileDetail = "(No description)";
|
336
378
|
if (this._inpsectedObj != null) {
|
337
|
-
|
379
|
+
return this._inpsectedObj.title();
|
338
380
|
}
|
339
|
-
return fileDetail;
|
340
381
|
};
|
341
382
|
|
342
383
|
Inspector.prototype.inspectorUrl = function() {
|
343
384
|
if (this._inpsectedObj != null) {
|
344
|
-
return scrivito.details_url_for_obj_id(this._inpsectedObj.id);
|
385
|
+
return scrivito.details_url_for_obj_id(this._inpsectedObj.id());
|
345
386
|
}
|
346
387
|
};
|
347
388
|
|
@@ -358,13 +399,42 @@
|
|
358
399
|
|
359
400
|
})(models.Listenable);
|
360
401
|
|
402
|
+
models.Obj = (function() {
|
403
|
+
function Obj(attributes) {
|
404
|
+
this._attr = attributes;
|
405
|
+
}
|
406
|
+
|
407
|
+
Obj.prototype.title = function() {
|
408
|
+
return this._attr['title'] || '(No description)';
|
409
|
+
};
|
410
|
+
|
411
|
+
Obj.prototype.id = function() {
|
412
|
+
return this._attr['id'];
|
413
|
+
};
|
414
|
+
|
415
|
+
Obj.prototype.hasPreview = function() {
|
416
|
+
return !!this._attr['preview'];
|
417
|
+
};
|
418
|
+
|
419
|
+
Obj.prototype.previewUrl = function() {
|
420
|
+
return this._attr['preview'];
|
421
|
+
};
|
422
|
+
|
423
|
+
Obj.prototype.hasDetailsView = function() {
|
424
|
+
return this._attr['has_details_view'];
|
425
|
+
};
|
426
|
+
|
427
|
+
return Obj;
|
428
|
+
|
429
|
+
})();
|
430
|
+
|
361
431
|
models.ObjCollection = (function(_super) {
|
362
432
|
__extends(ObjCollection, _super);
|
363
433
|
|
364
434
|
function ObjCollection(selectedObjs, _selectionMode) {
|
365
435
|
this._selectionMode = _selectionMode;
|
366
436
|
ObjCollection.__super__.constructor.call(this);
|
367
|
-
this._selectionMode || (this._selectionMode = '
|
437
|
+
this._selectionMode || (this._selectionMode = 'multi');
|
368
438
|
this._selectedObjs = selectedObjs || [];
|
369
439
|
this._objs = [];
|
370
440
|
this._curQueryNumber = 0;
|
@@ -458,8 +528,12 @@
|
|
458
528
|
};
|
459
529
|
|
460
530
|
ObjCollection.prototype._setAndLoadObjs = function(results, next, queryNumber) {
|
531
|
+
var curObjs;
|
461
532
|
if (queryNumber === this._curQueryNumber) {
|
462
|
-
|
533
|
+
curObjs = _.map(results.hits, function(attr) {
|
534
|
+
return new models.Obj(attr);
|
535
|
+
});
|
536
|
+
this._objs = this._objs.concat(curObjs);
|
463
537
|
this.changed();
|
464
538
|
if (next) {
|
465
539
|
return next.load_batch().then((function(_this) {
|
@@ -480,17 +554,22 @@
|
|
480
554
|
})(models.Listenable);
|
481
555
|
|
482
556
|
models.ObjUpload = (function() {
|
483
|
-
function ObjUpload(uploadSet, file) {
|
484
|
-
var objClass;
|
557
|
+
function ObjUpload(uploadSet, file, presetAttributes) {
|
558
|
+
var objAttributes, objClass;
|
485
559
|
this.uploadSet = uploadSet;
|
560
|
+
if (presetAttributes == null) {
|
561
|
+
presetAttributes = {};
|
562
|
+
}
|
486
563
|
this._status = 'active';
|
487
564
|
this._fileName = file.name;
|
488
565
|
objClass = scrivito.default_obj_class_for_content_type(file.type);
|
489
|
-
|
566
|
+
objAttributes = {
|
490
567
|
blob: file,
|
491
568
|
_obj_class: objClass,
|
492
569
|
_path: this._path()
|
493
|
-
}
|
570
|
+
};
|
571
|
+
objAttributes = _.extend(objAttributes, presetAttributes);
|
572
|
+
scrivito.create_obj(objAttributes).done((function(_this) {
|
494
573
|
return function(objData) {
|
495
574
|
_this._obj = objData;
|
496
575
|
return _this._setStatus('completed');
|
@@ -557,20 +636,24 @@
|
|
557
636
|
})();
|
558
637
|
|
559
638
|
models.QueryBuilder = (function() {
|
560
|
-
function QueryBuilder(filter) {
|
639
|
+
function QueryBuilder(filter, baseQuery) {
|
561
640
|
this.filter = filter;
|
641
|
+
if (baseQuery) {
|
642
|
+
this._baseQuery = models.QueryBuilder.prepareQuery(baseQuery);
|
643
|
+
}
|
562
644
|
}
|
563
645
|
|
564
646
|
QueryBuilder.prototype.searchRequest = function() {
|
565
647
|
var query;
|
566
|
-
query = this.
|
648
|
+
query = this._baseQuery;
|
649
|
+
query = this._addTreeFilterQuery(query);
|
567
650
|
query = this._addSearchTerm(query);
|
568
651
|
return this._addAdditionalFilters(query);
|
569
652
|
};
|
570
653
|
|
571
654
|
QueryBuilder.prototype._addAdditionalFilters = function(query) {
|
572
|
-
var activeChildren,
|
573
|
-
|
655
|
+
var activeChildren, combinedQuery, filter, searchQuery, _i, _len, _ref;
|
656
|
+
combinedQuery = query;
|
574
657
|
_ref = this.filter.additionalFilters;
|
575
658
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
576
659
|
filter = _ref[_i];
|
@@ -580,11 +663,11 @@
|
|
580
663
|
if (activeChildren.length > 0) {
|
581
664
|
searchQuery = this._buildActiveChildrenSearchQuery(activeChildren, filter);
|
582
665
|
if (searchQuery != null) {
|
583
|
-
|
666
|
+
combinedQuery = this._addOrCreateQuery(combinedQuery, searchQuery);
|
584
667
|
}
|
585
668
|
}
|
586
669
|
}
|
587
|
-
return
|
670
|
+
return combinedQuery;
|
588
671
|
};
|
589
672
|
|
590
673
|
QueryBuilder.prototype._buildActiveChildrenSearchQuery = function(activeChildren, filter) {
|
@@ -622,23 +705,32 @@
|
|
622
705
|
}
|
623
706
|
};
|
624
707
|
|
625
|
-
QueryBuilder.prototype.
|
626
|
-
var
|
708
|
+
QueryBuilder.prototype._createQueryByActiveConfig = function(activeConfig) {
|
709
|
+
var field, operator;
|
710
|
+
if (activeConfig.node.query) {
|
711
|
+
return activeConfig.node.query;
|
712
|
+
} else {
|
713
|
+
field = this._findField(activeConfig);
|
714
|
+
if (field) {
|
715
|
+
operator = this._findOperator(activeConfig);
|
716
|
+
return this._buildFOVQuery({
|
717
|
+
field: field,
|
718
|
+
operator: operator
|
719
|
+
}, [activeConfig.node]);
|
720
|
+
}
|
721
|
+
}
|
722
|
+
};
|
723
|
+
|
724
|
+
QueryBuilder.prototype._addTreeFilterQuery = function(baseQuery) {
|
725
|
+
var activeConfig, configuredQuery;
|
627
726
|
activeConfig = this._findActiveTreeFilterItem();
|
628
727
|
if (activeConfig) {
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
field = this._findField(activeConfig);
|
633
|
-
if (field) {
|
634
|
-
operator = this._findOperator(activeConfig);
|
635
|
-
query = this._buildFOVQuery({
|
636
|
-
field: field,
|
637
|
-
operator: operator
|
638
|
-
}, [activeConfig.node]);
|
639
|
-
return models.QueryBuilder.prepareQuery(query);
|
640
|
-
}
|
728
|
+
configuredQuery = this._createQueryByActiveConfig(activeConfig);
|
729
|
+
if (configuredQuery) {
|
730
|
+
return this._addOrCreateQuery(baseQuery, configuredQuery);
|
641
731
|
}
|
732
|
+
} else {
|
733
|
+
return baseQuery;
|
642
734
|
}
|
643
735
|
};
|
644
736
|
|
@@ -715,7 +807,7 @@
|
|
715
807
|
return query.clone().format('content_browser').order('_last_changed').reverse_order();
|
716
808
|
};
|
717
809
|
|
718
|
-
models.QueryBuilder.
|
810
|
+
models.QueryBuilder.byId = function(ids) {
|
719
811
|
return models.QueryBuilder.prepareQuery(scrivito.obj_where('id', 'equals', ids));
|
720
812
|
};
|
721
813
|
|
@@ -733,16 +825,6 @@
|
|
733
825
|
})(this));
|
734
826
|
}
|
735
827
|
|
736
|
-
RadioFilter.prototype.isExpanded = function() {
|
737
|
-
return !!this.expanded;
|
738
|
-
};
|
739
|
-
|
740
|
-
RadioFilter.prototype.hasActiveChildren = function() {
|
741
|
-
return _.some(this.children, function(child) {
|
742
|
-
return child.isActive();
|
743
|
-
});
|
744
|
-
};
|
745
|
-
|
746
828
|
RadioFilter.prototype.activate = function(radioOption) {
|
747
829
|
_.each(this.children, function(child) {
|
748
830
|
return child.active = child === radioOption;
|
@@ -751,24 +833,22 @@
|
|
751
833
|
};
|
752
834
|
|
753
835
|
RadioFilter.prototype.deactivateAll = function() {
|
754
|
-
|
755
|
-
return child.active = false;
|
756
|
-
});
|
836
|
+
this.deselect();
|
757
837
|
return this.filter.changed();
|
758
838
|
};
|
759
839
|
|
760
840
|
return RadioFilter;
|
761
841
|
|
762
|
-
})(models.
|
842
|
+
})(models.FilterCollectionNode);
|
763
843
|
|
764
844
|
models.RadioOption = (function(_super) {
|
765
845
|
__extends(RadioOption, _super);
|
766
846
|
|
767
|
-
function RadioOption(group, name,
|
847
|
+
function RadioOption(group, name, filterDefinition) {
|
768
848
|
this.group = group;
|
769
|
-
RadioOption.__super__.constructor.call(this, this.group.filter, name,
|
770
|
-
this.value =
|
771
|
-
this.active =
|
849
|
+
RadioOption.__super__.constructor.call(this, this.group.filter, name, filterDefinition);
|
850
|
+
this.value = filterDefinition.value, this.query = filterDefinition.query;
|
851
|
+
this.active = filterDefinition.selected;
|
772
852
|
}
|
773
853
|
|
774
854
|
RadioOption.prototype.setActive = function() {
|
@@ -840,8 +920,12 @@
|
|
840
920
|
models.UploadSet = (function(_super) {
|
841
921
|
__extends(UploadSet, _super);
|
842
922
|
|
843
|
-
function UploadSet() {
|
923
|
+
function UploadSet(preset) {
|
924
|
+
if (preset == null) {
|
925
|
+
preset = {};
|
926
|
+
}
|
844
927
|
UploadSet.__super__.constructor.call(this);
|
928
|
+
this._preset = preset;
|
845
929
|
this._uploads = [];
|
846
930
|
}
|
847
931
|
|
@@ -852,7 +936,7 @@
|
|
852
936
|
UploadSet.prototype.addFiles = function(files) {
|
853
937
|
_.each(files, (function(_this) {
|
854
938
|
return function(file) {
|
855
|
-
return _this._uploads.unshift(new models.ObjUpload(_this, file));
|
939
|
+
return _this._uploads.unshift(new models.ObjUpload(_this, file, _this._preset));
|
856
940
|
};
|
857
941
|
})(this));
|
858
942
|
return this.changed();
|
@@ -943,14 +1027,15 @@
|
|
943
1027
|
return this.state.inspector.onChange(this.updateInspector);
|
944
1028
|
},
|
945
1029
|
getInitialState: function() {
|
946
|
-
var initialSelection, selectionMode;
|
1030
|
+
var basePreset, initialSelection, selectionMode;
|
947
1031
|
initialSelection = this.props.container.options.selection || [];
|
948
|
-
selectionMode = this.props.container.options.
|
1032
|
+
selectionMode = this.props.container.options.selection_mode;
|
1033
|
+
basePreset = this.props.container.options.base_preset;
|
949
1034
|
return {
|
950
1035
|
filter: this.props.initialFilter,
|
951
1036
|
objs: [],
|
952
1037
|
viewMode: new models.ViewMode(),
|
953
|
-
uploadSet: new models.UploadSet(),
|
1038
|
+
uploadSet: new models.UploadSet(basePreset),
|
954
1039
|
objCollection: new models.ObjCollection(initialSelection, selectionMode),
|
955
1040
|
inspector: new models.Inspector()
|
956
1041
|
};
|
@@ -967,6 +1052,7 @@
|
|
967
1052
|
"viewMode": this.state.viewMode
|
968
1053
|
}), React.createElement(ui.Filter, {
|
969
1054
|
"filter": this.state.filter,
|
1055
|
+
"baseQuery": this.props.baseQuery,
|
970
1056
|
"objCollection": this.state.objCollection
|
971
1057
|
}), React.createElement(ui.Items, {
|
972
1058
|
"ref": "itemView",
|
@@ -987,7 +1073,7 @@
|
|
987
1073
|
displayName: 'Filter',
|
988
1074
|
mixins: [FilterMixin],
|
989
1075
|
handleDeselectAllFilters: function() {
|
990
|
-
return this.props.filter.
|
1076
|
+
return this.props.filter.deactivateAllFilters();
|
991
1077
|
},
|
992
1078
|
renderAdditionalFilters: function() {
|
993
1079
|
var subFilters;
|
@@ -1003,7 +1089,7 @@
|
|
1003
1089
|
this.setState({
|
1004
1090
|
selectedFilter: false
|
1005
1091
|
});
|
1006
|
-
queryBuilder = new models.QueryBuilder(filter);
|
1092
|
+
queryBuilder = new models.QueryBuilder(filter, this.props.baseQuery);
|
1007
1093
|
query = queryBuilder.searchRequest();
|
1008
1094
|
return this.props.objCollection.loadFromBackend(query);
|
1009
1095
|
},
|
@@ -1024,7 +1110,7 @@
|
|
1024
1110
|
this.setState({
|
1025
1111
|
selectedFilter: true
|
1026
1112
|
});
|
1027
|
-
query = models.QueryBuilder.
|
1113
|
+
query = models.QueryBuilder.byId(this.props.objCollection.selectedObjs());
|
1028
1114
|
return this.props.objCollection.loadFromBackend(query);
|
1029
1115
|
},
|
1030
1116
|
getInitialState: function() {
|
@@ -1123,19 +1209,6 @@
|
|
1123
1209
|
}
|
1124
1210
|
});
|
1125
1211
|
|
1126
|
-
ui.Filter.DeselectFilter = React.createClass({
|
1127
|
-
displayName: 'DeselectFilter',
|
1128
|
-
handleDeselect: function() {
|
1129
|
-
return this.props.onDeselectAllFilters();
|
1130
|
-
},
|
1131
|
-
render: function() {
|
1132
|
-
return React.createElement("div", {
|
1133
|
-
"className": "scrivito_button",
|
1134
|
-
"onClick": this.handleDeselect
|
1135
|
-
}, "deselect all");
|
1136
|
-
}
|
1137
|
-
});
|
1138
|
-
|
1139
1212
|
ui.Filter.DeselectAllRadioOptionFilter = React.createClass({
|
1140
1213
|
displayName: 'DeselectAllRadioOptionFilter',
|
1141
1214
|
mixins: [OptionFilterLabelRenderMixin],
|
@@ -1159,6 +1232,19 @@
|
|
1159
1232
|
}
|
1160
1233
|
});
|
1161
1234
|
|
1235
|
+
ui.Filter.DeselectFilter = React.createClass({
|
1236
|
+
displayName: 'DeselectFilter',
|
1237
|
+
handleDeselect: function() {
|
1238
|
+
return this.props.onDeselectAllFilters();
|
1239
|
+
},
|
1240
|
+
render: function() {
|
1241
|
+
return React.createElement("div", {
|
1242
|
+
"className": "scrivito_button",
|
1243
|
+
"onClick": this.handleDeselect
|
1244
|
+
}, "deselect all");
|
1245
|
+
}
|
1246
|
+
});
|
1247
|
+
|
1162
1248
|
ui.Filter.RadioOptionFilter = React.createClass({
|
1163
1249
|
displayName: 'RadioOptionFilter',
|
1164
1250
|
mixins: [OptionFilterMixin],
|
@@ -1296,6 +1382,15 @@
|
|
1296
1382
|
getDetailsClassName: function() {
|
1297
1383
|
return "scrivito-content-browser-icon scrivito-content-browser-icon-eye";
|
1298
1384
|
},
|
1385
|
+
getEmptyPlaceholder: function() {
|
1386
|
+
return React.createElement("div", {
|
1387
|
+
"className": "details-view"
|
1388
|
+
}, React.createElement("p", {
|
1389
|
+
"className": "no-editing-available"
|
1390
|
+
}, React.createElement("span", {
|
1391
|
+
"className": "scrivito-content-browser-icon scrivito-content-browser-icon-generic"
|
1392
|
+
}), "No edit view available."));
|
1393
|
+
},
|
1299
1394
|
render: function() {
|
1300
1395
|
return React.createElement("div", {
|
1301
1396
|
"className": "scrivito-content-browser-inspector"
|
@@ -1306,9 +1401,9 @@
|
|
1306
1401
|
"className": "title"
|
1307
1402
|
}, this.props.inspector.fileDetail())), React.createElement("div", {
|
1308
1403
|
"className": "inspector-content"
|
1309
|
-
}, React.createElement("iframe", {
|
1404
|
+
}, (this.props.inspector.getInspectedObj().hasDetailsView() ? React.createElement("iframe", {
|
1310
1405
|
"src": this.props.inspector.inspectorUrl()
|
1311
|
-
}))) : void 0));
|
1406
|
+
}) : this.getEmptyPlaceholder()))) : void 0));
|
1312
1407
|
}
|
1313
1408
|
});
|
1314
1409
|
|
@@ -1441,20 +1536,20 @@
|
|
1441
1536
|
ui.ThumbnailItem = React.createClass({
|
1442
1537
|
displayName: 'ThumbnailItem',
|
1443
1538
|
title: function() {
|
1444
|
-
return this.props.obj.title
|
1539
|
+
return this.props.obj.title();
|
1445
1540
|
},
|
1446
1541
|
selectClass: function() {
|
1447
1542
|
var className;
|
1448
1543
|
className = 'scrivito-content-browser-thumbnails-select select-item';
|
1449
|
-
if (this.props.objCollection.isSelected(this.props.obj.id)) {
|
1544
|
+
if (this.props.objCollection.isSelected(this.props.obj.id())) {
|
1450
1545
|
className += ' active';
|
1451
1546
|
}
|
1452
1547
|
return className;
|
1453
1548
|
},
|
1454
1549
|
previewImage: function() {
|
1455
|
-
if (this.props.obj.
|
1550
|
+
if (this.props.obj.hasPreview()) {
|
1456
1551
|
return React.createElement("img", {
|
1457
|
-
"src": this.props.obj.
|
1552
|
+
"src": this.props.obj.previewUrl()
|
1458
1553
|
});
|
1459
1554
|
} else {
|
1460
1555
|
return React.createElement("span", {
|
@@ -1463,7 +1558,7 @@
|
|
1463
1558
|
}
|
1464
1559
|
},
|
1465
1560
|
handleSelectClick: function() {
|
1466
|
-
return this.props.objCollection.toggleSelected(this.props.obj.id);
|
1561
|
+
return this.props.objCollection.toggleSelected(this.props.obj.id());
|
1467
1562
|
},
|
1468
1563
|
changeInspectObj: function() {
|
1469
1564
|
return this.props.inspector.setInspectedObj(this.props.obj);
|
@@ -1505,7 +1600,7 @@
|
|
1505
1600
|
items = _.map(this.props.objCollection.objs(), (function(_this) {
|
1506
1601
|
return function(obj) {
|
1507
1602
|
return React.createElement(ui.ThumbnailItem, {
|
1508
|
-
"key": obj.id,
|
1603
|
+
"key": obj.id(),
|
1509
1604
|
"obj": obj,
|
1510
1605
|
"objCollection": _this.props.objCollection,
|
1511
1606
|
"inspector": _this.props.inspector
|
@@ -1553,7 +1553,9 @@ a.scrivito_button, a.scrivito_button:hover, a.scrivito_button:focus, a.scrivito_
|
|
1553
1553
|
.scrivito-content-browser .scrivito-content-browser-inspector .inspector-content {
|
1554
1554
|
position: absolute;
|
1555
1555
|
top: 46px;
|
1556
|
-
bottom: 2px;
|
1556
|
+
bottom: 2px;
|
1557
|
+
left: 10px;
|
1558
|
+
right: 10px; }
|
1557
1559
|
|
1558
1560
|
.scrivito-content-browser .scrivito-content-browser-inspector .inspector-content iframe {
|
1559
1561
|
height: 100%;
|
@@ -1,8 +1,11 @@
|
|
1
1
|
# Register a JavaScript search API result format used by the content browser.
|
2
|
-
Scrivito::Configuration.register_obj_format('content_browser') do |obj|
|
2
|
+
Scrivito::Configuration.register_obj_format('content_browser') do |obj, _, view_context|
|
3
|
+
has_details_view = view_context.lookup_context.exists?(obj.details_view_path)
|
4
|
+
|
3
5
|
format = {
|
4
6
|
id: obj.id,
|
5
7
|
title: obj.description_for_editor.presence || obj.binary.try(:filename),
|
8
|
+
has_details_view: has_details_view
|
6
9
|
}
|
7
10
|
|
8
11
|
if obj.binary_content_type && obj.binary_content_type.start_with?('image/')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_content_browser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.40.0.
|
4
|
+
version: 0.40.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.40.0.
|
47
|
+
version: 0.40.0.rc2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.40.0.
|
54
|
+
version: 0.40.0.rc2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|