[FIX] Code cleanup.
bzr revid: vda@tinyerp.com-20110511091342-y76kpbhtg40opvzn
This commit is contained in:
@@ -32,32 +32,6 @@ openerp.base.form.Board = openerp.base.form.Widget.extend({
|
||||
|
||||
jQuery('.column').css('width', 100/children.length+'%');
|
||||
},
|
||||
|
||||
// render: function() {
|
||||
// var self = this;
|
||||
// var children = this.node.children;
|
||||
// console.log('test>>>',this.$element)
|
||||
//// jQuery('body').append(
|
||||
//// jQuery('<div>', {'id': 'dashboard_template'}).load('/base_dashboard/static/src/dashboard_template.html',self.on_loaded).hide()
|
||||
//// )
|
||||
// },
|
||||
|
||||
// on_loaded: function() {
|
||||
// var children = this.node.children;
|
||||
// var board = jQuery('#dashboard').dashboard({
|
||||
// layoutClass:'layout'
|
||||
// });
|
||||
// board.init();
|
||||
// for(var ch = 0; ch < children.length; ch++) {
|
||||
// var ch_widgets = children[ch].children;
|
||||
// for(var chld = 0; chld < ch_widgets.length; chld++) {
|
||||
// var widget_type = ch_widgets[chld].tag;
|
||||
// var child_index = widget_type == 'action' ? chld : ch;
|
||||
// var widget = new (openerp.base.form.widgets.get_object(widget_type)) (this.view, ch_widgets[chld], board, child_index);
|
||||
// widget.start();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
@@ -77,17 +51,25 @@ openerp.base.form.Dashbar = openerp.base.form.Widget.extend({
|
||||
)
|
||||
for(var chld=0; chld < children.length;chld++) {
|
||||
var child = children[chld];
|
||||
var widget = new (openerp.base.form.widgets.get_object(child.tag)) (this.view, child);
|
||||
widget.start()
|
||||
$dashboard.find('#'+this.node.tag).append(
|
||||
jQuery('<div>',{
|
||||
'class': 'portlet'
|
||||
'class': 'portlet',
|
||||
'id': child.attrs.name
|
||||
}
|
||||
).append(
|
||||
jQuery('<div>',{
|
||||
'class': 'portlet-header'
|
||||
}).html(child.attrs.string),
|
||||
}).html(child.attrs.string).append(
|
||||
jQuery('<span>',{
|
||||
'class': 'ui-icon ui-icon-minusthick'
|
||||
})
|
||||
),
|
||||
jQuery('<div>',{
|
||||
'class': 'portlet-content'
|
||||
}).html('test')
|
||||
'class': 'portlet-content',
|
||||
'id': child.attrs.name+'-portlet-content'
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -99,7 +81,6 @@ openerp.base.form.Dashbar = openerp.base.form.Widget.extend({
|
||||
$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
|
||||
.find( ".portlet-header" )
|
||||
.addClass( "ui-widget-header ui-corner-all" )
|
||||
.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
|
||||
.end()
|
||||
.find( ".portlet-content" );
|
||||
|
||||
@@ -113,10 +94,8 @@ openerp.base.form.Dashbar = openerp.base.form.Widget.extend({
|
||||
})
|
||||
|
||||
openerp.base.form.Action = openerp.base.form.Widget.extend({
|
||||
init: function(view, node, board, child_index) {
|
||||
this._super(view, node, board, child_index);
|
||||
this.board = board;
|
||||
this.child_index = child_index;
|
||||
init: function(view, node) {
|
||||
this._super(view, node);
|
||||
},
|
||||
start: function() {
|
||||
this._super.apply(this, arguments);
|
||||
@@ -128,26 +107,14 @@ openerp.base.form.Action = openerp.base.form.Widget.extend({
|
||||
|
||||
on_load_action: function(result) {
|
||||
var action = result.action;
|
||||
|
||||
action.search_view = false;
|
||||
action.search_view = action.search_view_id = false;
|
||||
action.no_sidebar = true;
|
||||
action.search_view_id = false;
|
||||
|
||||
var node_attrs = this.node.attrs;
|
||||
var get_column = ['first', 'second', 'third'];
|
||||
var board_element = this.board.element.find('[id=column-'+get_column[this.child_index]+']');
|
||||
|
||||
this.board.addWidget({
|
||||
'id': node_attrs.name,
|
||||
'title': node_attrs.string,
|
||||
}, board_element);
|
||||
|
||||
var content_id = node_attrs.name+'-widgetcontent';
|
||||
this.board.getWidget(node_attrs.name).element.find('.widgetcontent').attr('id',content_id)
|
||||
|
||||
action_manager = new openerp.base.ActionManager(this.session, content_id);
|
||||
var content_id = jQuery('#'+node_attrs.name).find('.portlet-content').attr('id')
|
||||
var action_manager = new openerp.base.ActionManager(this.session, content_id);
|
||||
action_manager.start();
|
||||
this.board.getWidget(node_attrs.name).url = action_manager.do_action(action);
|
||||
action_manager.do_action(action);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user