Sha256: b21a705425bd4bd89f8df0c3af553406ec821310d98c4aa75740073947c5b181
Contents?: true
Size: 1.64 KB
Versions: 29
Compression:
Stored size: 1.64 KB
Contents
/** * @namespace WORKAREA.categorizedAutocompleteFields */ WORKAREA.registerModule('categorizedAutocompleteFields', (function () { 'use strict'; var getSource = function (request, response) { $.getJSON('/admin/jump_to', { q: request.term }, function (data) { response(data.results); }); }, openSelected = function (event, ui) { var $adminToolbar = $(event.target).closest('.admin-toolbar'); if (_.isEmpty($adminToolbar)) { Turbolinks.visit(ui.item.url); } else { window.top.location.href = ui.item.url; } }, getConfig = function () { return _.assign({}, WORKAREA.config.categorizedAutocompleteFields.uiOptions, { source: getSource, select: openSelected, position: { my: 'center top', at: 'center bottom', collision: 'none' } }); }, initAutocomplete = function ($field) { $field.categorizedAutocomplete(getConfig()); }, defineInjectionPoint = function (index, field) { $(field).parent().addClass('ui-front'); return $(field); }, setup = _.flow(defineInjectionPoint, initAutocomplete), /** * @method * @name init * @memberof WORKAREA.categorizedAutocompleteFields */ init = function ($scope) { $('[data-categorized-autocomplete-field]', $scope).each(setup); }; return { init: init }; }()));
Version data entries
29 entries across 29 versions & 1 rubygems