How to use web - 10 common examples

To help you get started, we’ve selected a few web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flectra-hq / flectra / addons / website_slides / static / src / js / slides.js View on Github external
}
        $(el).text(display_str);
    });

    // To prevent showing channel settings alert box once user closed it.
    $('.o_slides_hide_channel_settings').on('click', function(ev) {
        var channel_id = $(this).data("channelId");
        ev.preventDefault();
        document.cookie = "slides_channel_" + channel_id + " = closed";
        return true;
    });

    /*
     * Like/Dislike Buttons Widget
     */
     var LikeButton = Widget.extend({
        setElement: function($el){
            this._super.apply(this, arguments);
            this.$el.on('click', this, _.bind(this.apply_action, this));
        },
        apply_action: function(ev){
            var button = $(ev.currentTarget);
            var slide_id = button.data('slide-id');
            var user_id = button.data('user-id');
            var is_public = button.data('public-user');
            var href = button.data('href');
            if(is_public){
                this.popover_alert(button, _.str.sprintf(_t('Please <a href="/web?redirect=%s">login</a> to vote this slide'), (document.URL)));
            }else{
                var target = button.find('.fa');
                if (local_storage.getItem('slide_vote_' + slide_id) !== user_id.toString()) {
                    ajax.jsonRpc(href, 'call', {slide_id: slide_id}).then(function (data) {
github AwesomeFoodCoops / odoo-production / odoo / addons / website_slides / static / src / js / slides.js View on Github external
}
        $(el).text(display_str);
    });

    // To prevent showing channel settings alert box once user closed it.
    $('.o_slides_hide_channel_settings').on('click', function(ev) {
        var channel_id = $(this).data("channelId");
        ev.preventDefault();
        document.cookie = "slides_channel_" + channel_id + " = closed";
        return true;
    });

    /*
     * Like/Dislike Buttons Widget
     */
     var LikeButton = Widget.extend({
        setElement: function($el){
            this._super.apply(this, arguments);
            this.$el.on('click', this, _.bind(this.apply_action, this));
        },
        apply_action: function(ev){
            var button = $(ev.currentTarget);
            var slide_id = button.data('slide-id');
            var user_id = button.data('user-id');
            var is_public = button.data('public-user');
            var href = button.data('href');
            if(is_public){
                this.popover_alert(button, _.str.sprintf(_t('Please <a href="/web?redirect=%s">login</a> to vote this slide'), (document.URL)));
            }else{
                var target = button.find('.fa');
                if (localStorage['slide_vote_' + slide_id] !== user_id.toString()) {
                    ajax.jsonRpc(href, 'call', {slide_id: slide_id}).then(function (data) {
github ingadhoc / odoo-support / web_support_client / static / src / js / web_support_client.js View on Github external
on_menu_service_portal: function() {
            new Model("res.users")
                .call("get_signup_url")
                .then(function (url) {
                    window.open(url, '_blank');
                });
            // window.open('https://www.adhoc.com.ar/doc/how-to', '_blank');
        },
        on_menu_help_and_doc: function() {
github AwesomeFoodCoops / odoo-production / odoo / addons / website / static / src / js / website.snippets.animation.js View on Github external
base.ready().then(function () {
    load_called_template();
    if ($(".o_gallery:not(.oe_slideshow)").size()) {
        // load gallery modal template
        ajax.loadXML('/website/static/src/xml/website.gallery.xml', qweb);
    }
});
github flectra-hq / flectra / addons / web / static / src / js / widgets / rainbow_man.js View on Github external
willStart: function () {
        var def;
        if (!qweb.has_template(this.template)) {
            // we need to manually load the templates when the rainbon_man is used in
            // the frontend, for example, it may be displayed at the end of a tour.
            def = ajax.loadXML("/web/static/src/xml/rainbow_man.xml", qweb);
        }
        return $.when(this._super.apply(this, arguments), def);
    },
    /**
github DocMarty84 / koozic / addons / web / static / src / js / chrome / abstract_action.js View on Github external
odoo.define('web.AbstractAction', function (require) {
"use strict";

/**
 * We define here the AbstractAction widget, which implements the ActionMixin.
 * All client actions must extend this widget.
 *
 * @module web.AbstractAction
 */

var ActionMixin = require('web.ActionMixin');
var ControlPanelView = require('web.ControlPanelView');
var Widget = require('web.Widget');

var AbstractAction = Widget.extend(ActionMixin, {
    config: {
        ControlPanelView: ControlPanelView,
    },

    /**
     * If this flag is set to true, the client action will create a control
     * panel whenever it is created.
     *
     * @type boolean
     */
    hasControlPanel: false,

    /**
     * If true, this flag indicates that the client action should automatically
     * fetch the  of a search view (or control panel view).  Note that
     * to do that, it also needs a specific modelName.
github DocMarty84 / koozic / addons / web / static / src / js / fields / abstract_field.js View on Github external
*   triggering events (with trigger_up).  These events bubble up and are interpreted
 *   by the most appropriate parent.
 *
 * Also, in some cases, it may not be practical to have the same widget for all
 * views. In that situation, you can have a 'view specific widget'.  Just register
 * the widget in the registry prefixed by the view type and a dot.  So, for example,
 * a form specific many2one widget should be registered as 'form.many2one'.
 *
 * @module web.AbstractField
 */

var ajax = require('web.ajax');
var field_utils = require('web.field_utils');
var Widget = require('web.Widget');

var AbstractField = Widget.extend({
    cssLibs: [],
    jsLibs: [],
    events: {
        'keydown': '_onKeydown',
    },
    custom_events: {
        navigation_move: '_onNavigationMove',
    },

    /**
    * An object representing fields to be fetched by the model eventhough not present in the view
    * This object contains "field name" as key and an object as value.
    * That value object must contain the key "type"
    * see FieldBinaryImage for an example.
    */
    fieldDependencies: {},
github flectra-hq / flectra / addons / web / static / src / js / fields / abstract_field.js View on Github external
*   triggering events (with trigger_up).  These events bubble up and are interpreted
 *   by the most appropriate parent.
 *
 * Also, in some cases, it may not be practical to have the same widget for all
 * views. In that situation, you can have a 'view specific widget'.  Just register
 * the widget in the registry prefixed by the view type and a dot.  So, for example,
 * a form specific many2one widget should be registered as 'form.many2one'.
 *
 * @module web.AbstractField
 */

var ajax = require('web.ajax');
var field_utils = require('web.field_utils');
var Widget = require('web.Widget');

var AbstractField = Widget.extend({
    cssLibs: [],
    jsLibs: [],
    events: {
        'keydown': '_onKeydown',
    },
    custom_events: {
        navigation_move: '_onNavigationMove',
    },

    /**
    * An object representing fields to be fetched by the model eventhough not present in the view
    * This object contains "field name" as key and an object as value.
    * That value object must contain the key "type"
    * see FieldBinaryImage for an example.
    */
    fieldDependencies: {},
github DocMarty84 / koozic / addons / web / static / src / js / services / data_manager.js View on Github external
create_filter: function (filter) {
        var self = this;
        return rpc.query({
                args: [filter],
                model: 'ir.filters',
                method: 'create_or_replace',
            })
            .then(function (filter_id) {
                var key = [
                    filter.model_id,
                    filter.action_id || false,
                ].join(',');
                self._invalidate(self._cache.filters, key);
                return filter_id;
            });
    },
github flectra-hq / flectra / addons / web / static / src / js / services / data_manager.js View on Github external
create_filter: function (filter) {
        var self = this;
        return rpc.query({
                args: [filter],
                model: 'ir.filters',
                method: 'create_or_replace',
            })
            .then(function (filter_id) {
                var key = [
                    filter.model_id,
                    filter.action_id || false,
                ].join(',');
                self._invalidate(self._cache.filters, key);
                return filter_id;
            });
    },

web

A small and fast web/http library for nodejs. (replaces the built-in http module)

MIT
Latest version published 11 years ago

Package Health Score

45 / 100
Full package analysis