/** * Created by schmuend on 06.11.16. */ (function(w, $){ "use strict"; var $el = $('#agency_profileImage_upload'); $el.transloadit({ wait: true, fields: true, processZeroFiles: false, onError: function(assembly) { alert(assembly.error + ': ' + Assembly.message); } }); var $input = $("input[name*=example_upload]"); var uploader = $el.data('transloadit.uploader'); $input.change(function(file){ if ($(this).prop('files') && $(this).prop('files')[0]) { var reader = new FileReader(); reader.onload = function (e) { var image = new Image(); image.src = reader.result; console.log(image.width); //270px X 340px setTimeout(function () { if (image.width >= 270 && image.height>=340 ){ uploader.$files = $($input); } else { $input.val(''); uploader.$files = null; alert('Bild zu klein, muss mindestens 270x340 Pixel groß sein.') } }, 100); } reader.readAsDataURL($(this).prop('files')[0]); } }); $('#user_agency_profile_agency_location').autocompleter({ url_list: '/location_search', url_get: '/location_get', otherOptions: { // minimumInputLength: 3, // formatNoMatches: 'Keine Stadt gefunden', // formatSearching: 'Suche Städte...', // formatInputTooShort: 'Bitte mindestens 3 Buchstaben eingeben!', // width: 'element', // placeholder: "Stadt auswählen", // allowClear: true, // formatSelection: formatLocation, // formatResult: formatLocation placeholder: 'Stadt wählen', width: 'element', minimumInputLength: 3, allowClear: true, templateSelection: formatLocation, templateResult: formatLocation } }); function formatLocation(item) { if (item.postalCode && item.name){ return item.postalCode + ' ' + item.name; } else { return item.text; } } /** * Autocomplete for @link SearchFormType in artists_index */ $('#user_agency_search_location').autocompleter({ url_list: '/location_search_unique', url_get: '/location_get', otherOptions: { placeholder: 'Stadt wählen', width: 'element', minimumInputLength: 3, allowClear: true, templateSelection: formatLocationForSearch, templateResult: formatLocationForSearch }, }); function formatLocationForSearch(item) { if (item.name){ return item.name; } else { return item.text; } } $('#clearSearch').on('click', function () { }) })(window, jQuery);