diff options
| author | Fabien Meghazi <fme@openerp.com> | 2012-05-03 12:12:43 +0200 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2012-05-03 12:12:43 +0200 |
| commit | cb577e2bee31fb8ac8d19281967dda7a33910d2e (patch) | |
| tree | 590628e58195669328d96413f9e84875c2fc0919 /addons/web/static/src/js | |
| parent | cf322b006434e650d4ffeb51975bee416b116da1 (diff) | |
[REM] Removed shortcuts. Added class for systray dropdown
bzr revid: fme@openerp.com-20120503101243-51dol1mjqmjoqx9m
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 57 | ||||
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 1 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 40 |
3 files changed, 0 insertions, 98 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index f43da0431ff..069ce1ad110 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -751,59 +751,12 @@ instance.web.UserMenu = instance.web.Widget.extend({ self.$element.find('.oe_topbar_name').text(topbar_name); var avatar_src = _.str.sprintf('%s/web/binary/image?session_id=%s&model=res.users&field=avatar&id=%s', self.session.prefix, self.session.session_id, self.session.uid); $avatar.attr('src', avatar_src); - return self.shortcut_load(); }); }; this.update_promise = this.update_promise.pipe(fct, fct); }, on_action: function() { }, - shortcut_load :function(){ - var self = this, - sc = self.session.shortcuts, - shortcuts_ds = new instance.web.DataSet(this, 'ir.ui.view_sc'); - self.$element.find('.oe_dropdown_options a[data-menu=shortcut]').each(function() { - $(this).parent().remove(); - }); - // TODO: better way to communicate between sections. - // sc.bindings, because jquery does not bind/trigger on arrays... - if (!sc.binding) { - sc.binding = {}; - $(sc.binding).bind({ - 'add': function (e, attrs) { - shortcuts_ds.create(attrs, function (out) { - var shortcut = QWeb.render('UserMenu.shortcut', { - shortcuts : [{ - name : attrs.name, - id : out.result, - res_id : attrs.res_id - }] - }); - $(shortcut).appendTo(self.$element.find('.oe_dropdown_options')); - attrs.id = out.result; - sc.push(attrs); - }); - }, - 'remove-current': function () { - var menu_id = self.session.active_id; - var $shortcut = self.$element.find('.oe_dropdown_options li a[data-id=' + menu_id + ']'); - var shortcut_id = $shortcut.data('shortcut-id'); - $shortcut.remove(); - shortcuts_ds.unlink([shortcut_id]); - var sc_new = _.reject(sc, function(shortcut){ return shortcut_id === shortcut.id}); - sc.splice(0, sc.length); - sc.push.apply(sc, sc_new); - } - }); - } - return this.rpc('/web/session/sc_list', {}, function(shortcuts) { - sc.splice(0, sc.length); - sc.push.apply(sc, shortcuts); - - $(QWeb.render('UserMenu.shortcut', {'shortcuts': shortcuts})) - .appendTo(self.$element.find('.oe_dropdown_options')); - }); - }, on_menu_logout: function() { }, on_menu_settings: function() { @@ -860,16 +813,6 @@ instance.web.UserMenu = instance.web.Widget.extend({ modal: true, width: 960, title: _t("About")}); }); }, - on_menu_shortcut: function($link) { - var self = this, - id = $link.data('id'); - self.session.active_id = id; - self.rpc('/web/menu/action', {'menu_id': id}, function(ir_menu_data) { - if (ir_menu_data.action.length){ - self.on_action(ir_menu_data.action[0][2]); - } - }); - } }); instance.web.WebClient = instance.web.Widget.extend({ diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index e633ea9cfec..00fdb9aec98 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -69,7 +69,6 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess self.module_loaded[mod] = true; }); this.context = {}; - this.shortcuts = []; this.active_id = null; return this.session_init(); }, diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 798c5bb1493..298967ab8e8 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -636,8 +636,6 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ var self = this; return $.when(this._super(view_type, no_store)).then(function () { - self.shortcut_check(self.views[view_type]); - var controller = self.views[self.active_view].controller, fvg = controller.fields_view, view_id = (fvg && fvg.view_id) || '--'; @@ -681,44 +679,6 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ self.views[self.active_view].controller.do_load_state(state, warm); }); }, - shortcut_check : function(view) { - var self = this; - var grandparent = this.getParent() && this.getParent().getParent(); - // display shortcuts if on the first view for the action - var $shortcut_toggle = this.$element.find('.oe-shortcut-toggle'); - if (!this.action.name || - !(view.view_type === this.views_src[0].view_type - && view.view_id === this.views_src[0].view_id)) { - $shortcut_toggle.hide(); - return; - } - $shortcut_toggle.removeClass('oe-shortcut-remove').show(); - if (_(this.session.shortcuts).detect(function (shortcut) { - return shortcut.res_id === self.session.active_id; })) { - $shortcut_toggle.addClass("oe-shortcut-remove"); - } - this.shortcut_add_remove(); - }, - shortcut_add_remove: function() { - var self = this; - var $shortcut_toggle = this.$element.find('.oe-shortcut-toggle'); - $shortcut_toggle - .unbind("click") - .click(function() { - if ($shortcut_toggle.hasClass("oe-shortcut-remove")) { - $(self.session.shortcuts.binding).trigger('remove-current'); - $shortcut_toggle.removeClass("oe-shortcut-remove"); - } else { - $(self.session.shortcuts.binding).trigger('add', { - 'user_id': self.session.uid, - 'res_id': self.session.active_id, - 'resource': 'ir.ui.menu', - 'name': self.action.name - }); - $shortcut_toggle.addClass("oe-shortcut-remove"); - } - }); - }, display_title: function () { return this.action.name; } |
