Use screen view to name tab when the name is not specified

review16261002
This commit is contained in:
Nicolas Évrard committed 2015-05-15 13:53:07 +02:00
1 parent 360aa8461d
commit 2be4efc6cf
2 files changed
+14 -6

No files matched your search

+5
View File
@@ -653,6 +653,11 @@
}
this.model.add_fields(fields);
var view_widget = Sao.View.parse(this, xml_view, view.field_childs);
// This call to set_name is in screen.js instead than in tab.js in
// order to prevent using a callback in the Tab code
if (jQuery.isEmptyObject(this.views) && (this.tab !== null)) {
this.tab.set_name(view_widget.attributes.string || '');
}
this.views.push(view_widget);
return view_widget;
+9 -6
View File
@@ -8,6 +8,7 @@
Sao.Tab.tabs.push(this);
this.buttons = {};
this.id = 'tab-' + Sao.Tab.counter++;
this.name_el = jQuery('<span/>');
},
create_tabcontent: function() {
this.el = jQuery('<div/>', {
@@ -111,6 +112,9 @@
},
_close_allowed: function() {
return jQuery.when();
},
set_name: function(name) {
this.name_el.text(name);
}
});
@@ -181,7 +185,7 @@
}).append('Close')).click(function() {
tab.close();
}))
.append(tab.name);
.append(tab.name_el);
jQuery('<li/>', {
'role': 'presentation',
id: 'nav-' + tab.id
@@ -204,7 +208,6 @@
screen.tab = this;
this.screen = screen;
this.attributes = jQuery.extend({}, attributes);
this.name = attributes.name; // XXX use screen current view title
if (!Sao.common.MODELHISTORY.contains(model_name)) {
this.menu_def = jQuery.extend([], this.menu_def);
@@ -578,9 +581,9 @@
var time_format = '%H:%M:%S.%f';
revision = Sao.common.format_datetime(date_format, time_format,
revision);
label = this.name + ' @ '+ revision;
label = this.name_el.text() + ' @ '+ revision;
} else {
label = this.name;
label = this.name_el.text();
}
this.title.html(label);
['new', 'save'].forEach(function(button) {
@@ -628,10 +631,10 @@
init: function(wizard) {
Sao.Tab.Wizard._super.init.call(this);
this.wizard = wizard;
this.name = wizard.name;
this.set_name(wizard.name);
wizard.tab = this;
this.create_tabcontent();
this.title.html(this.name);
this.title.html(this.name_el.text());
this.el.append(wizard.form);
},
create_toolbar: function() {