odoo/base-addons/website/static/src/js/utils.js
/**
 * Allows the given input to propose existing website URLs.
 *
 * @param {ServicesMixin|Widget} self - an element capable to trigger an RPC
 * @param {jQuery} $input
 */
Allows the given input to propose existing website URLs.
@param {ServicesMixin|Widget} self - an element capable to trigger an RPC
@param {jQuery} $input
Allows the given input to propose existing website URLs . @param { ServicesMixin|Widget } self - an element capable to trigger an RPC @param { jQuery } $input
function autocompleteWithPages(self, $input) {
    $input.autocomplete({
        source: function (request, response) {
            if (request.term[0] === '#') {
                loadAnchors(request.term).then(function (anchors) {
                    response(anchors);
                });
            } else {
                return self._rpc({
                    model: 'website',
                    method: 'search_pages',
                    args: [null, request.term],
                    kwargs: {
                        limit: 15,
                    },
                }).then(function (exists) {
                    var rs = _.map(exists, function (r) {
                        return r.loc;
                    });
                    response(rs.sort());
                });
            }
        },
        close: function () {
            self.trigger_up('website_url_chosen');
        },
    });
}
function autocompleteWithPages ( self , $input ) { $input . autocomplete ( { source : function ( request , response ) { if ( request . term [ 0 ] === '#' ) { loadAnchors ( request . term ) . then ( function ( anchors ) { response ( anchors ) ; } ) ; } else { return self . _rpc ( { model : 'website' , method : 'search_pages' , args : [ null , request . term ] , kwargs : { limit : 15 , } , } ) . then ( function ( exists ) { var rs = _ . map ( exists , function ( r ) { return r . loc ; } ) ; response ( rs . sort ( ) ) ; } ) ; } } , close : function ( ) { self . trigger_up ( 'website_url_chosen' ) ; } , } ) ; }
Allows the given input to propose existing website URLs.
Allows the given input to propose existing website URLs .