spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af in blacklight-spotlight-0.0.2 vs spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af in blacklight-spotlight-0.0.3

- old
+ new

@@ -1,9 +1,9 @@ {I" class:ETI"BundledAsset;FI"logical_path;TI"application.js;TI" pathname;TI"0$root/app/assets/javascripts/application.js;FI"content_type;TI"application/javascript;TI" -mtime;Tl+©9ýRI" length;Tiül -I" digest;TI"%b6fffd6d99dc9d3c2108e5f8f9568114;FI" source;TI"ül +mtime;Tl+Ì–SI" length;TiKŽ +I" digest;TI"%c936f1b56196346876072b4f5b997b00;FI" source;TI"KŽ /*! * jQuery JavaScript Library v1.11.0 * http://jquery.com/ * * Includes Sizzle.js @@ -10737,11 +10737,11 @@ }); } })( jQuery ); (function() { - var CSRFToken, allowLinkExtensions, anchoredLink, browserCompatibleDocumentParser, browserIsntBuggy, browserSupportsCustomEvents, browserSupportsPushState, browserSupportsTurbolinks, cacheCurrentPage, cacheSize, changePage, constrainPageCacheTo, createDocument, crossOriginLink, currentState, enableTransitionCache, executeScriptTags, extractLink, extractTitleAndBody, fetch, fetchHistory, fetchReplacement, handleClick, historyStateIsDefined, htmlExtensions, ignoreClick, initializeTurbolinks, installClickHandlerLast, installDocumentReadyPageEventTriggers, installHistoryChangeHandler, installJqueryAjaxSuccessPageUpdateTrigger, loadedAssets, noTurbolink, nonHtmlLink, nonStandardClick, pageCache, pageChangePrevented, pagesCached, popCookie, processResponse, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, rememberReferer, removeHash, removeHashForIE10compatiblity, removeNoscriptTags, requestMethodIsSafe, resetScrollPosition, targetLink, transitionCacheEnabled, transitionCacheFor, triggerEvent, visit, xhr, _ref, + var CSRFToken, allowLinkExtensions, anchoredLink, browserCompatibleDocumentParser, browserIsntBuggy, browserSupportsCustomEvents, browserSupportsPushState, browserSupportsTurbolinks, bypassOnLoadPopstate, cacheCurrentPage, cacheSize, changePage, constrainPageCacheTo, createDocument, crossOriginLink, currentState, enableTransitionCache, executeScriptTags, extractLink, extractTitleAndBody, fetch, fetchHistory, fetchReplacement, handleClick, historyStateIsDefined, htmlExtensions, ignoreClick, initializeTurbolinks, installClickHandlerLast, installDocumentReadyPageEventTriggers, installHistoryChangeHandler, installJqueryAjaxSuccessPageUpdateTrigger, loadedAssets, noTurbolink, nonHtmlLink, nonStandardClick, pageCache, pageChangePrevented, pagesCached, popCookie, processResponse, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, rememberReferer, removeHash, removeHashForIE10compatiblity, removeNoscriptTags, requestMethodIsSafe, resetScrollPosition, targetLink, transitionCacheEnabled, transitionCacheFor, triggerEvent, visit, xhr, _ref, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, __slice = [].slice; pageCache = {}; @@ -10788,13 +10788,14 @@ } return transitionCacheEnabled = enable; }; fetchReplacement = function(url, onLoadFunction) { - var _this = this; if (onLoadFunction == null) { - onLoadFunction = function() {}; + onLoadFunction = (function(_this) { + return function() {}; + })(this); } triggerEvent('page:fetch', { url: url }); if (xhr != null) { @@ -11177,10 +11178,14 @@ htmlExtensions.push(extension); } return htmlExtensions; }; + bypassOnLoadPopstate = function(fn) { + return setTimeout(fn, 500); + }; + installDocumentReadyPageEventTriggers = function() { return document.addEventListener('DOMContentLoaded', (function() { triggerEvent('page:change'); return triggerEvent('page:update'); }), true); @@ -11212,14 +11217,16 @@ initializeTurbolinks = function() { rememberCurrentUrl(); rememberCurrentState(); createDocument = browserCompatibleDocumentParser(); document.addEventListener('click', installClickHandlerLast, true); - return window.addEventListener('popstate', installHistoryChangeHandler, false); + return bypassOnLoadPopstate(function() { + return window.addEventListener('popstate', installHistoryChangeHandler, false); + }); }; - historyStateIsDefined = window.history.state !== void 0 || navigator.userAgent.match(/Firefox\/26/); + historyStateIsDefined = window.history.state !== void 0 || navigator.userAgent.match(/Firefox\/2[6|7]/); browserSupportsPushState = window.history && window.history.pushState && window.history.replaceState && historyStateIsDefined; browserIsntBuggy = !navigator.userAgent.match(/CriOS\//); @@ -11666,11 +11673,11 @@ Blacklight.onLoad(function() { Blacklight.do_search_context_behavior(); }); })(jQuery); /* ======================================================================== - * Bootstrap: transition.js v3.1.0 + * Bootstrap: transition.js v3.1.1 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -11715,11 +11722,11 @@ $.support.transition = transitionEnd() }) }(jQuery); /* ======================================================================== - * Bootstrap: collapse.js v3.1.0 + * Bootstrap: collapse.js v3.1.1 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -11886,11 +11893,11 @@ $target.collapse(option) }) }(jQuery); /* ======================================================================== - * Bootstrap: dropdown.js v3.1.0 + * Bootstrap: dropdown.js v3.1.1 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -12034,11 +12041,11 @@ .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown) }(jQuery); /* ======================================================================== - * Bootstrap: alert.js v3.1.0 + * Bootstrap: alert.js v3.1.1 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -12123,11 +12130,11 @@ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(jQuery); /* ======================================================================== - * Bootstrap: modal.js v3.1.0 + * Bootstrap: modal.js v3.1.1 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -17735,11 +17742,11 @@ } }); /* ======================================================================== - * Bootstrap: tooltip.js v3.1.0 + * Bootstrap: tooltip.js v3.1.1 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) @@ -18135,11 +18142,11 @@ return this } }(jQuery); /* ======================================================================== - * Bootstrap: popover.js v3.1.0 + * Bootstrap: popover.js v3.1.1 * http://getbootstrap.com/javascript/#popovers * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -18787,27 +18794,162 @@ $('#nested-fields.facet_fields').nestable({maxDepth: 1}); // Handle weighting the pages and their children. updateWeightsAndRelationships($('#nested-fields .metadata_fields')); updateWeightsAndRelationships($('#nested-fields.facet_fields')); + + $('.field-label').on('click.inplaceedit', function() { + var $input = $(this).next('input'); + var $label = $(this); + + $label.hide(); + $input.val($label.text()); + $input.attr('type', 'text'); + $input.select(); + $input.focus(); + + $input.on('keypress', function(e) { + if(e.which == 13) { + $input.trigger('blur.inplaceedit'); + return false; + } + }); + + $input.on('blur.inplaceedit', function() { + $label.text($input.val()); + $label.show(); + $input.attr('type', 'hidden'); + + return false; + }); + + return false; + }); }); Spotlight.onLoad(function() { - // By default tags input binds on page ready to [data-role=tagsinput], - // however, that doesn't work with Turbolinks. So we init manually: - $('#solr_document_exhibit_tag_list').tagsinput(); + if($('#solr_document_exhibit_tag_list').length > 0) { + // By default tags input binds on page ready to [data-role=tagsinput], + // however, that doesn't work with Turbolinks. So we init manually: + $('#solr_document_exhibit_tag_list').tagsinput(); + + var tags = new Bloodhound({ + datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.name); }, + queryTokenizer: Bloodhound.tokenizers.whitespace, + limit: 10, + prefetch: { + url: $('#solr_document_exhibit_tag_list').data('autocomplete_url'), + ttl: 1, + filter: function(list) { + return $.map(list, function(tag) { return { name: tag }; }); + } + } + }); + + tags.initialize(); + + $('#solr_document_exhibit_tag_list').tagsinput('input').typeahead({highlight: true, hint: false}, { + name: 'tags', + displayKey: 'name', + source: tags.ttAdapter() + }).bind('typeahead:selected', $.proxy(function (obj, datum) { + $('#solr_document_exhibit_tag_list').tagsinput('add', datum.name); + $('#solr_document_exhibit_tag_list').tagsinput('input').typeahead('val', ''); + })); + } + + $(".visiblity_toggle").bl_checkbox_submit({ + //css_class is added to elements added, plus used for id base + css_class: "toggle_visibility", + //success is called at the end of the ajax success callback + success: function (public){ + // We store the selector of the label to toggle in a data attribute in the form + var private_label = $($(this).data("label-toggle-target")); + if ( public ) { + private_label.slideUp(); + } else { + private_label.slideDown(); + } + } + }); + }); Spotlight.onLoad(function() { $("#another-email").on("click", function() { container = $(this).parent().parent(); input = container.find('.input-group input[type="text"]').first().clone(); input.val(''); + input.attr('id', input.attr('id').replace('0', container.children().length)); input.attr('name', input.attr('name').replace('0', container.children().length)); container.append(input); }); $('.btn-with-tooltip').tooltip(); }); +Spotlight.onLoad(function() { + serializeObservedForms(observedForms()); +}); +// All the observed forms +function observedForms(){ + return $('[data-form-observer]'); +} +// Serialize all observed forms on the page +function serializeObservedForms(forms){ + forms.each(function(){ + serializeFormStatus($(this)); + unbindObservedFormSubmit(); + }); +} +// Unbind observing form on submit (which we have to do because of turbolinks) +function unbindObservedFormSubmit(){ + observedForms().each(function(){ + $(this).on("submit", function(){ + $(this).data("being-submitted", true); + }); + }); +} +// Store form serialization in data attribute +function serializeFormStatus(form){ + form.data("serialized-form", formSerialization(form)); +} +// Do custom serialization of the sir-trevor form data +function formSerialization(form){ + var content_editable = []; + var i=0; + $("[contenteditable='true']", form).each(function(){ + content_editable.push("&contenteditable_" + i + "=" + $(this).text()); + }); + return form.serialize() + content_editable.join(); +} +// Get the stored serialized form status +function serializedFormStatus(form){ + return form.data("serialized-form"); +} +// Check all observed forms on page for status change +function observedFormsStatusHasChanged(){ + var unsaved_changes = false; + observedForms().each(function(){ + if ( !$(this).data("being-submitted") ) { + if (serializedFormStatus($(this)) != formSerialization($(this))) { + unsaved_changes = true; + } + } + }); + return unsaved_changes; +} +// Compare stored and current form serializations +// to determine if the form has changed before +// unload and before any turbolinks change event +$(window).on('beforeunload page:before-change', function(event) { + if ( observedFormsStatusHasChanged() ) { + var message = "You have unsaved changes. Are you sure you want to leave this page?"; + if ( event.type == "beforeunload" ) { + return message; + }else{ + return confirm(message) + } + } +}); /* Sir Trevor ItemText Block. This block takes an ID, fetches the record from solr, displays the image, title, @@ -18833,18 +18975,17 @@ '<div class="col-sm-9">', '<div class="form-group">', '<label for="' + id_key + '" class="col-sm-2 control-label">Selected item</label>', '<div class="col-sm-6 field">', '<input name="' + id_key + '"', - ' class="st-input-string form-control ' + type + '" type="text" id="' + id_key + '" />', + ' class="st-input-string form-control ' + type + '" type="text" id="' + id_key + '" data-twitter-typeahead="true" />', '</div>', '</div>', '<div class="form-group">', '<label for="' + text_key + '" class="col-sm-2 control-label">Text</label>', '<div class="col-sm-6 field">', - '<textarea name="' + text_key + '"', - ' class="form-control" type="text" id="' + text_key + '" rows="8"></textarea>', + '<div id="' + text_key + '" class="st-text-block" contenteditable="true"></div>', '</div>', '</div>', '</div>', '<div class="col-sm-3">', '<label for"' + title_key + '">', @@ -18878,62 +19019,180 @@ toData: function() { var data = {}; data[id_key] = this.$('#' + id_key).val(); data[title_key] = this.$('#' + title_key).is(':checked'); - data[text_key] = this.$('#' + text_key).val(); + + if (this.hasTextBlock()) { + var content = this.getTextBlock().html(); + if (content.length > 0) { + data.text = SirTrevor.toMarkdown(content, this.type); + }else{ + data.text = ""; + } + } + data[align_key] = this.$('[name=' + align_key + ']:checked').val(); this.setData(data); }, onBlockRender: function() { addAutocompletetoSirTrevorForm(); }, loadData: function(data){ + this.getTextBlock().html(SirTrevor.toHTML(data.text, this.type)); this.$('#' + id_key).val(data[id_key]); this.$('#' + title_key).prop('checked', data[title_key]); - this.$('#' + text_key).val(data[text_key]); this.$('#' + align_key + "-" + data[align_key]).prop("checked", true); } }); })(); +/* + Sir Trevor MutliUpItemGrid Block. + This block takes an ID, + fetches the record from solr, + displays the image, title, + and any provided text + and displays them. +*/ + + +SirTrevor.Blocks.MultiUpItemGrid = (function(){ + var key = "item-grid" + var id_key = key + "-id"; + var display_checkbox = key + "-display"; + var caption_key = key + "-display-caption"; + var field_key = key + "caption-field"; + var max_fields = 5; + var type = "multi-up-item-grid"; + + var template = _.template([ + '<div class="form-inline ' + key + '-admin">', + '<div class="widget-header">', + 'This widget displays one to five thumbnail images of repository items in a single row grid. Optionally, you can a caption below each image..', + '</div>', + '<div class="col-sm-9">', + '<label for="' + id_key + '_0" class="control-label">Selected items to display</label>', + '<div class="form-group">', + buildInputFields(max_fields, id_key, display_checkbox), + '</div>', + '</div>', + '<div class="col-sm-3">', + '<label for"' + caption_key + '">', + '<input name="' + caption_key + '" type="hidden" value="false" />', + '<input name="' + caption_key + '" id="' + caption_key + '" type="checkbox" value="true" />', + 'Display caption', + '</label>', + '<div class="field-select">', + '<label for="' + field_key + '">Caption field</label>', + '<select name="' + field_key + '" id="' + field_key + '">', + '<option value="title">Title</option>', + '</select>', + '</div>', + '</div>', + '<div class="clearFix"></div>', + '</div>' + ].join("\n")); + + return SirTrevor.Block.extend({ + + type: type, + + title: function() { return "Multi-Up Item Grid"; }, + + editorHTML: function() { + return template(this); + }, + + icon_name: type, + + toData: function() { + var data = {}; + this.$('.item-grid-input').each(function(){ + data[$(this).attr("id")] = $(this).val(); + }); + this.$('.item-grid-checkbox').each(function(){ + data[$(this).attr("id")] = $("[name='" + $(this).attr('name') + "']:checked").val(); + }); + data[caption_key] = this.$('[name=' + caption_key + ']:checked').val(); + this.setData(data); + }, + + onBlockRender: function() { + addAutocompletetoSirTrevorForm(); + }, + + loadData: function(data){ + this.$('.item-grid-input').each(function(){ + $(this).val(data[$(this).attr("id")]); + }); + this.$('.item-grid-checkbox').each(function(){ + $(this).prop('checked', data[$(this).attr("id")]); + }); + this.$('#' + caption_key).prop('checked', data[caption_key]) + } + }); +})(); +function buildInputFields(times, id, checkbox){ + output = "" + for(var i=0; i < times; i++){ + output += '<div class="col-sm-9 field">'; + output += '<input name="' + checkbox + '_' + i + '" type="hidden" value="false" />'; + output += '<input name="' + checkbox + '_' + i + '" id="' + checkbox + '_' + i + '" type="checkbox" class="item-grid-checkbox" value="true" />'; + output += '<input name="' + id + '_' + i + '" class="st-input-string item-grid-input form-control" data-twitter-typeahead="true" type="text" id="' + id + '_' + i + '" />'; + output += '</div>'; + } + return output; +} +; // Place all the behaviors and hooks related to the matching controller here. // All this logic will automatically be available in application.js. Spotlight.onLoad(function() { // Initialize Nestable for nested pages $('#nested-pages.about_page_admin').nestable({maxDepth: 1}); $('#nested-pages.feature_page_admin').nestable({maxDepth: 2, expandBtnHTML: "", collapseBtnHTML: ""}); $('#nested-pages.search_admin').nestable({maxDepth: 1}); + $('.contacts_admin').nestable({maxDepth: 1}); // Handle weighting the pages and their children. updateWeightsAndRelationships($('#nested-pages')); + updateWeightsAndRelationships($('.contacts_admin')); $.each($('.dd-handle'), function(k, el){ var height; if ($(el).next('.dd3-content').length > 0) { height = $(el).next('.dd3-content').outerHeight(); } else { height = $(el).closest(".dd-item").outerHeight(); } $(el).css('height', height); }); + + SirTrevor.EventBus.on('block:create:new', addTitleToSirTrevorBlock); + SirTrevor.EventBus.on('block:create:existing', addTitleToSirTrevorBlock); }); +function addTitleToSirTrevorBlock(block){ + block.$inner.append("<div class='st-title'>" + block.title() + "</div>"); +}; + function updateWeightsAndRelationships(selector){ $.each(selector, function() { - $(this).on('change',function(){ + $(this).on('change', function(event){ + // Scope to a container because we may have two orderable sections on the page (e.g. About page has pages and contacts) + container = $(event.currentTarget); var data = $(this).nestable('serialize') var weight = 0; for(var i in data){ var parent_id = data[i]['id']; - parent_node = findNode(parent_id) + parent_node = findNode(parent_id, container); setWeight(parent_node, weight++); if(data[i]['children']){ var children = data[i]['children']; for(var child in children){ var id = children[child]['id'] - child_node = findNode(id); + child_node = findNode(id, container); setWeight(child_node, weight++); setParent(child_node, parent_id); } } else { setParent(parent_node, ""); @@ -18941,12 +19200,12 @@ } }); }); } -function findNode(id) { - return $("[data-id="+id+"]"); +function findNode(id, container) { + return container.find("[data-id="+id+"]"); } function setWeight(node, weight) { weight_field(node).val(weight); } @@ -21769,11 +22028,11 @@ } } }); function addAutocompletetoSirTrevorForm() { - $('input[name="item-id"]').typeahead(null, { + $('[data-twitter-typeahead]').typeahead(null, { displayKey: 'id', source: results.ttAdapter(), templates: { suggestion: Handlebars.compile( '{{title}}<br/><small>&nbsp;&nbsp;{{id}}</small>' @@ -21904,6 +22163,6 @@ // // Required by Blacklight ; -;TI"required_assets_digest;TI"%68b28ff77bd70aec046e82831fd20c03;FI" _version;TI"%ad5851230fbdd4f8a862674697158df2;F +;TI"required_assets_digest;TI"%32723af5130c22ddf21a9a916f4a3e52;FI" _version;TI"%1005ed9f20e25fb0a0599a7017dd0e6b;F \ No newline at end of file