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,120 @@
|
|
|
1
|
+
(function(global) {
|
|
2
|
+
var BLOCK_REPLACER_CONTROL_TEMPLATE = function(block) {
|
|
3
|
+
var el = document.createElement('button');
|
|
4
|
+
el.className = "st-block-controls__button";
|
|
5
|
+
el.setAttribute('data-type', block.type);
|
|
6
|
+
el.type = "button";
|
|
7
|
+
|
|
8
|
+
var img = document.createElement('svg');
|
|
9
|
+
img.className = "st-icon";
|
|
10
|
+
img.setAttribute('role', 'img');
|
|
11
|
+
|
|
12
|
+
var use = document.createElement('use');
|
|
13
|
+
use.setAttributeNS('https://www.w3.org/1999/xlink', 'href', SirTrevor.config.defaults.iconUrl + "#" + block.icon_name);
|
|
14
|
+
img.appendChild(use);
|
|
15
|
+
el.appendChild(img);
|
|
16
|
+
el.appendChild(document.createTextNode(block.title()));
|
|
17
|
+
|
|
18
|
+
return el.outerHTML;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function generateBlocksHTML(Blocks, availableTypes) {
|
|
22
|
+
var groups = {};
|
|
23
|
+
for(var i in availableTypes) {
|
|
24
|
+
var type = availableTypes[i];
|
|
25
|
+
if (Blocks.hasOwnProperty(type) && Blocks[type].prototype.toolbarEnabled) {
|
|
26
|
+
var blockGroup;
|
|
27
|
+
|
|
28
|
+
if ($.isFunction(Blocks[type].prototype.blockGroup)) {
|
|
29
|
+
blockGroup = Blocks[type].prototype.blockGroup();
|
|
30
|
+
} else {
|
|
31
|
+
blockGroup = Blocks[type].prototype.blockGroup;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (blockGroup == 'undefined' || blockGroup === undefined) {
|
|
35
|
+
blockGroup = i18n.t("blocks:group:undefined");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
groups[blockGroup] = groups[blockGroup] || [];
|
|
39
|
+
groups[blockGroup].push(BLOCK_REPLACER_CONTROL_TEMPLATE(Blocks[type].prototype));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function generateBlock(groups, key) {
|
|
44
|
+
var group = groups[key];
|
|
45
|
+
var groupEl = $("<div class='st-controls-group'><div class='st-group-col-form-label'>" + key + "</div></div>");
|
|
46
|
+
var buttons = group.reduce(function(memo, btn) {
|
|
47
|
+
return memo += btn;
|
|
48
|
+
}, "");
|
|
49
|
+
groupEl.append(buttons);
|
|
50
|
+
return groupEl[0].outerHTML;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var standardWidgets = generateBlock(groups, i18n.t("blocks:group:undefined"));
|
|
54
|
+
|
|
55
|
+
var exhibitWidgets = Object.keys(groups).map(function(key) {
|
|
56
|
+
if (key !== i18n.t("blocks:group:undefined")) {
|
|
57
|
+
return generateBlock(groups, key);
|
|
58
|
+
}
|
|
59
|
+
}).filter(function (element) {
|
|
60
|
+
return element != null;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
var blocks = [standardWidgets].concat(exhibitWidgets).join("<hr />");
|
|
64
|
+
return blocks;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function render(Blocks, availableTypes) {
|
|
68
|
+
var el = document.createElement('div');
|
|
69
|
+
el.className = "st-block-controls__buttons";
|
|
70
|
+
el.innerHTML = generateBlocksHTML.apply(null, arguments);
|
|
71
|
+
|
|
72
|
+
var elButtons = document.createElement('div');
|
|
73
|
+
elButtons.className = "spotlight-block-controls";
|
|
74
|
+
elButtons.appendChild(el);
|
|
75
|
+
return elButtons;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
global.Spotlight.BlockControls = function() { };
|
|
79
|
+
global.Spotlight.BlockControls.create = function(editor) {
|
|
80
|
+
// REFACTOR - should probably not know about blockManager
|
|
81
|
+
var el = render(SirTrevor.Blocks, editor.blockManager.blockTypes);
|
|
82
|
+
|
|
83
|
+
function hide() {
|
|
84
|
+
var parent = el.parentNode;
|
|
85
|
+
if (!parent) { return; }
|
|
86
|
+
parent.removeChild(el);
|
|
87
|
+
parent.classList.remove("st-block--controls-active");
|
|
88
|
+
return parent;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function destroy() {
|
|
92
|
+
SirTrevor = null;
|
|
93
|
+
el = null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function insert(e) {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
|
|
99
|
+
var parent = this.parentNode;
|
|
100
|
+
if (!parent || hide() === parent) { return; }
|
|
101
|
+
$('.st-block__inner', parent).after(el);
|
|
102
|
+
parent.classList.add("st-block--controls-active");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function replaceBlock() {
|
|
106
|
+
SirTrevor.mediator.trigger(
|
|
107
|
+
"block:replace", el.parentNode, this.getAttribute('data-type')
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
$(editor.wrapper).delegate(".st-block-replacer", "click", insert);
|
|
112
|
+
$(editor.wrapper).delegate(".st-block-controls__button", "click", insert);
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
el: el,
|
|
116
|
+
hide: hide,
|
|
117
|
+
destroy: destroy
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
})(this);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Spotlight.BlockLimits = function(editor) {
|
|
2
|
+
this.editor = editor;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
Spotlight.BlockLimits.prototype.enforceLimits = function(editor) {
|
|
6
|
+
this.addEditorCallbacks(editor);
|
|
7
|
+
this.checkGlobalBlockTypeLimit()();
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
Spotlight.BlockLimits.prototype.addEditorCallbacks = function(editor) {
|
|
11
|
+
SirTrevor.EventBus.on('block:create:new', this.checkBlockTypeLimitOnAdd());
|
|
12
|
+
SirTrevor.EventBus.on('block:remove', this.checkGlobalBlockTypeLimit());
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
Spotlight.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function() {
|
|
16
|
+
var editor = this.editor;
|
|
17
|
+
|
|
18
|
+
return function(block) {
|
|
19
|
+
var control = $(".st-block-controls__button[data-type='" + block.type + "']", editor.blockControls.el);
|
|
20
|
+
|
|
21
|
+
control.prop("disabled", !editor.blockManager.canCreateBlock(block.class()));
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
Spotlight.BlockLimits.prototype.checkGlobalBlockTypeLimit = function() {
|
|
26
|
+
// we don't know what type of block was created or removed.. So, try them all.
|
|
27
|
+
var editor = this.editor;
|
|
28
|
+
|
|
29
|
+
return function() {
|
|
30
|
+
$.each(editor.blockManager.blockTypes, function(i, type) {
|
|
31
|
+
var block_type = SirTrevor.Blocks[type].prototype;
|
|
32
|
+
|
|
33
|
+
var control = $(editor.blockControls.el).find(".st-block-controls__button[data-type='" + block_type.type + "']");
|
|
34
|
+
control.prop("disabled", !editor.blockManager.canCreateBlock(type));
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
|
|
2
|
+
autocompleteable: {
|
|
3
|
+
placeholder: "Enter a title..."
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
browse: {
|
|
7
|
+
title: "Browse Categories",
|
|
8
|
+
description: "This widget highlights browse categories. Each highlighted category links to the corresponding browse category results page.",
|
|
9
|
+
item_counts: "Include item counts?"
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
browse_group_categories: {
|
|
13
|
+
autocomplete: "Enter a browse group title...",
|
|
14
|
+
title: "Browse Group Categories",
|
|
15
|
+
description: "This widget displays all browse categories associated with a selected browse group as a horizontally-scrolling row. Each selected browse group is displayed as a separate row. Each displayed category in a group links to the corresponding browse category results page.",
|
|
16
|
+
item_counts: "Include category item counts?"
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
link_to_search: {
|
|
20
|
+
title: "Saved Searches",
|
|
21
|
+
description: "This widget highlights saved searches. Each highlighted saved search links to the search results page generated by the saved search parameters. Any saved search listed on the Curation > Browse categories page, whether published or not, can be highlighted as a saved search.",
|
|
22
|
+
item_counts: "Include item counts?"
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
iframe: {
|
|
26
|
+
title: "IFrame",
|
|
27
|
+
description: "This widget embeds iframe-based embed code into pages",
|
|
28
|
+
placeholder: "Enter embed code here. It should begin with e.g. '<iframe'"
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
oembed: {
|
|
32
|
+
title: "Embed + Text",
|
|
33
|
+
description: "This widget embeds an oEmbed-supported web resource and a text block to the left or right of it. Examples of oEmbed-supported resources include those from YouTube, Twitter, Flickr, and SlideShare.",
|
|
34
|
+
url: "URL",
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
uploaded_items: {
|
|
38
|
+
title: "Uploaded Item Row",
|
|
39
|
+
description: "This widget displays uploaded items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items. The item caption and link URL fields are also optional.",
|
|
40
|
+
caption: 'Caption',
|
|
41
|
+
link: 'Link URL'
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
featured_pages: {
|
|
45
|
+
title: "Pages",
|
|
46
|
+
description: "This widget highlights pages from this exhibit. Each highlighted item links to the corresponding page."
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
resources: {
|
|
50
|
+
panel: {
|
|
51
|
+
drag: "Drag",
|
|
52
|
+
display: "Display?",
|
|
53
|
+
remove: "Remove"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
rule: {
|
|
58
|
+
title: "Horizontal Rule"
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
search_results: {
|
|
62
|
+
title: "Search Results",
|
|
63
|
+
description: "This widget displays a set of search results on a page. Specify a search result set by selecting an existing browse category. You can also select the view types that are available to the user when viewing the result set."
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
solr_documents: {
|
|
67
|
+
title: "Item Row",
|
|
68
|
+
description: "This widget displays exhibit items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items.",
|
|
69
|
+
caption: {
|
|
70
|
+
placeholder: "Select...",
|
|
71
|
+
primary: "Primary caption",
|
|
72
|
+
secondary: "Secondary caption"
|
|
73
|
+
},
|
|
74
|
+
zpr: {
|
|
75
|
+
title: 'Offer "View larger" option'
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
solr_documents_carousel: {
|
|
80
|
+
title: "Item Carousel",
|
|
81
|
+
description: "This widget displays exhibit items in a carousel. You can configure the item captions, how the images are cycled, and the size of the carousel.",
|
|
82
|
+
interval: {
|
|
83
|
+
title: "Automatically cycle images",
|
|
84
|
+
placeholder: "Select..."
|
|
85
|
+
},
|
|
86
|
+
height: {
|
|
87
|
+
title: "Maximum carousel height"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
solr_documents_embed: {
|
|
92
|
+
title: "Item Embed",
|
|
93
|
+
description: "This widget embeds an exhibit item in a viewer on a page. Optionally, you can add a heading to be displayed above the viewer and/or text to be displayed adjacent to the viewer.",
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
solr_documents_features: {
|
|
97
|
+
title: "Item Slideshow",
|
|
98
|
+
description: "This widget displays exhibit items in a static slideshow. The user will move between items in the slideshow using the field you select as the primary caption."
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
solr_documents_grid: {
|
|
102
|
+
title: "Item Grid",
|
|
103
|
+
description: "This widget displays exhibit items in a multi-row grid. Optionally, you can add a heading and/or text to be displayed adjacent to the items."
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
textable: {
|
|
107
|
+
heading: "Heading",
|
|
108
|
+
text: "Text",
|
|
109
|
+
align: {
|
|
110
|
+
title: "Display text on:",
|
|
111
|
+
left: "Left",
|
|
112
|
+
right: "Right"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
group: {
|
|
117
|
+
undefined: "Standard widgets",
|
|
118
|
+
items: "Exhibit item widgets"
|
|
119
|
+
}
|
|
120
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
(function( global ) {
|
|
3
|
+
var Module = (function() {
|
|
4
|
+
var nestableSelector = '[data-behavior="nestable"]';
|
|
5
|
+
return {
|
|
6
|
+
init: function(selector){
|
|
7
|
+
|
|
8
|
+
$(selector || nestableSelector).each(function(){
|
|
9
|
+
// Because the Rails helper will not maintain the case that Nestable
|
|
10
|
+
// expects, we just need to do this manual conversion. :(
|
|
11
|
+
var data = $(this).data();
|
|
12
|
+
data.expandBtnHTML = data.expandBtnHtml;
|
|
13
|
+
data.collapseBtnHTML = data.collapseBtnHtml;
|
|
14
|
+
$(this).nestable(data);
|
|
15
|
+
updateWeightsAndRelationships($(this));
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function updateWeightsAndRelationships(nestedList){
|
|
20
|
+
nestedList.on('change', function(event){
|
|
21
|
+
var container = $(event.currentTarget);
|
|
22
|
+
var data = $(this).nestable('serialize');
|
|
23
|
+
var weight = 0;
|
|
24
|
+
for(var i in data){
|
|
25
|
+
var parent_id = data[i]['id'];
|
|
26
|
+
parent_node = findNode(parent_id, container);
|
|
27
|
+
setWeight(parent_node, weight++);
|
|
28
|
+
if(data[i]['children']){
|
|
29
|
+
var children = data[i]['children'];
|
|
30
|
+
for(var child in children){
|
|
31
|
+
var id = children[child]['id']
|
|
32
|
+
child_node = findNode(id, container);
|
|
33
|
+
setWeight(child_node, weight++);
|
|
34
|
+
setParent(child_node, parent_id);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
setParent(parent_node, "");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
function findNode(id, container) {
|
|
44
|
+
return container.find("[data-id="+id+"]");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function setWeight(node, weight) {
|
|
48
|
+
weight_field(node).val(weight);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function setParent(node, parent_id) {
|
|
52
|
+
parent_page_field(node).val(parent_id);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* find the input element with data-property="weight" that is nested under the given node */
|
|
56
|
+
function weight_field(node) {
|
|
57
|
+
return find_property(node, "weight");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* find the input element with data-property="parent_page" that is nested under the given node */
|
|
61
|
+
function parent_page_field(node){
|
|
62
|
+
return find_property(node, "parent_page");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function find_property(node, property) {
|
|
66
|
+
return node.find("input[data-property=" + property + "]");
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
69
|
+
|
|
70
|
+
global.SpotlightNestable = Module;
|
|
71
|
+
|
|
72
|
+
})( this );
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Spotlight.onLoad(function() {
|
|
2
|
+
$('[data-behavior="translation-progress"]').translationProgress();
|
|
3
|
+
});
|
|
4
|
+
|
|
5
|
+
// translationProgress is a plugin that updates the "3/14" progress
|
|
6
|
+
// counters in the tabs of the translation adminstration dashboard.
|
|
7
|
+
// This works by counting the number of progress items and translations
|
|
8
|
+
// present (indicated by data attributes) in each tab's content
|
|
9
|
+
(function($) {
|
|
10
|
+
$.fn.translationProgress = function() {
|
|
11
|
+
var translationTabs = this;
|
|
12
|
+
$(translationTabs).each(function(){
|
|
13
|
+
var currentTab = $(this);
|
|
14
|
+
var tabName = $(this).attr('aria-controls');
|
|
15
|
+
var translationFields = $('#' + tabName).find('[data-translation-progress-item="true"]');
|
|
16
|
+
var completedTranslations = $('#' + tabName).find('[data-translation-present="true"]');
|
|
17
|
+
|
|
18
|
+
currentTab.find('span').text(completedTranslations.length + '/' + translationFields.length);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return this;
|
|
22
|
+
};
|
|
23
|
+
})(jQuery);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
(function( $ ){
|
|
2
|
+
|
|
3
|
+
$.fn.spotlight_users = function( options ) {
|
|
4
|
+
|
|
5
|
+
// Create some defaults, extending them with any options that were provided
|
|
6
|
+
var settings = $.extend( { }, options);
|
|
7
|
+
var container;
|
|
8
|
+
|
|
9
|
+
function edit_user(event) {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
$(this).closest('tr').hide();
|
|
12
|
+
id = $(this).attr('data-target')
|
|
13
|
+
edit_view = $("[data-edit-for='"+id+"']", container).show();
|
|
14
|
+
$.each(edit_view.find('input[type="text"], select'), function() {
|
|
15
|
+
// Cache original values incase editing is canceled
|
|
16
|
+
$(this).data('orig', $(this).val());
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function cancel_edit(event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
id = $(this).closest('tr').attr('data-edit-for');
|
|
23
|
+
edit_view = $("[data-edit-for='"+id+"']", container).hide();
|
|
24
|
+
clear_errors(edit_view);
|
|
25
|
+
rollback_changes(edit_view);
|
|
26
|
+
$("[data-show-for='"+id+"']", container).show();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function clear_errors(element) {
|
|
30
|
+
element.find('.has-error')
|
|
31
|
+
.removeClass('has-error')
|
|
32
|
+
.find('.form-text')
|
|
33
|
+
.remove(); // Remove the error messages
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function rollback_changes(element) {
|
|
37
|
+
$.each(element.find('input[type="text"], select'), function() {
|
|
38
|
+
$(this).val($(this).data('orig')).trigger('change');
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function destroy_user(event) {
|
|
43
|
+
id = $(this).attr('data-target')
|
|
44
|
+
$("[data-destroy-for='"+id+"']", container).val('1');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function new_user(event) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
edit_view = $("[data-edit-for='new']", container).show();
|
|
50
|
+
$.each(edit_view.find('input[type="text"], select'), function() {
|
|
51
|
+
// Cache original values incase editing is canceled
|
|
52
|
+
$(this).data('orig', $(this).val());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function open_errors() {
|
|
57
|
+
edit_row = container.find('.has-error').closest('[data-edit-for]');
|
|
58
|
+
edit_row.show();
|
|
59
|
+
// The following row has the controls, so show it too.
|
|
60
|
+
edit_row.next().show();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return this.each(function() {
|
|
64
|
+
|
|
65
|
+
container = $(this);
|
|
66
|
+
$('[data-edit-for]', container).hide();
|
|
67
|
+
open_errors();
|
|
68
|
+
$("[data-behavior='edit-user']", container).on('click', edit_user);
|
|
69
|
+
$("[data-behavior='cancel-edit']", container).on('click', cancel_edit);
|
|
70
|
+
$("[data-behavior='destroy-user']", container).on('click', destroy_user);
|
|
71
|
+
$("[data-behavior='new-user']", container).on('click', new_user);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
})( jQuery );
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
Spotlight.onLoad(function() {
|
|
78
|
+
$('.edit_exhibit, .admin-users').spotlight_users();
|
|
79
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require spotlight/user/index
|
|
14
|
+
//= require spotlight/admin/index
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Spotlight = function() {
|
|
2
|
+
var buffer = [];
|
|
3
|
+
return {
|
|
4
|
+
onLoad: function(func) {
|
|
5
|
+
buffer.push(func);
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
activate: function() {
|
|
9
|
+
for(var i = 0; i < buffer.length; i++) {
|
|
10
|
+
buffer[i].call();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}();
|
|
15
|
+
|
|
16
|
+
Blacklight.onLoad(function() {
|
|
17
|
+
Spotlight.activate();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Spotlight.onLoad(function(){
|
|
21
|
+
SpotlightNestable.init();
|
|
22
|
+
});
|
|
23
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
(function( $ ){
|
|
2
|
+
|
|
3
|
+
$.fn.browseGroupCategories = function( options ) {
|
|
4
|
+
// Create some defaults, extending them with any options that were provided
|
|
5
|
+
var settings = $.extend( { }, options);
|
|
6
|
+
var $container, slider;
|
|
7
|
+
|
|
8
|
+
function init() {
|
|
9
|
+
var data = $container.data();
|
|
10
|
+
var sidebar = $container.data().sidebar;
|
|
11
|
+
var items = data.browseGroupCategoriesCount;
|
|
12
|
+
var dir = $('html').attr('dir');
|
|
13
|
+
var controls = $container.parent().find('.browse-group-categories-controls')[0];
|
|
14
|
+
|
|
15
|
+
slider = tns({
|
|
16
|
+
container: $container[0],
|
|
17
|
+
controlsContainer: controls,
|
|
18
|
+
loop: false,
|
|
19
|
+
nav: false,
|
|
20
|
+
items: 1,
|
|
21
|
+
slideBy: 'page',
|
|
22
|
+
textDirection: dir,
|
|
23
|
+
responsive: {
|
|
24
|
+
576: {
|
|
25
|
+
items: itemCount(items, sidebar)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Destroy the slider instance, as tns will change the dom elements, causing some issues with turbolinks
|
|
32
|
+
function setupDestroy() {
|
|
33
|
+
document.addEventListener('turbolinks:before-cache', function() {
|
|
34
|
+
if (slider && slider.destroy) {
|
|
35
|
+
slider.destroy();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function itemCount(items, sidebar) {
|
|
41
|
+
if (items < 3) {
|
|
42
|
+
return items;
|
|
43
|
+
}
|
|
44
|
+
return sidebar ? 3 : 4;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return this.each(function() {
|
|
48
|
+
$container = $(this);
|
|
49
|
+
init();
|
|
50
|
+
setupDestroy();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
})( jQuery );
|
|
54
|
+
|
|
55
|
+
Spotlight.onLoad(function() {
|
|
56
|
+
$('[data-browse-group-categories-carousel]').each(function(i, el) {
|
|
57
|
+
$(el).browseGroupCategories();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Spotlight.onLoad(function() {
|
|
2
|
+
$('.btn-reset').ClearFormButton();
|
|
3
|
+
});
|
|
4
|
+
|
|
5
|
+
(function($) {
|
|
6
|
+
$.fn.ClearFormButton = function() {
|
|
7
|
+
var $clearBtn = $(this);
|
|
8
|
+
var $input = $clearBtn.parent().prev('input');
|
|
9
|
+
var btnCheck = function(){
|
|
10
|
+
if ($input.val() !== '') {
|
|
11
|
+
$clearBtn.css('display', 'inline-block');
|
|
12
|
+
} else {
|
|
13
|
+
$clearBtn.css('display', 'none');
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
btnCheck();
|
|
18
|
+
$input.on('keyup', function() {
|
|
19
|
+
btnCheck();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
$clearBtn.on('click', function(event) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
$input.val('');
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})(jQuery);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
(function( $ ){
|
|
2
|
+
|
|
3
|
+
$.fn.reportProblem = function( options ) {
|
|
4
|
+
// Create some defaults, extending them with any options that were provided
|
|
5
|
+
var settings = $.extend( { }, options);
|
|
6
|
+
var container, target, cancel;
|
|
7
|
+
|
|
8
|
+
function init() {
|
|
9
|
+
target_val = container.attr('data-target')
|
|
10
|
+
if (!target_val)
|
|
11
|
+
return
|
|
12
|
+
|
|
13
|
+
target = $("#" + target_val);
|
|
14
|
+
container.on('click', open);
|
|
15
|
+
target.find('[data-behavior="cancel-link"]').on('click', close);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function open(event) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
target.slideToggle('slow');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function close(event) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
target.slideUp('fast');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return this.each(function() {
|
|
29
|
+
container = $(this);
|
|
30
|
+
init();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
})( jQuery );
|
|
34
|
+
|
|
35
|
+
Spotlight.onLoad(function() {
|
|
36
|
+
$('[data-behavior="contact-link"]').reportProblem();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
|