jQuery OrgFinder plugin

jQuery Plugn Macros

The Kademi jquery forms plugin allows seemless integration between simple html forms and server side data, behaviour and responses. All forms should be submitted with this plugin.

Usage

  • You should have a Google API Key
  • You must set searchUrl is link to signup page of a group or /organisations/ (if you use this plugin in Kademi admin console)
 

Basic example

<script type="text/javascript">
$('#dealerSearch').orgFinder({
    searchUrl: '/Learners/signup',
    googleAPIKey: 'AIzaSyBccvDadY-bHIaNkl_1wa0DoV-owd7idoM',
    initLatLng: [-33.8147246, 151.033011],
    initZoomLevel: 15,
    initQuery: '$!request.params.q.trim()',
    onReady: function (formSearch, itemsWrapper, mapDiv) {
        win.on('resize', function () {
            var mapWrapper = mapDiv.parent();
            var winWidth = win.width();

            itemsWrapper.css('height', '');
            itemsWrapper.css('max-height', '');
            mapWrapper.css('padding-bottom', '');

            if (winWidth < 768) {
                mapWrapper.css('padding-bottom', '120%');
                itemsWrapper.css('max-height', 200);
            } else if (winWidth < 992) {
                itemsWrapper.css('max-height', 300);
            } else {
                itemsWrapper.css('height', mapWrapper.innerHeight() - 39);
            }
        }).trigger('resize');
    },
    onSearch: function (query) {
        history.pushState(null, 'Search', window.location.pathname + '?q=' + encodeURIComponent(query));
    }
});
</script>