summaryrefslogtreecommitdiff
path: root/addons/web_dashboard/static
diff options
context:
space:
mode:
authorVidhin Mehta (OpenERP) <vme@tinyerp.com>2011-09-14 11:07:46 +0530
committerVidhin Mehta (OpenERP) <vme@tinyerp.com>2011-09-14 11:07:46 +0530
commitb6076c3cc3ca5141349b99821268b8fd5e148b77 (patch)
treebb875d3ef5127cf5b8c35de6475de14e5477dbbd /addons/web_dashboard/static
parent243e1bdb0079ea9f214696ead8228d464ecb2cfc (diff)
parentc7c2b5846d3775780bbaa9a84a93ad755bdb8756 (diff)
[Merge] upto revno 1024.
bzr revid: vme@tinyerp.com-20110914053746-ri6d5s341mm6tc7n
Diffstat (limited to 'addons/web_dashboard/static')
-rw-r--r--addons/web_dashboard/static/src/css/dashboard.css239
-rw-r--r--addons/web_dashboard/static/src/img/layout_1-1-1.pngbin0 -> 306 bytes
-rw-r--r--addons/web_dashboard/static/src/img/layout_1-1.pngbin0 -> 313 bytes
-rw-r--r--addons/web_dashboard/static/src/img/layout_1-2.pngbin0 -> 313 bytes
-rw-r--r--addons/web_dashboard/static/src/img/layout_1.pngbin0 -> 292 bytes
-rw-r--r--addons/web_dashboard/static/src/img/layout_2-1.pngbin0 -> 304 bytes
-rw-r--r--addons/web_dashboard/static/src/js/dashboard.js409
-rw-r--r--addons/web_dashboard/static/src/xml/web_dashboard.xml115
8 files changed, 763 insertions, 0 deletions
diff --git a/addons/web_dashboard/static/src/css/dashboard.css b/addons/web_dashboard/static/src/css/dashboard.css
new file mode 100644
index 00000000000..f317cb45e8e
--- /dev/null
+++ b/addons/web_dashboard/static/src/css/dashboard.css
@@ -0,0 +1,239 @@
+.openerp table.oe-dashboard {
+ width: 100%;
+}
+.openerp .oe-dashboard-links {
+ text-align: right;
+ margin: -2em 0.4em 1em 0;
+}
+.openerp .oe-dashboard-action {
+ margin: 0 0.5em 0.5em 0;
+ padding: 2px;
+}
+.openerp .oe-dashboard-action:hover {
+ border: 1px dashed #ccc;
+ padding: 1px;
+}
+
+.openerp .oe-dashboard-action .oe-dashboard-action-header {
+ font-size: 125%;
+ font-weight: bold;
+}
+.openerp a.oe-dashboard-action-rename {
+ float: left;
+ padding-right: 4px;
+ position: relative;
+ top: 1px;
+}
+.openerp .oe-dashboard-action-input {
+ height: 16px;
+ position: relative;
+ top: 2px;
+}
+
+.openerp .oe-dashboard-action .oe-dashboard-action-header:hover {
+ cursor: move;
+}
+.openerp .oe-dashboard-action .ui-icon {
+ cursor: pointer;
+}
+.openerp .oe-dashboard-action .ui-icon:hover {
+ background-color: #ccc;
+ border-radius: 4px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+}
+
+.openerp .oe-dashboard-action .oe-dashboard-action-header .ui-icon {
+ float: right;
+}
+
+.openerp .oe-dashboard .ui-sortable-placeholder {
+ border: 1px dotted black;
+ visibility: visible !important;
+ height: 50px !important;
+}
+
+.openerp .oe-dashboard .ui-sortable-placeholder * {
+ visibility: hidden;
+}
+
+/* Layouts */
+.openerp .oe-dashboard-layout_1 .oe-dashboard-column.index_0 {
+ width: 100%;
+}
+.openerp .oe-dashboard-layout_1 .oe-dashboard-column.index_1,
+.openerp .oe-dashboard-layout_1 .oe-dashboard-column.index_2 {
+ display: none;
+}
+
+.openerp .oe-dashboard-layout_1-1 .oe-dashboard-column {
+ width: 50%;
+}
+.openerp .oe-dashboard-layout_1-1 .oe-dashboard-column.index_2 {
+ display: none;
+}
+
+.openerp .oe-dashboard-layout_1-1-1 .oe-dashboard-column {
+ width: 33%;
+}
+
+.openerp .oe-dashboard-layout_2-1 .oe-dashboard-column.index_0 {
+ width: 70%;
+}
+.openerp .oe-dashboard-layout_2-1 .oe-dashboard-column.index_1 {
+ width: 30%;
+}
+.openerp .oe-dashboard-layout_2-1 .oe-dashboard-column.index_2 {
+ display: none;
+}
+
+.openerp .oe-dashboard-layout_1-2 .oe-dashboard-column.index_0 {
+ width: 30%;
+}
+.openerp .oe-dashboard-layout_1-2 .oe-dashboard-column.index_1 {
+ width: 70%;
+}
+.openerp .oe-dashboard-layout_1-2 .oe-dashboard-column.index_2 {
+ display: none;
+}
+
+
+.openerp .oe-dashboard-layout-selector {
+ overflow: auto;
+ padding: 10px;
+}
+
+.openerp .oe-dashboard-layout-selector ul {
+ margin: 0;
+ padding: 0;
+}
+
+.openerp .oe-dashboard-layout-selector ul li {
+ position: relative;
+ float: left;
+ height: 51px;
+ list-style-type: none;
+ margin: 5px;
+ padding: 0;
+ width: 82px;
+ cursor: pointer;
+ border: 1px solid white;
+}
+.openerp .oe-dashboard-layout-selector ul li:hover {
+ border: 1px solid #090;
+}
+.openerp .oe-dashboard-layout-selector ul li img.oe-selected-layout {
+ position: absolute;
+ top: 0px;
+ right: 0px;
+}
+
+.openerp .oe-dashboard-config-overview .oe-config-progress {
+ border: 1px inset #d9d9d9;
+ background-color: #f2f2f2;
+ padding: 0.5em;
+ -webkit-border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ border-radius: 0.5em;
+}
+.openerp .oe-dashboard-config-overview .oe-config-progress-title {
+ font-size: 1.1em;
+ font-weight: bold;
+ text-transform: uppercase;
+ margin: 0 0 0.5em 0;
+}
+.openerp .oe-dashboard-config-overview dt {
+ font-weight: bold;
+ text-transform: uppercase;
+ border-top: 1px solid #eee;
+ padding-top: 0.5em;
+}
+.openerp .oe-dashboard-config-overview dt:first-child {
+ border-top: none;
+}
+.openerp .oe-dashboard-config-overview dd {
+ margin-left: 1em;
+ padding-bottom: 0.5em;
+}
+.openerp .oe-dashboard-config-overview ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+.openerp .oe-dashboard-config-overview li {
+ cursor: pointer;
+ position: relative;
+ text-indent: 20px;
+}
+.openerp .oe-dashboard-config-overview li:hover {
+ cursor: pointer;
+ background-color: #f7f7f7;
+}
+
+.openerp .oe-dashboard-config-overview li.oe-done {
+ cursor: default;
+ color: #999999;
+}
+
+.openerp .oe-dashboard-layout_2-1 .index_0 .oe-dashboard-config-overview ul,
+.openerp .oe-dashboard-layout_1-2 .index_1 .oe-dashboard-config-overview ul {
+ -moz-column-count: 2;
+ -webkit-column-count: 2;
+ column-count: 2;
+}
+.openerp .oe-dashboard-config-overview li span.ui-icon {
+ position: absolute;
+ top: 0;
+ left: 0;
+}
+
+.openerp .oe-dashboard-home-tile {
+ text-align: center;
+ margin: 10px;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ -webkit-box-shadow: 3px 3px 5px 3px #DADDDD;
+ -moz-box-shadow: 3px 3px 5px 3px #DADDDD;
+ box-shadow: 3px 3px 5px 3px #DADDDD;
+}
+.openerp .oe-dashboard-home-tile span {
+ display: block;
+ padding: 0 0 15px;
+ font-weight: bold;
+ text-transform: uppercase;
+ color: #555;
+ white-space: nowrap;
+}
+.openerp .oe-dashboard-home-tile-icon {
+ height: 100px;
+}
+.openerp .oe-dashboard-home-tile-icon img {
+ display: block;
+ margin: 0 auto;
+}
+.openerp .oe-dashboard-home-tile-icon img.hover {
+ display: none;
+}
+.openerp .oe-dashboard-home-tile:hover {
+ background-color: #fafafa;
+ -webkit-box-shadow: 3px 3px 5px 3px #979797;
+ -moz-box-shadow: 3px 3px 5px 3px #979797;
+ box-shadow: 3px 3px 5px 3px #979797;
+}
+.openerp .oe-dashboard-home-tile:hover img {
+ display: none;
+}
+.openerp .oe-dashboard-home-tile:hover img.hover {
+ display: block;
+}
+.openerp .oe-dashboard-home-tile:hover span {
+ color: black;
+}
+
+.openerp .oe-dashboard-action .view-manager-main-content {
+ padding: 2px;
+}
+.openerp .oe-dashboard-action-header .ui-icon, .openerp .oe-dashboard-action-header .oe-dashboard-action-rename {
+ display: none;
+}
diff --git a/addons/web_dashboard/static/src/img/layout_1-1-1.png b/addons/web_dashboard/static/src/img/layout_1-1-1.png
new file mode 100644
index 00000000000..5eda2823c46
--- /dev/null
+++ b/addons/web_dashboard/static/src/img/layout_1-1-1.png
Binary files differ
diff --git a/addons/web_dashboard/static/src/img/layout_1-1.png b/addons/web_dashboard/static/src/img/layout_1-1.png
new file mode 100644
index 00000000000..e72aa3a0533
--- /dev/null
+++ b/addons/web_dashboard/static/src/img/layout_1-1.png
Binary files differ
diff --git a/addons/web_dashboard/static/src/img/layout_1-2.png b/addons/web_dashboard/static/src/img/layout_1-2.png
new file mode 100644
index 00000000000..4b14d7aeaad
--- /dev/null
+++ b/addons/web_dashboard/static/src/img/layout_1-2.png
Binary files differ
diff --git a/addons/web_dashboard/static/src/img/layout_1.png b/addons/web_dashboard/static/src/img/layout_1.png
new file mode 100644
index 00000000000..69a0e30854c
--- /dev/null
+++ b/addons/web_dashboard/static/src/img/layout_1.png
Binary files differ
diff --git a/addons/web_dashboard/static/src/img/layout_2-1.png b/addons/web_dashboard/static/src/img/layout_2-1.png
new file mode 100644
index 00000000000..ed866add47c
--- /dev/null
+++ b/addons/web_dashboard/static/src/img/layout_2-1.png
Binary files differ
diff --git a/addons/web_dashboard/static/src/js/dashboard.js b/addons/web_dashboard/static/src/js/dashboard.js
new file mode 100644
index 00000000000..9fe904319f9
--- /dev/null
+++ b/addons/web_dashboard/static/src/js/dashboard.js
@@ -0,0 +1,409 @@
+openerp.web_dashboard = function(openerp) {
+var QWeb = openerp.web.qweb;
+QWeb.add_template('/web_dashboard/static/src/xml/web_dashboard.xml');
+
+openerp.web.form.DashBoard = openerp.web.form.Widget.extend({
+ init: function(view, node) {
+ this._super(view, node);
+ this.template = 'DashBoard';
+ this.actions_attrs = {};
+ this.action_managers = [];
+ },
+ start: function() {
+ var self = this;
+ this._super.apply(this, arguments);
+
+ this.$element.find('.oe-dashboard-column').sortable({
+ connectWith: '.oe-dashboard-column',
+ handle: '.oe-dashboard-action-header',
+ scroll: false
+ }).disableSelection().bind('sortstop', self.do_save_dashboard);
+
+ // Events
+ this.$element.find('.oe-dashboard-link-undo').click(this.on_undo);
+ this.$element.find('.oe-dashboard-link-reset').click(this.on_reset);
+ this.$element.find('.oe-dashboard-link-add_widget').click(this.on_add_widget);
+ this.$element.find('.oe-dashboard-link-change_layout').click(this.on_change_layout);
+
+ this.$element.delegate('.oe-dashboard-column .oe-dashboard-fold', 'click', this.on_fold_action);
+ this.$element.delegate('.oe-dashboard-column .ui-icon-closethick', 'click', this.on_close_action);
+
+ this.actions_attrs = {};
+ // Init actions
+ _.each(this.node.children, function(column) {
+ _.each(column.children, function(action) {
+ delete(action.attrs.width);
+ delete(action.attrs.height);
+ delete(action.attrs.colspan);
+ self.actions_attrs[action.attrs.name] = action.attrs;
+ self.rpc('/web/action/load', {
+ action_id: parseInt(action.attrs.name, 10)
+ }, self.on_load_action);
+ });
+ });
+
+ //this.$element.find('a.oe-dashboard-action-rename').live('click', this.on_rename);
+ this.$element.find('.oe-dashboard-action').live('mouseover mouseout', function(event) {
+ $(this).find('.oe-dashboard-action-header .ui-icon, .oe-dashboard-action-header .oe-dashboard-action-rename').toggle(event.type == 'mouseover');
+ });
+ },
+ on_undo: function() {
+ this.rpc('/web/view/undo_custom', {
+ view_id: this.view.fields_view.view_id
+ }, this.do_reload);
+ },
+ on_reset: function() {
+ this.rpc('/web/view/undo_custom', {
+ view_id: this.view.fields_view.view_id,
+ reset: true
+ }, this.do_reload);
+ },
+ on_add_widget: function() {
+ var self = this;
+ var action_manager = new openerp.web.ActionManager(this);
+ var dialog = new openerp.web.Dialog(this, {
+ title : 'Actions',
+ width: 800,
+ height: 600,
+ buttons : {
+ Cancel : function() {
+ $(this).dialog('destroy');
+ },
+ Add : function() {
+ self.do_add_widget(action_manager.inner_viewmanager.views.list.controller);
+ $(this).dialog('destroy');
+ }
+ }
+ }).start().open();
+ action_manager.appendTo(dialog.$element);
+ action_manager.do_action({
+ res_model : 'ir.actions.actions',
+ views : [[false, 'list']],
+ type : 'ir.actions.act_window',
+ limit : 80,
+ auto_search : true,
+ flags : {
+ sidebar : false,
+ views_switcher : false,
+ action_buttons : false
+ }
+ });
+ // TODO: should bind ListView#select_record in order to catch record clicking
+ },
+ do_add_widget : function(listview) {
+ var self = this,
+ actions = listview.groups.get_selection().ids,
+ results = [],
+ qdict = { view : this.view };
+ // TODO: should load multiple actions at once
+ _.each(actions, function(aid) {
+ self.rpc('/web/action/load', {
+ action_id: aid
+ }, function(result) {
+ self.actions_attrs[aid] = {
+ name: aid,
+ string: _.trim(result.result.name)
+ };
+ qdict.action = {
+ attrs : self.actions_attrs[aid]
+ };
+ self.$element.find('.oe-dashboard-column:first').prepend(QWeb.render('DashBoard.action', qdict));
+ self.do_save_dashboard();
+ self.on_load_action(result)
+ });
+ });
+ },
+ on_rename : function(e) {
+ var self = this,
+ id = parseInt($(e.currentTarget).parents('.oe-dashboard-action:first').attr('data-id'), 10),
+ $header = $(e.currentTarget).parents('.oe-dashboard-action-header:first'),
+ $rename = $header.find('a.oe-dashboard-action-rename').hide(),
+ $title = $header.find('span.oe-dashboard-action-title').hide(),
+ $input = $header.find('input[name=title]');
+ $input.val($title.text()).show().focus().bind('keydown', function(e) {
+ if (e.which == 13 || e.which == 27) {
+ if (e.which == 13) { //enter
+ var val = $input.val();
+ if (!val) {
+ return false;
+ }
+ $title.text(val);
+ self.actions_attrs[id].string = val;
+ self.do_save_dashboard();
+ }
+ $input.unbind('keydown').hide();
+ $rename.show();
+ $title.show();
+ }
+ });
+ },
+ on_change_layout: function() {
+ var self = this;
+ var qdict = {
+ current_layout : this.$element.find('.oe-dashboard').attr('data-layout')
+ };
+ var $dialog = $('<div>').dialog({
+ modal: true,
+ title: 'Edit Layout',
+ width: 'auto',
+ height: 'auto'
+ }).html(QWeb.render('DashBoard.layouts', qdict));
+ $dialog.find('li').click(function() {
+ var layout = $(this).attr('data-layout');
+ $dialog.dialog('destroy');
+ self.do_change_layout(layout);
+ });
+ },
+ do_change_layout: function(new_layout) {
+ var $dashboard = this.$element.find('.oe-dashboard');
+ var current_layout = $dashboard.attr('data-layout');
+ if (current_layout != new_layout) {
+ var clayout = current_layout.split('-').length,
+ nlayout = new_layout.split('-').length,
+ column_diff = clayout - nlayout;
+ if (column_diff > 0) {
+ var $last_column = $();
+ $dashboard.find('.oe-dashboard-column').each(function(k, v) {
+ if (k >= nlayout) {
+ $(v).find('.oe-dashboard-action').appendTo($last_column);
+ } else {
+ $last_column = $(v);
+ }
+ });
+ }
+ $dashboard.toggleClass('oe-dashboard-layout_' + current_layout + ' oe-dashboard-layout_' + new_layout);
+ $dashboard.attr('data-layout', new_layout);
+ this.do_save_dashboard();
+ }
+ },
+ on_fold_action: function(e) {
+ var $e = $(e.currentTarget),
+ $action = $e.parents('.oe-dashboard-action:first'),
+ id = parseInt($action.attr('data-id'), 10);
+ if ($e.is('.ui-icon-minusthick')) {
+ this.actions_attrs[id].fold = '1';
+ } else {
+ delete(this.actions_attrs[id].fold);
+ }
+ $e.toggleClass('ui-icon-minusthick ui-icon-plusthick');
+ $action.find('.oe-dashboard-action-content').toggle();
+ this.do_save_dashboard();
+ },
+ on_close_action: function(e) {
+ $(e.currentTarget).parents('.oe-dashboard-action:first').remove();
+ this.do_save_dashboard();
+ },
+ do_save_dashboard: function() {
+ var self = this;
+ var board = {
+ form_title : this.view.fields_view.arch.attrs.string,
+ style : this.$element.find('.oe-dashboard').attr('data-layout'),
+ columns : []
+ };
+ this.$element.find('.oe-dashboard-column').each(function() {
+ var actions = [];
+ $(this).find('.oe-dashboard-action').each(function() {
+ var action_id = $(this).attr('data-id');
+ actions.push(self.actions_attrs[action_id]);
+ });
+ board.columns.push(actions);
+ });
+ var arch = QWeb.render('DashBoard.xml', board);
+ this.rpc('/web/view/add_custom', {
+ view_id: this.view.fields_view.view_id,
+ arch: arch
+ }, function() {
+ self.$element.find('.oe-dashboard-link-undo, .oe-dashboard-link-reset').show();
+ });
+ },
+ on_load_action: function(result) {
+ var action = result.result;
+ action.flags = {
+ search_view : false,
+ sidebar : false,
+ views_switcher : false,
+ action_buttons : false,
+ pager: false
+ };
+ var am = new openerp.web.ActionManager(this);
+ this.action_managers.push(am);
+ am.appendTo($("#"+this.view.element_id + '_action_' + action.id));
+ am.do_action(action);
+ },
+ render: function() {
+ // We should start with three columns available
+ for (var i = this.node.children.length; i < 3; i++) {
+ this.node.children.push({
+ tag: 'column',
+ attrs: {},
+ children: []
+ });
+ }
+ return QWeb.render(this.template, this);
+ },
+ do_reload: function() {
+ _.each(this.action_managers, function(am) {
+ am.stop();
+ });
+ this.action_managers = [];
+ this.view.stop();
+ this.view.start();
+ }
+});
+openerp.web.form.DashBoardLegacy = openerp.web.form.DashBoard.extend({
+ render: function() {
+ if (this.node.tag == 'hpaned') {
+ this.node.attrs.style = '2-1';
+ } else if (this.node.tag == 'vpaned') {
+ this.node.attrs.style = '1';
+ }
+ this.node.tag = 'board';
+ _.each(this.node.children, function(child) {
+ if (child.tag.indexOf('child') == 0) {
+ child.tag = 'column';
+ var actions = [], first_child = child.children[0];
+ if (first_child && first_child.tag == 'vpaned') {
+ _.each(first_child.children, function(subchild) {
+ actions.push.apply(actions, subchild.children);
+ });
+ child.children = actions;
+ }
+ }
+ });
+ return this._super(this, arguments);
+ }
+});
+
+openerp.web.form.widgets.add('hpaned', 'openerp.web.form.DashBoardLegacy');
+openerp.web.form.widgets.add('vpaned', 'openerp.web.form.DashBoardLegacy');
+openerp.web.form.widgets.add('board', 'openerp.web.form.DashBoard');
+
+openerp.web.client_actions.add(
+ 'board.config.overview', 'openerp.web_dashboard.ConfigOverview'
+);
+if (!openerp.web_dashboard) {
+ /** @namespace */
+ openerp.web_dashboard = {};
+}
+openerp.web_dashboard.ConfigOverview = openerp.web.View.extend({
+ template: 'ConfigOverview',
+ init: function (parent, element_id) {
+ this._super(parent, element_id);
+ this.dataset = new openerp.web.DataSetSearch(
+ this, 'ir.actions.todo');
+ this.dataset.domain = [['type', '=', 'manual']];
+ },
+ start: function () {
+ $.when(this.dataset.read_slice(['state', 'action_id', 'category_id']),
+ this.dataset.call('progress'))
+ .then(this.on_records_loaded);
+ },
+ on_records_loaded: function (read_response, progress_response) {
+ var records = read_response[0].records,
+ progress = progress_response[0];
+
+ var grouped_todos = _(records).chain()
+ .map(function (record) {
+ return {
+ id: record.id,
+ name: record.action_id[1],
+ done: record.state !== 'open',
+ to_do: record.state === 'open',
+ category: record['category_id'][1] || "Uncategorized"
+ }
+ })
+ .groupBy(function (record) {return record.category})
+ .value();
+ this.$element.html(QWeb.render('ConfigOverview.content', {
+ completion: 100 * progress.done / progress.total,
+ groups: grouped_todos
+ }));
+ var $progress = this.$element.find('div.oe-config-progress-bar');
+ $progress.progressbar({value: $progress.data('completion')});
+
+ var self = this;
+ this.$element.find('dl')
+ .delegate('input', 'click', function (e) {
+ // switch todo status
+ e.stopImmediatePropagation();
+ var new_state = this.checked ? 'done' : 'open',
+ todo_id = parseInt($(this).val(), 10);
+ self.dataset.write(todo_id, {state: new_state}, {}, function () {
+ self.start();
+ });
+ })
+ .delegate('li:not(.oe-done)', 'click', function () {
+ self.widget_parent.widget_parent.widget_parent.execute_action({
+ type: 'object',
+ name: 'action_launch'
+ }, self.dataset,
+ $(this).data('id'), function () {
+ // after action popup closed, refresh configuration
+ // thingie
+ self.start();
+ });
+ });
+ }
+});
+
+openerp.web.client_actions.add(
+ 'board.home.applications', 'openerp.web_dashboard.ApplicationTiles');
+openerp.web_dashboard.ApplicationTiles = openerp.web.View.extend({
+ template: 'ApplicationTiles',
+ start: function () {
+ var self = this;
+ return new openerp.web.DataSetSearch(
+ this, 'ir.ui.menu', null, [['parent_id', '=', false]])
+ .read_slice( ['name', 'web_icon_data', 'web_icon_hover_data'], {}, function (applications) {
+ // Create a matrix of 3*x applications
+ var rows = [];
+ while (applications.length) {
+ rows.push(applications.splice(0, 3));
+ }
+ self.$element
+ .append(QWeb.render(
+ 'ApplicationTiles.content', {rows: rows}))
+ .find('.oe-dashboard-home-tile')
+ .click(function () {
+ var $this = $(this);
+ $this.closest('.openerp')
+ .find('.menu a[data-menu=' + $this.data('menuid') + ']')
+ .click();});
+ });
+ }
+});
+openerp.web.client_actions.add(
+ 'board.home.widgets', 'openerp.web_dashboard.Widget');
+openerp.web_dashboard.Widget = openerp.web.View.extend(/** @lends openerp.web_dashboard.Widgets# */{
+ template: 'HomeWidget',
+ /**
+ * Initializes a "HomeWidget" client widget: handles the display of a given
+ * res.widget objects in an OpenERP view (mainly a dashboard).
+ *
+ * @constructs openerp.web_dashboard.Widget
+ * @extends openerp.web.View
+ *
+ * @param {Object} parent
+ * @param {Object} options
+ * @param {Number} options.widget_id
+ */
+ init: function (parent, options) {
+ this._super(parent);
+ this.widget_id = options.widget_id;
+ },
+ start: function () {
+ return new openerp.web.DataSet(this, 'res.widget').read_ids(
+ [this.widget_id], ['title'], this.on_widget_loaded);
+ },
+ on_widget_loaded: function (widgets) {
+ var widget = widgets[0];
+ var url = _.sprintf(
+ '/web_dashboard/widgets/content?session_id=%s&widget_id=%d',
+ this.session.session_id, widget.id);
+ this.$element.html(QWeb.render('HomeWidget.content', {
+ widget: widget,
+ url: url
+ }));
+ }
+});
+};
diff --git a/addons/web_dashboard/static/src/xml/web_dashboard.xml b/addons/web_dashboard/static/src/xml/web_dashboard.xml
new file mode 100644
index 00000000000..e03e21b6487
--- /dev/null
+++ b/addons/web_dashboard/static/src/xml/web_dashboard.xml
@@ -0,0 +1,115 @@
+<template>
+<t t-name="DashBoard">
+ <div class="oe-dashboard-links">
+ <button type="button" class="button oe-dashboard-link-reset" t-att-style="view.fields_view.custom_view_id ? null : 'display: none'">
+ <img src="/web/static/src/img/icons/STOCK_GOTO_FIRST.png" width="16" height="16"/>
+ <span>Reset</span>
+ </button>
+ <button type="button" class="button oe-dashboard-link-undo" t-att-style="view.fields_view.custom_view_id ? null : 'display: none'">
+ <img src="/web/static/src/img/icons/gtk-undo.png" width="16" height="16"/>
+ <span>Undo</span>
+ </button>
+ <button type="button" class="button oe-dashboard-link-add_widget">
+ <img src="/web/static/src/img/icons/STOCK_ADD.png" width="16" height="16"/>
+ <span>Add Widget</span>
+ </button>
+ <button type="button" class="button oe-dashboard-link-change_layout">
+ <img src="/web/static/src/img/icons/gtk-edit.png" width="16" height="16"/>
+ <span>Change layout</span>
+ </button>
+ </div>
+ <table t-att-data-layout="node.attrs.style" t-attf-class="oe-dashboard oe-dashboard-layout_#{node.attrs.style}" cellspacing="0" cellpadding="0" border="0">
+ <tr>
+ <td t-foreach="node.children" t-as="column" t-if="column.tag == 'column'"
+ t-att-id="view.element_id + '_column_' + column_index" t-attf-class="oe-dashboard-column index_#{column_index}">
+
+ <t t-foreach="column.children" t-as="action" t-if="action.tag == 'action'" t-call="DashBoard.action"/>
+ </td>
+ </tr>
+ </table>
+</t>
+<t t-name="DashBoard.action">
+ <div t-att-data-id="action.attrs.name" class="oe-dashboard-action">
+ <h2 class="oe-dashboard-action-header oe_view_title">
+ <t t-esc="action.attrs.string"/>
+ <!--<a href="#" class="oe-dashboard-action-rename"><img src="/web/static/src/img/icons/gtk-edit.png" width="16" height="16"/></a>-->
+ <input class="oe-dashboard-action-input" type="text" name="title" value="" style="display: none"/>
+ <span class='ui-icon ui-icon-closethick'></span>
+ <span class='ui-icon ui-icon-minusthick oe-dashboard-fold' t-if="!action.attrs.fold"></span>
+ <span class='ui-icon ui-icon-plusthick oe-dashboard-fold' t-if="action.attrs.fold"></span>
+ </h2>
+ <div t-att-id="view.element_id + '_action_' + action.attrs.name" class="oe-dashboard-action-content" t-att-style="action.attrs.fold ? 'display: none' : null"></div>
+ </div>
+</t>
+<t t-name="DashBoard.layouts">
+ <div class="oe-dashboard-layout-selector">
+ <p>
+ <strong>Choose dashboard layout</strong>
+ </p>
+ <ul>
+ <li t-foreach="'1 1-1 1-1-1 1-2 2-1'.split(' ')" t-as="layout" t-att-data-layout="layout">
+ <img t-attf-src="/web_dashboard/static/src/img/layout_#{layout}.png"/>
+ <img t-if="layout == current_layout"
+ src="/web/static/src/img/icons/gtk-apply.png" width="16" height="16" class="oe-selected-layout"/>
+ </li>
+ </ul>
+ </div>
+</t>
+<t t-name="DashBoard.xml">
+ <form t-att-string="form_title">
+ <board t-att-style="style">
+ <column t-foreach="columns" t-as="column">
+ <action t-foreach="column" t-as="action" t-att="action"/>
+ </column>
+ </board>
+ </form>
+</t>
+<div t-name="ConfigOverview" class="oe-dashboard-config-overview"/>
+<t t-name="ConfigOverview.content">
+ <div class="oe-config-progress">
+ <h6 class="oe-config-progress-title">
+ progress: <t t-esc="Math.round(completion)"/>%
+ </h6>
+ <div class="oe-config-progress-bar" t-att-data-completion="completion"/>
+ </div>
+ <dl>
+ <t t-foreach="groups" t-as="category">
+ <dt><t t-esc="category"/></dt>
+ <dd><ul>
+ <li t-foreach="category_value" t-as="todo"
+ t-att-class="todo.done ? 'oe-done' : undefined"
+ t-att-data-id="todo.id"
+ t-att-title="!todo.done ? 'Execute task \'' + todo.name + '\'' : undefined">
+ <input type="checkbox" t-att-value="todo.id"
+ t-att-title="!todo.done ? 'Mark this task as done' : undefined"
+ t-att-checked="todo.done ? 'checked' : undefined"/>
+ <t t-esc="todo.name"/>
+ </li>
+ </ul></dd>
+ </t>
+
+ </dl>
+</t>
+<div t-name="ApplicationTiles" class="oe-dashboard-home-tiles"/>
+<table t-name="ApplicationTiles.content" width="100%">
+ <tr t-foreach="rows" t-as="row">
+ <td t-foreach="row" t-as="application" width="33.3%">
+ <div class="oe-dashboard-home-tile"
+ t-att-data-menuid="application.id">
+ <div class="oe-dashboard-home-tile-icon">
+ <img t-if="application.web_icon_data"
+ t-att-src="'data:image/png;base64,' + application.web_icon_data"
+ /><img t-if="application.web_icon_hover_data" class="hover"
+ t-att-src="'data:image/png;base64,' + application.web_icon_hover_data"/>
+ </div>
+ <span><t t-esc="application.name"/></span>
+ </div>
+ </td>
+ </tr>
+</table>
+<div t-name="HomeWidget" class="oe-dashboard-home-widget"/>
+<t t-name="HomeWidget.content">
+ <h3><t t-esc="widget.title"/></h3>
+ <iframe width="100%" frameborder="0" t-att-src="url"/>
+</t>
+</template>