spotlight-frontend 3.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +114 -0
- package/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
- package/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
- package/app/assets/images/blacklight/arrow_back_ios.svg +1 -0
- package/app/assets/images/blacklight/arrow_forward_ios.svg +1 -0
- package/app/assets/images/blacklight/check.svg +1 -0
- package/app/assets/images/blacklight/check_circle.svg +1 -0
- package/app/assets/images/blacklight/chevron_right.svg +1 -0
- package/app/assets/images/blacklight/close.svg +1 -0
- package/app/assets/images/blacklight/edit.svg +1 -0
- package/app/assets/images/blacklight/error.svg +1 -0
- package/app/assets/images/blacklight/highlight_off.svg +1 -0
- package/app/assets/images/blacklight/info.svg +1 -0
- package/app/assets/images/blacklight/warning.svg +1 -0
- package/app/assets/images/blacklight/zoom_in.svg +1 -0
- package/app/assets/images/blacklight/zoom_out.svg +1 -0
- package/app/assets/images/spotlight/.keep +0 -0
- package/app/assets/images/spotlight/blocks/sir-trevor-icons.svg +320 -0
- package/app/assets/images/spotlight/default_browse_thumbnail.jpg +0 -0
- package/app/assets/images/spotlight/default_thumbnail.jpg +0 -0
- package/app/assets/images/spotlight/fallback/default.png +0 -0
- package/app/assets/javascripts/spotlight/admin/add_another.js +22 -0
- package/app/assets/javascripts/spotlight/admin/add_new_button.js +81 -0
- package/app/assets/javascripts/spotlight/admin/appearance.js +24 -0
- package/app/assets/javascripts/spotlight/admin/attachments.js +2 -0
- package/app/assets/javascripts/spotlight/admin/blacklight_configuration.js +63 -0
- package/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +72 -0
- package/app/assets/javascripts/spotlight/admin/block_mixins/formable.js +78 -0
- package/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +57 -0
- package/app/assets/javascripts/spotlight/admin/blocks/block.js +23 -0
- package/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +87 -0
- package/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
- package/app/assets/javascripts/spotlight/admin/blocks/iframe_block.js +34 -0
- package/app/assets/javascripts/spotlight/admin/blocks/link_to_search_block.js +16 -0
- package/app/assets/javascripts/spotlight/admin/blocks/oembed_block.js +40 -0
- package/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +22 -0
- package/app/assets/javascripts/spotlight/admin/blocks/resources_block.js +145 -0
- package/app/assets/javascripts/spotlight/admin/blocks/rule_block.js +25 -0
- package/app/assets/javascripts/spotlight/admin/blocks/search_result_block.js +44 -0
- package/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +108 -0
- package/app/assets/javascripts/spotlight/admin/blocks/solr_documents_block.js +25 -0
- package/app/assets/javascripts/spotlight/admin/blocks/solr_documents_carousel_block.js +103 -0
- package/app/assets/javascripts/spotlight/admin/blocks/solr_documents_embed_block.js +17 -0
- package/app/assets/javascripts/spotlight/admin/blocks/solr_documents_features_block.js +41 -0
- package/app/assets/javascripts/spotlight/admin/blocks/solr_documents_grid_block.js +14 -0
- package/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +145 -0
- package/app/assets/javascripts/spotlight/admin/catalog_edit.js +16 -0
- package/app/assets/javascripts/spotlight/admin/copy_email_addresses.js +9 -0
- package/app/assets/javascripts/spotlight/admin/crop.es6 +310 -0
- package/app/assets/javascripts/spotlight/admin/croppable.js +25 -0
- package/app/assets/javascripts/spotlight/admin/edit_in_place.js +54 -0
- package/app/assets/javascripts/spotlight/admin/exhibit_tag_autocomplete.js +37 -0
- package/app/assets/javascripts/spotlight/admin/exhibits.js +58 -0
- package/app/assets/javascripts/spotlight/admin/form_observer.js +86 -0
- package/app/assets/javascripts/spotlight/admin/iiif.es6 +54 -0
- package/app/assets/javascripts/spotlight/admin/index.js +16 -0
- package/app/assets/javascripts/spotlight/admin/locks.js +12 -0
- package/app/assets/javascripts/spotlight/admin/multi_image_selector.js +158 -0
- package/app/assets/javascripts/spotlight/admin/pages.js.erb +40 -0
- package/app/assets/javascripts/spotlight/admin/progress_monitor.js +148 -0
- package/app/assets/javascripts/spotlight/admin/readonly_checkbox.js +6 -0
- package/app/assets/javascripts/spotlight/admin/search_typeahead.js +108 -0
- package/app/assets/javascripts/spotlight/admin/select_related_input.js +34 -0
- package/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +120 -0
- package/app/assets/javascripts/spotlight/admin/sir-trevor/block_limits.js +37 -0
- package/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +120 -0
- package/app/assets/javascripts/spotlight/admin/spotlight_nestable.js +72 -0
- package/app/assets/javascripts/spotlight/admin/tabs.js +6 -0
- package/app/assets/javascripts/spotlight/admin/translation_progress.js +23 -0
- package/app/assets/javascripts/spotlight/admin/users.js +79 -0
- package/app/assets/javascripts/spotlight/application.js +14 -0
- package/app/assets/javascripts/spotlight/spotlight.js +23 -0
- package/app/assets/javascripts/spotlight/user/analytics.js +9 -0
- package/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
- package/app/assets/javascripts/spotlight/user/carousel.js +3 -0
- package/app/assets/javascripts/spotlight/user/clear_form_button.js +27 -0
- package/app/assets/javascripts/spotlight/user/index.js +8 -0
- package/app/assets/javascripts/spotlight/user/report_a_problem.js +39 -0
- package/app/assets/javascripts/spotlight/user/zpr_links.js.erb +45 -0
- package/app/assets/stylesheets/spotlight/_accessibility.scss +8 -0
- package/app/assets/stylesheets/spotlight/_attachments.css +4 -0
- package/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +82 -0
- package/app/assets/stylesheets/spotlight/_blacklight_overrides.scss +21 -0
- package/app/assets/stylesheets/spotlight/_bootstrap_overrides.scss +105 -0
- package/app/assets/stylesheets/spotlight/_breadcrumbs.scss +6 -0
- package/app/assets/stylesheets/spotlight/_browse.scss +158 -0
- package/app/assets/stylesheets/spotlight/_catalog.scss +161 -0
- package/app/assets/stylesheets/spotlight/_collapse_toggle.scss +14 -0
- package/app/assets/stylesheets/spotlight/_croppable.scss +4 -0
- package/app/assets/stylesheets/spotlight/_curation.scss +224 -0
- package/app/assets/stylesheets/spotlight/_edit_in_place.scss +9 -0
- package/app/assets/stylesheets/spotlight/_exhibit_admin.scss +81 -0
- package/app/assets/stylesheets/spotlight/_exhibit_navbar.scss +10 -0
- package/app/assets/stylesheets/spotlight/_exhibits_index.scss +147 -0
- package/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +269 -0
- package/app/assets/stylesheets/spotlight/_footer.scss +12 -0
- package/app/assets/stylesheets/spotlight/_header.scss +155 -0
- package/app/assets/stylesheets/spotlight/_item_text_block.scss +50 -0
- package/app/assets/stylesheets/spotlight/_mixins.scss +17 -0
- package/app/assets/stylesheets/spotlight/_modals.scss +3 -0
- package/app/assets/stylesheets/spotlight/_multi_image_selector.scss +22 -0
- package/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +63 -0
- package/app/assets/stylesheets/spotlight/_nestable.scss +124 -0
- package/app/assets/stylesheets/spotlight/_pages.scss +282 -0
- package/app/assets/stylesheets/spotlight/_report_a_problem.scss +14 -0
- package/app/assets/stylesheets/spotlight/_sir-trevor_overrides.scss +87 -0
- package/app/assets/stylesheets/spotlight/_slideshow_block.scss +87 -0
- package/app/assets/stylesheets/spotlight/_spotlight.scss +49 -0
- package/app/assets/stylesheets/spotlight/_translations.scss +86 -0
- package/app/assets/stylesheets/spotlight/_upload.scss +0 -0
- package/app/assets/stylesheets/spotlight/_uploaded_items_block.scss +7 -0
- package/app/assets/stylesheets/spotlight/_utilities.scss +7 -0
- package/app/assets/stylesheets/spotlight/_variables.scss +42 -0
- package/app/assets/stylesheets/spotlight/_variables_bootstrap.scss +7 -0
- package/app/assets/stylesheets/spotlight/_view_larger.scss +22 -0
- package/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +92 -0
- package/app/assets/stylesheets/spotlight/typeahead.css +77 -0
- package/package.json +29 -0
- package/vendor/assets/images/sir-trevor-icons.svg +263 -0
- package/vendor/assets/javascripts/Leaflet.Editable.js +1917 -0
- package/vendor/assets/javascripts/MutationObserver.js +625 -0
- package/vendor/assets/javascripts/Path.Drag.js +137 -0
- package/vendor/assets/javascripts/bootstrap-tagsinput.js +530 -0
- package/vendor/assets/javascripts/eventable.js +205 -0
- package/vendor/assets/javascripts/jquery.serializejson.js +234 -0
- package/vendor/assets/javascripts/jquery.waitforimages.min.js +2 -0
- package/vendor/assets/javascripts/leaflet-iiif.js +323 -0
- package/vendor/assets/javascripts/nestable.js +645 -0
- package/vendor/assets/javascripts/parameterize.js +137 -0
- package/vendor/assets/javascripts/polyfill.min.js +4 -0
- package/vendor/assets/javascripts/sir-trevor.js +21639 -0
- package/vendor/assets/javascripts/tiny-slider.js +3218 -0
- package/vendor/assets/javascripts/typeahead.bundle.min.js +7 -0
- package/vendor/assets/stylesheets/bootstrap-tagsinput.css +46 -0
- package/vendor/assets/stylesheets/leaflet-areaselect.css +15 -0
- package/vendor/assets/stylesheets/sir-trevor/_icons.scss +6 -0
- package/vendor/assets/stylesheets/sir-trevor/_variables.scss +22 -0
- package/vendor/assets/stylesheets/sir-trevor/base.scss +17 -0
- package/vendor/assets/stylesheets/sir-trevor/block-addition-top.scss +95 -0
- package/vendor/assets/stylesheets/sir-trevor/block-addition.scss +72 -0
- package/vendor/assets/stylesheets/sir-trevor/block-controls.scss +34 -0
- package/vendor/assets/stylesheets/sir-trevor/block-positioner.scss +34 -0
- package/vendor/assets/stylesheets/sir-trevor/block-replacer.scss +43 -0
- package/vendor/assets/stylesheets/sir-trevor/block-ui.scss +120 -0
- package/vendor/assets/stylesheets/sir-trevor/block.scss +300 -0
- package/vendor/assets/stylesheets/sir-trevor/errors.scss +21 -0
- package/vendor/assets/stylesheets/sir-trevor/format-bar.scss +65 -0
- package/vendor/assets/stylesheets/sir-trevor/inputs.scss +45 -0
- package/vendor/assets/stylesheets/sir-trevor/main.scss +24 -0
- package/vendor/assets/stylesheets/sir-trevor/patterns/ui-popup.scss +38 -0
- package/vendor/assets/stylesheets/sir-trevor/utils.scss +10 -0
- package/vendor/assets/stylesheets/tiny-slider.css +1 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
(function($){
|
|
2
|
+
$.fn.addNewPageButton = function( options ) {
|
|
3
|
+
$.each(this, function(){
|
|
4
|
+
addExpandBehaviorToButton($(this));
|
|
5
|
+
});
|
|
6
|
+
function addExpandBehaviorToButton(button){
|
|
7
|
+
var settings = $.extend({
|
|
8
|
+
speed: (button.data('speed') || 450),
|
|
9
|
+
animate_width: (button.data('animate_width') || 425)
|
|
10
|
+
}, options);
|
|
11
|
+
var target = $(button.data('field-target'));
|
|
12
|
+
var save = $("input[data-behavior='save']", target);
|
|
13
|
+
var cancel = $("input[data-behavior='cancel']", target);
|
|
14
|
+
var input = $("input[type='text']", target);
|
|
15
|
+
var original_width = button.outerWidth();
|
|
16
|
+
var expanded = false;
|
|
17
|
+
|
|
18
|
+
// Animate button open when the mouse enters or
|
|
19
|
+
// the button is given focus (i.e. clicked/tabbed)
|
|
20
|
+
button.on("mouseenter focus", function(){
|
|
21
|
+
expandButton();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Don't allow blank titles
|
|
25
|
+
save.on('click', function(){
|
|
26
|
+
if ( inputEmpty() ) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Empty input and collapse
|
|
32
|
+
// button on cancel click
|
|
33
|
+
cancel.on('click', function(e){
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
input.val('');
|
|
36
|
+
collapseButton();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Collapse the button on when
|
|
40
|
+
// an empty input loses focus
|
|
41
|
+
input.on("blur", function(){
|
|
42
|
+
if ( inputEmpty() ) {
|
|
43
|
+
collapseButton();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
function expandButton(){
|
|
47
|
+
// If this has not yet been expanded, recalculate original_width to
|
|
48
|
+
// handle things that may have been originally hidden.
|
|
49
|
+
if (!expanded) {
|
|
50
|
+
original_width = button.outerWidth();
|
|
51
|
+
}
|
|
52
|
+
if(button.outerWidth() <= (original_width + 5)) {
|
|
53
|
+
expanded = true;
|
|
54
|
+
button.animate(
|
|
55
|
+
{width: settings.animate_width + 'px'}, settings.speed, function(){
|
|
56
|
+
target.show(0, function(){
|
|
57
|
+
input.focus();
|
|
58
|
+
// Set the button to auto width to make
|
|
59
|
+
// sure it has room for any inputs
|
|
60
|
+
button.width("auto");
|
|
61
|
+
// Explicitly set the width of the button
|
|
62
|
+
// so the close animation works properly
|
|
63
|
+
button.width(button.width());
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function collapseButton(){
|
|
70
|
+
target.hide();
|
|
71
|
+
button.animate({width: original_width + 'px'}, settings.speed);
|
|
72
|
+
}
|
|
73
|
+
function inputEmpty(){
|
|
74
|
+
return $.trim(input.val()) == "";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})( jQuery );
|
|
79
|
+
Spotlight.onLoad(function() {
|
|
80
|
+
$("[data-expanded-add-button]").addNewPageButton();
|
|
81
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Spotlight.onLoad(function(){
|
|
2
|
+
addRestoreDefaultBehavior();
|
|
3
|
+
});
|
|
4
|
+
|
|
5
|
+
function addRestoreDefaultBehavior(){
|
|
6
|
+
$("[data-behavior='restore-default']").each(function(){
|
|
7
|
+
var hidden = $("[data-default-value]", $(this));
|
|
8
|
+
var value = $($("[data-in-place-edit-target]", $(this)).data('in-place-edit-target'), $(this));
|
|
9
|
+
var button = $("[data-restore-default]", $(this));
|
|
10
|
+
hidden.on('blur', function(){
|
|
11
|
+
if( $(this).val() == $(this).data('default-value') ) {
|
|
12
|
+
button.addClass('d-none');
|
|
13
|
+
} else {
|
|
14
|
+
button.removeClass('d-none');
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
button.on('click', function(e){
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
hidden.val(hidden.data('default-value'));
|
|
20
|
+
value.text(hidden.data('default-value'));
|
|
21
|
+
button.hide();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Spotlight.onLoad(function() {
|
|
2
|
+
// Add Select/Deselect all button behavior
|
|
3
|
+
addCheckboxToggleBehavior();
|
|
4
|
+
addEnableToggleBehavior();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
// Add Select/Deselect all button behavior
|
|
8
|
+
function addCheckboxToggleBehavior() {
|
|
9
|
+
$("[data-behavior='metadata-select']").each(function(){
|
|
10
|
+
var button = $(this)
|
|
11
|
+
var parentCell = button.parents("th");
|
|
12
|
+
var table = parentCell.closest("table");
|
|
13
|
+
var columnRows = $("tr td:nth-child(" + (parentCell.index() + 1) + ")", table);
|
|
14
|
+
var checkboxes = $("input[type='checkbox']", columnRows);
|
|
15
|
+
swapSelectAllButtonText(button, columnRows);
|
|
16
|
+
// Add the check/uncheck behavior to the button
|
|
17
|
+
// and swap the button text if necessary
|
|
18
|
+
button.on('click', function(e){
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
var allChecked = allCheckboxesChecked(columnRows);
|
|
21
|
+
columnRows.each(function(){
|
|
22
|
+
$("input[type='checkbox']", $(this)).prop('checked', !allChecked);
|
|
23
|
+
swapSelectAllButtonText(button, columnRows);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
// Swap button text when a checkbox value changes
|
|
27
|
+
checkboxes.each(function(){
|
|
28
|
+
$(this).on('change', function(){
|
|
29
|
+
swapSelectAllButtonText(button, columnRows);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
// Check number of checkboxes against the number of checked
|
|
34
|
+
// checkboxes to determine if all of them are checked or not
|
|
35
|
+
function allCheckboxesChecked(elements) {
|
|
36
|
+
return ($("input[type='checkbox']", elements).length == $("input[type='checkbox']:checked", elements).length)
|
|
37
|
+
}
|
|
38
|
+
// Swap the button text to "Deselect all"
|
|
39
|
+
// when all the checkboxes are checked and
|
|
40
|
+
// "Select all" when any are unchecked
|
|
41
|
+
function swapSelectAllButtonText(button, elements) {
|
|
42
|
+
if ( allCheckboxesChecked(elements) ) {
|
|
43
|
+
button.text(button.data('deselect-text'));
|
|
44
|
+
} else {
|
|
45
|
+
button.text(button.data('select-text'));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function addEnableToggleBehavior() {
|
|
51
|
+
$("[data-behavior='enable-feature']").each(function(){
|
|
52
|
+
var checkbox = $(this);
|
|
53
|
+
var target = $($(this).data('target'));
|
|
54
|
+
|
|
55
|
+
checkbox.on('change', function() {
|
|
56
|
+
if ($(this).is(':checked')) {
|
|
57
|
+
target.find('input:checkbox').not("[data-behavior='enable-feature']").prop('checked', true).attr('disabled', false);
|
|
58
|
+
} else {
|
|
59
|
+
target.find('input:checkbox').not("[data-behavior='enable-feature']").prop('checked', false).attr('disabled', true);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
(function ($){
|
|
2
|
+
SirTrevor.BlockMixins.Autocompleteable = {
|
|
3
|
+
mixinName: "Autocompleteable",
|
|
4
|
+
preload: true,
|
|
5
|
+
|
|
6
|
+
initializeAutocompleteable: function() {
|
|
7
|
+
this.on("onRender", this.addAutocompletetoSirTrevorForm);
|
|
8
|
+
|
|
9
|
+
if (_.isUndefined(this['autocomplete_url'])) {
|
|
10
|
+
this.autocomplete_url = function() { return $('form[data-autocomplete-url]').data('autocomplete-url').replace("%25QUERY", "%QUERY"); };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (_.isUndefined(this['autocomplete_template'])) {
|
|
14
|
+
this.autocomplete_url = function() { return '<div class="autocomplete-item{{#if private}} blacklight-private{{/if}}">{{#if thumbnail}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small> {{description}}</small></div>' };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (_.isUndefined(this['transform_autocomplete_results'])) {
|
|
18
|
+
this.transform_autocomplete_results = _.identity;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (_.isUndefined(this['autocomplete_control'])) {
|
|
22
|
+
this.autocomplete_control = function() { return '<input type="text" class="st-input-string form-control item-input-field" data-twitter-typeahead="true" placeholder="<%= i18n.t("blocks:autocompleteable:placeholder")%>"/>' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (_.isUndefined(this['bloodhoundOptions'])) {
|
|
26
|
+
this.bloodhoundOptions = function() {
|
|
27
|
+
return {
|
|
28
|
+
remote: {
|
|
29
|
+
url: this.autocomplete_url(),
|
|
30
|
+
filter: this.transform_autocomplete_results
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
addAutocompletetoSirTrevorForm: function() {
|
|
38
|
+
$('[data-twitter-typeahead]', this.inner).spotlightSearchTypeAhead({bloodhound: this.bloodhound(), template: this.autocomplete_template()}).on('typeahead:selected typeahead:autocompleted', this.autocompletedHandler()).on( 'focus', function() {
|
|
39
|
+
if($(this).val() === '') {
|
|
40
|
+
$(this).data().ttTypeahead.input.trigger('queryChanged', '');
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
autocompletedHandler: function(e, data) {
|
|
46
|
+
var context = this;
|
|
47
|
+
|
|
48
|
+
return function(e, data) {
|
|
49
|
+
$(this).typeahead("val", "");
|
|
50
|
+
$(this).val("");
|
|
51
|
+
|
|
52
|
+
context.createItemPanel($.extend(data, {display: "true"}));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
bloodhound: function() {
|
|
57
|
+
var block = this;
|
|
58
|
+
var results = new Bloodhound(_.extend({
|
|
59
|
+
datumTokenizer: function(d) {
|
|
60
|
+
return Bloodhound.tokenizers.whitespace(d.title);
|
|
61
|
+
},
|
|
62
|
+
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
|
63
|
+
limit: 100,
|
|
64
|
+
}, block.bloodhoundOptions()));
|
|
65
|
+
results.initialize();
|
|
66
|
+
return results;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
SirTrevor.Block.prototype.availableMixins.push("autocompleteable");
|
|
72
|
+
})(jQuery);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
(function ($){
|
|
2
|
+
SirTrevor.BlockMixins.Formable = {
|
|
3
|
+
mixinName: "Formable",
|
|
4
|
+
preload: true,
|
|
5
|
+
|
|
6
|
+
initializeFormable: function() {
|
|
7
|
+
|
|
8
|
+
if (_.isUndefined(this['afterLoadData'])) {
|
|
9
|
+
this['afterLoadData'] = function(data) { };
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
formId: function(id) {
|
|
14
|
+
return this.blockID + "_" + id;
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
_serializeData: function() {
|
|
18
|
+
|
|
19
|
+
var data = $(":input,textarea,select", this.inner).not(':input:radio').serializeJSON();
|
|
20
|
+
|
|
21
|
+
$(':input:radio:checked', this.inner).each(function(index, input) {
|
|
22
|
+
var key = $(input).data('key') || input.getAttribute('name');
|
|
23
|
+
|
|
24
|
+
if (!key.match("\\[")) {
|
|
25
|
+
data[key] = $(input).val();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/* Simple to start. Add conditions later */
|
|
30
|
+
if (this.hasTextBlock()) {
|
|
31
|
+
data.text = this.getTextBlockHTML();
|
|
32
|
+
data.format = 'html';
|
|
33
|
+
if (data.text && data.text.length > 0 && this.options.convertToMarkdown) {
|
|
34
|
+
data.text = stToMarkdown(data.text, this.type);
|
|
35
|
+
data.format = 'markdown';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return data;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
loadData: function(data){
|
|
43
|
+
if (this.hasTextBlock()) {
|
|
44
|
+
if (data.text && data.text.length > 0 && this.options.convertFromMarkdown && data.format !== "html") {
|
|
45
|
+
this.setTextBlockHTML(SirTrevor.toHTML(data.text, this.type));
|
|
46
|
+
} else {
|
|
47
|
+
this.setTextBlockHTML(data.text);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
this.loadFormDataByKey(data);
|
|
51
|
+
this.afterLoadData(data);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
loadFormDataByKey: function(data) {
|
|
55
|
+
$(':input', this.inner).not('button,:input[type=hidden]').each(function(index, input) {
|
|
56
|
+
var key = $(input).data('key') || input.getAttribute('name');
|
|
57
|
+
|
|
58
|
+
if (key) {
|
|
59
|
+
|
|
60
|
+
if (key.match("\\[\\]$")) {
|
|
61
|
+
key = key.replace("[]", "");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// by wrapping it in an array, this'll "just work" for radio and checkbox fields too
|
|
65
|
+
var input_data = data[key];
|
|
66
|
+
|
|
67
|
+
if (!(input_data instanceof Array)) {
|
|
68
|
+
input_data = [input_data];
|
|
69
|
+
}
|
|
70
|
+
$(this).val(input_data);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
SirTrevor.Block.prototype.availableMixins.push("formable");
|
|
78
|
+
})(jQuery);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
(function ($){
|
|
2
|
+
SirTrevor.BlockMixins.Plustextable = {
|
|
3
|
+
mixinName: "Textable",
|
|
4
|
+
preload: true,
|
|
5
|
+
|
|
6
|
+
initializeTextable: function() {
|
|
7
|
+
if (_.isUndefined(this['formId'])) {
|
|
8
|
+
this.withMixin(SirTrevor.BlockMixins.Formable);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (_.isUndefined(this['show_heading'])) {
|
|
12
|
+
this.show_heading = true;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
align_key:"text-align",
|
|
17
|
+
text_key:"item-text",
|
|
18
|
+
heading_key: "title",
|
|
19
|
+
|
|
20
|
+
text_area: function() {
|
|
21
|
+
return _.template([
|
|
22
|
+
'<div class="row">',
|
|
23
|
+
'<div class="col-md-8">',
|
|
24
|
+
'<div class="form-group">',
|
|
25
|
+
this.heading(),
|
|
26
|
+
'<div class="field">',
|
|
27
|
+
'<label for="<%= formId(text_key) %>" class="col-form-label"><%= i18n.t("blocks:textable:text") %></label>',
|
|
28
|
+
'<div id="<%= formId(text_key) %>" class="st-text-block form-control" contenteditable="true"></div>',
|
|
29
|
+
'</div>',
|
|
30
|
+
'</div>',
|
|
31
|
+
'</div>',
|
|
32
|
+
'<div class="col-md-4">',
|
|
33
|
+
'<div class="text-align">',
|
|
34
|
+
'<p><%= i18n.t("blocks:textable:align:title") %></p>',
|
|
35
|
+
'<input data-key="<%= align_key %>" type="radio" name="<%= formId(align_key) %>" id="<%= formId(align_key + "-left") %>" value="left" checked="true">',
|
|
36
|
+
'<label for="<%= formId(align_key + "-left") %>"><%= i18n.t("blocks:textable:align:left") %></label>',
|
|
37
|
+
'<input data-key="<%= align_key %>" type="radio" name="<%= formId(align_key) %>" id="<%= formId(align_key + "-right") %>" value="right">',
|
|
38
|
+
'<label for="<%= formId(align_key + "-right") %>"><%= i18n.t("blocks:textable:align:right") %></label>',
|
|
39
|
+
'</div>',
|
|
40
|
+
'</div>',
|
|
41
|
+
'</div>'].join("\n"))(this); },
|
|
42
|
+
|
|
43
|
+
heading: function() {
|
|
44
|
+
if(this.show_heading) {
|
|
45
|
+
return ['<div class="field">',
|
|
46
|
+
'<label for="<%= formId(heading_key) %>" class="col-form-label"><%= i18n.t("blocks:textable:heading") %></label>',
|
|
47
|
+
'<input type="text" class="form-control" id="<%= formId(heading_key) %>" name="<%= heading_key %>" />',
|
|
48
|
+
'</div>'].join("\n");
|
|
49
|
+
} else {
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
SirTrevor.Block.prototype.availableMixins.push("plustextable");
|
|
57
|
+
})(jQuery);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
(function ($){
|
|
2
|
+
Spotlight.Block = SirTrevor.Block.extend({
|
|
3
|
+
scribeOptions: {
|
|
4
|
+
allowBlockElements: true,
|
|
5
|
+
tags: { p: true }
|
|
6
|
+
},
|
|
7
|
+
formable: true,
|
|
8
|
+
editorHTML: function() {
|
|
9
|
+
return _.template(this.template)(this);
|
|
10
|
+
},
|
|
11
|
+
beforeBlockRender: function() {
|
|
12
|
+
this.availableMixins.forEach(function(mixin) {
|
|
13
|
+
if (this[mixin] && SirTrevor.BlockMixins[this.capitalize(mixin)].preload) {
|
|
14
|
+
this.withMixin(SirTrevor.BlockMixins[this.capitalize(mixin)]);
|
|
15
|
+
}
|
|
16
|
+
}, this);
|
|
17
|
+
},
|
|
18
|
+
$instance: function() { return $('#' + this.instanceID); },
|
|
19
|
+
capitalize: function(string) {
|
|
20
|
+
return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase();
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
})(jQuery);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//= require spotlight/admin/blocks/resources_block
|
|
2
|
+
|
|
3
|
+
SirTrevor.Blocks.Browse = (function(){
|
|
4
|
+
|
|
5
|
+
return Spotlight.Block.Resources.extend({
|
|
6
|
+
type: "browse",
|
|
7
|
+
|
|
8
|
+
icon_name: "browse",
|
|
9
|
+
|
|
10
|
+
autocomplete_url: function() {
|
|
11
|
+
return $(this.inner).closest('form[data-autocomplete-exhibit-searches-path]').data('autocomplete-exhibit-searches-path').replace("%25QUERY", "%QUERY");
|
|
12
|
+
},
|
|
13
|
+
autocomplete_template: function() { return '<div class="autocomplete-item{{#unless published}} blacklight-private{{/unless}}">{{#if thumbnail_image_url}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail_image_url}}" /></div>{{/if}}<span class="autocomplete-title">{{full_title}}</span><br/><small> {{description}}</small></div>' },
|
|
14
|
+
|
|
15
|
+
bloodhoundOptions: function() {
|
|
16
|
+
return {
|
|
17
|
+
prefetch: {
|
|
18
|
+
url: this.autocomplete_url(),
|
|
19
|
+
ttl: 0
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
_itemPanel: function(data) {
|
|
25
|
+
var index = "item_" + this.globalIndex++;
|
|
26
|
+
var checked;
|
|
27
|
+
if (data.display == "true") {
|
|
28
|
+
checked = "checked='checked'"
|
|
29
|
+
} else {
|
|
30
|
+
checked = "";
|
|
31
|
+
}
|
|
32
|
+
var resource_id = data.slug || data.id;
|
|
33
|
+
var markup = [
|
|
34
|
+
'<li class="field form-inline dd-item dd3-item" data-resource-id="' + resource_id + '" data-id="' + index + '" id="' + this.formId("item_" + data.id) + '">',
|
|
35
|
+
'<input type="hidden" name="item[' + index + '][id]" value="' + resource_id + '" />',
|
|
36
|
+
'<input type="hidden" name="item[' + index + '][full_title]" value="' + (data.full_title || data.title) + '" />',
|
|
37
|
+
'<input data-property="weight" type="hidden" name="item[' + index + '][weight]" value="' + data.weight + '" />',
|
|
38
|
+
'<div class="card d-flex dd3-content">',
|
|
39
|
+
'<div class="dd-handle dd3-handle"><%= i18n.t("blocks:resources:panel:drag") %></div>',
|
|
40
|
+
'<div class="card-header item-grid">',
|
|
41
|
+
'<div class="d-flex">',
|
|
42
|
+
'<div class="checkbox">',
|
|
43
|
+
'<input name="item[' + index + '][display]" type="hidden" value="false" />',
|
|
44
|
+
'<input name="item[' + index + '][display]" id="'+ this.formId(this.display_checkbox + '_' + data.id) + '" type="checkbox" ' + checked + ' class="item-grid-checkbox" value="true" />',
|
|
45
|
+
'<label class="sr-only" for="'+ this.formId(this.display_checkbox + '_' + data.id) +'"><%= i18n.t("blocks:resources:panel:display") %></label>',
|
|
46
|
+
'</div>',
|
|
47
|
+
'<div class="pic">',
|
|
48
|
+
'<img class="img-thumbnail" src="' + (data.thumbnail_image_url || ((data.iiif_tilesource || "").replace("/info.json", "/full/!100,100/0/default.jpg"))) + '" />',
|
|
49
|
+
'</div>',
|
|
50
|
+
'<div class="main">',
|
|
51
|
+
'<div class="title card-title">' + (data.full_title || data.title) + '</div>',
|
|
52
|
+
'<div>' + (data.slug || data.id) + '</div>',
|
|
53
|
+
'</div>',
|
|
54
|
+
'<div class="remove float-right">',
|
|
55
|
+
'<a data-item-grid-panel-remove="true" href="#"><%= i18n.t("blocks:resources:panel:remove") %></a>',
|
|
56
|
+
'</div>',
|
|
57
|
+
'</div>',
|
|
58
|
+
'</div>',
|
|
59
|
+
'</div>',
|
|
60
|
+
'</li>'
|
|
61
|
+
].join("\n");
|
|
62
|
+
|
|
63
|
+
var panel = $(_.template(markup)(this));
|
|
64
|
+
var context = this;
|
|
65
|
+
|
|
66
|
+
$('.remove a', panel).on('click', function(e) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
$(this).closest('.field').remove();
|
|
69
|
+
context.afterPanelDelete();
|
|
70
|
+
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
this.afterPanelRender(data, panel);
|
|
74
|
+
|
|
75
|
+
return panel;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
item_options: function() { return [
|
|
79
|
+
'<label>',
|
|
80
|
+
'<input type="hidden" name="display-item-counts" value="false" />',
|
|
81
|
+
'<input type="checkbox" name="display-item-counts" value="true" checked />',
|
|
82
|
+
'<%= i18n.t("blocks:browse:item_counts") %>',
|
|
83
|
+
'</label>'
|
|
84
|
+
].join("\n") },
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
})();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Sir Trevor BrowseGroupCategories
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
SirTrevor.Blocks.BrowseGroupCategories = (function(){
|
|
6
|
+
|
|
7
|
+
return Spotlight.Block.Resources.extend({
|
|
8
|
+
type: "browse_group_categories",
|
|
9
|
+
icon_name: "browse",
|
|
10
|
+
bloodhoundOptions: function() {
|
|
11
|
+
var that = this;
|
|
12
|
+
return {
|
|
13
|
+
prefetch: {
|
|
14
|
+
url: this.autocomplete_url(),
|
|
15
|
+
ttl: 0,
|
|
16
|
+
filter: function(response) {
|
|
17
|
+
// Let the dom know that the response has been returned
|
|
18
|
+
$(that.inner).attr('data-browse-groups-fetched', true);
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
autocomplete_control: function() {
|
|
26
|
+
return '<input type="text" class="st-input-string form-control item-input-field" data-twitter-typeahead="true" placeholder="<%= i18n.t("blocks:browse_group_categories:autocomplete")%>"/>';
|
|
27
|
+
},
|
|
28
|
+
autocomplete_template: function() { return '<div class="autocomplete-item{{#unless published}} blacklight-private{{/unless}}"><span class="autocomplete-title">{{title}}</span><br/></div>' },
|
|
29
|
+
autocomplete_url: function() { return $(this.inner).closest('form[data-autocomplete-exhibit-browse-groups-path]').data('autocomplete-exhibit-browse-groups-path').replace("%25QUERY", "%QUERY"); },
|
|
30
|
+
_itemPanel: function(data) {
|
|
31
|
+
var index = "item_" + this.globalIndex++;
|
|
32
|
+
var checked;
|
|
33
|
+
if (data.display == "true") {
|
|
34
|
+
checked = "checked='checked'"
|
|
35
|
+
} else {
|
|
36
|
+
checked = "";
|
|
37
|
+
}
|
|
38
|
+
var resource_id = data.slug || data.id;
|
|
39
|
+
var markup = [
|
|
40
|
+
'<li class="field form-inline dd-item dd3-item" data-resource-id="' + resource_id + '" data-id="' + index + '" id="' + this.formId("item_" + data.id) + '">',
|
|
41
|
+
'<input type="hidden" name="item[' + index + '][id]" value="' + resource_id + '" />',
|
|
42
|
+
'<input type="hidden" name="item[' + index + '][title]" value="' + data.title + '" />',
|
|
43
|
+
'<input data-property="weight" type="hidden" name="item[' + index + '][weight]" value="' + data.weight + '" />',
|
|
44
|
+
'<div class="card d-flex dd3-content">',
|
|
45
|
+
'<div class="dd-handle dd3-handle"><%= i18n.t("blocks:resources:panel:drag") %></div>',
|
|
46
|
+
'<div class="d-flex card-header item-grid justify-content-between">',
|
|
47
|
+
'<div class="d-flex flex-grow-1">',
|
|
48
|
+
'<div class="checkbox">',
|
|
49
|
+
'<input name="item[' + index + '][display]" type="hidden" value="false" />',
|
|
50
|
+
'<input name="item[' + index + '][display]" id="'+ this.formId(this.display_checkbox + '_' + data.id) + '" type="checkbox" ' + checked + ' class="item-grid-checkbox" value="true" />',
|
|
51
|
+
'<label class="sr-only" for="'+ this.formId(this.display_checkbox + '_' + data.id) +'"><%= i18n.t("blocks:resources:panel:display") %></label>',
|
|
52
|
+
'</div>',
|
|
53
|
+
'<div class="main">',
|
|
54
|
+
'<div class="title card-title">' + data.title + '</div>',
|
|
55
|
+
'</div>',
|
|
56
|
+
'</div>',
|
|
57
|
+
'<div class="d-flex">',
|
|
58
|
+
'<a data-item-grid-panel-remove="true" href="#"><%= i18n.t("blocks:resources:panel:remove") %></a>',
|
|
59
|
+
'</div>',
|
|
60
|
+
'</div>',
|
|
61
|
+
'</div>',
|
|
62
|
+
'</li>'
|
|
63
|
+
].join("\n");
|
|
64
|
+
|
|
65
|
+
var panel = $(_.template(markup)(this));
|
|
66
|
+
var context = this;
|
|
67
|
+
|
|
68
|
+
$('a[data-item-grid-panel-remove]', panel).on('click', function(e) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
$(this).closest('.field').remove();
|
|
71
|
+
context.afterPanelDelete();
|
|
72
|
+
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
this.afterPanelRender(data, panel);
|
|
76
|
+
|
|
77
|
+
return panel;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
item_options: function() { return [
|
|
81
|
+
'<label>',
|
|
82
|
+
'<input type="hidden" name="display-item-counts" value="false" />',
|
|
83
|
+
'<input type="checkbox" name="display-item-counts" value="true" checked />',
|
|
84
|
+
'<%= i18n.t("blocks:browse_group_categories:item_counts") %>',
|
|
85
|
+
'</label>'
|
|
86
|
+
].join("\n") },
|
|
87
|
+
});
|
|
88
|
+
})();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Sir Trevor ItemText Block.
|
|
3
|
+
This block takes an ID,
|
|
4
|
+
fetches the record from solr,
|
|
5
|
+
displays the image, title,
|
|
6
|
+
and any provided text
|
|
7
|
+
and displays them.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
SirTrevor.Blocks.Iframe = (function(){
|
|
11
|
+
|
|
12
|
+
return SirTrevor.Block.extend({
|
|
13
|
+
type: "Iframe",
|
|
14
|
+
formable: true,
|
|
15
|
+
|
|
16
|
+
title: function() { return i18n.t('blocks:iframe:title'); },
|
|
17
|
+
description: function() { return i18n.t('blocks:iframe:description'); },
|
|
18
|
+
|
|
19
|
+
icon_name: "iframe",
|
|
20
|
+
|
|
21
|
+
editorHTML: function() {
|
|
22
|
+
return _.template(this.template, this)(this);
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
template: [
|
|
26
|
+
'<div class="clearfix">',
|
|
27
|
+
'<div class="widget-header">',
|
|
28
|
+
'<%= description() %>',
|
|
29
|
+
'</div>',
|
|
30
|
+
'<textarea name="code" class="form-control" rows="5" placeholder="<%= i18n.t("blocks:iframe:placeholder") %>"></textarea>',
|
|
31
|
+
'</div>'
|
|
32
|
+
].join("\n"),
|
|
33
|
+
});
|
|
34
|
+
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//= require spotlight/admin/blocks/browse_block
|
|
2
|
+
|
|
3
|
+
SirTrevor.Blocks.LinkToSearch = (function(){
|
|
4
|
+
|
|
5
|
+
return SirTrevor.Blocks.Browse.extend({
|
|
6
|
+
|
|
7
|
+
type: "link_to_search",
|
|
8
|
+
|
|
9
|
+
icon_name: 'search_results',
|
|
10
|
+
|
|
11
|
+
searches_key: "slug",
|
|
12
|
+
view_key: "view",
|
|
13
|
+
plustextable: false,
|
|
14
|
+
|
|
15
|
+
});
|
|
16
|
+
})();
|