From ba5be4ecaf1c47cf63c8a997d55cab19b7a3ffe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 8 Jan 2013 13:32:10 +0100 Subject: [PATCH] Add toolbar on Tab.Form --- index.html | 4 +- src/action.js | 16 ++++++++ src/tab.js | 110 ++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 126 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 7079f17b14..df21a3e9e7 100644 --- a/index.html +++ b/index.html @@ -43,7 +43,9 @@ this repository contains the full copyright notices and license terms. --> 'view_ids': [3], 'domain': [['parent', '=', null]] }); - $('#menu').html(form.el); + form.view_prm.done(function() { + jQuery('#menu').append(form.screen.el.detach()); + }); }); }); diff --git a/src/action.js b/src/action.js index e6daa9c805..009f5a6e36 100644 --- a/src/action.js +++ b/src/action.js @@ -127,4 +127,20 @@ }; return prm.pipe(exec_action); }; + + Sao.Action.evaluate = function(action, atype, record) { + action = jQuery.extend({}, action); + switch (atype) { + case 'print': + case 'action': + // TODO + break; + case 'relate': + // TODO + break; + default: + throw new Error('Action type ' + atype + ' is not supported'); + } + return action; + }; }()); diff --git a/src/tab.js b/src/tab.js index cf779dd318..a47eb19cd4 100644 --- a/src/tab.js +++ b/src/tab.js @@ -5,7 +5,32 @@ Sao.Tab = Sao.class_(Object, { init: function() { - } + this.buttons = {}; + }, + create_toolbar: function() { + var toolbar = jQuery('
', { + 'class': 'ui-widget-header ui-corner-all' + }); + var add_button = function(tool) { + var click_func = function() { + this[tool[4]](); + }; + var button = jQuery('