Add breadcrumb as title of window form
issue7167 review343151002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add breadcrumb as title of window form
|
||||
* Manage help for each selection
|
||||
* Display revision on dialog
|
||||
* Support empty value for timedelta converter
|
||||
|
||||
+3
-2
@@ -870,8 +870,9 @@ var Sao = {};
|
||||
},
|
||||
add_title: function(title) {
|
||||
this.header.append(jQuery('<h4/>', {
|
||||
'class': 'modal-title'
|
||||
}).text(title));
|
||||
'class': 'modal-title',
|
||||
'title': title,
|
||||
}).text(Sao.common.ellipsize(title, 120)));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -783,6 +783,7 @@
|
||||
this.search_count = 0;
|
||||
this.screen_container = new Sao.ScreenContainer(
|
||||
attributes.tab_domain);
|
||||
this.breadcrumb = attributes.breadcrumb || [];
|
||||
|
||||
this.context_screen = null;
|
||||
if (attributes.context_model) {
|
||||
|
||||
+7
-5
@@ -450,6 +450,13 @@
|
||||
class_: 'tab-form',
|
||||
init: function(model_name, attributes) {
|
||||
Sao.Tab.Form._super.init.call(this, attributes);
|
||||
attributes = jQuery.extend({}, attributes);
|
||||
var name = attributes.name;
|
||||
if (!name) {
|
||||
name = Sao.common.MODELNAME.get(model_name);
|
||||
}
|
||||
this.set_name(name);
|
||||
attributes.breadcrumb = [name];
|
||||
var screen = new Sao.Screen(model_name, attributes);
|
||||
screen.tab = this;
|
||||
this.screen = screen;
|
||||
@@ -467,11 +474,6 @@
|
||||
|
||||
this.view_prm = this.screen.switch_view().done(function() {
|
||||
this.screen.count_tab_domain();
|
||||
var name = attributes.name;
|
||||
if (!name) {
|
||||
name = Sao.common.MODELNAME.get(model_name);
|
||||
}
|
||||
this.set_name(name);
|
||||
this.content.append(screen.screen_container.el);
|
||||
if (attributes.res_id) {
|
||||
if (!jQuery.isArray(attributes.res_id)) {
|
||||
|
||||
+19
-12
@@ -2315,6 +2315,10 @@ function eval_pyson(value){
|
||||
// Remove the first tree view as mode is form only
|
||||
view_ids.shift();
|
||||
}
|
||||
var model = this.get_model();
|
||||
var breadcrumb = jQuery.extend([], this.view.screen.breadcrumb);
|
||||
breadcrumb.push(
|
||||
this.attributes.string || Sao.common.MODELNAME.get(model));
|
||||
return new Sao.Screen(this.get_model(), {
|
||||
'context': context,
|
||||
'domain': domain,
|
||||
@@ -2323,6 +2327,7 @@ function eval_pyson(value){
|
||||
'views_preload': this.attributes.views,
|
||||
'readonly': this._readonly,
|
||||
exclude_field: this.attributes.relation_field,
|
||||
breadcrumb: breadcrumb,
|
||||
});
|
||||
},
|
||||
set_text: function(value) {
|
||||
@@ -2502,7 +2507,6 @@ function eval_pyson(value){
|
||||
screen.load([m2o_id]);
|
||||
win = new Sao.Window.Form(screen, callback.bind(this), {
|
||||
save_current: true,
|
||||
title: this.attributes.string
|
||||
});
|
||||
}.bind(this));
|
||||
return;
|
||||
@@ -2560,7 +2564,6 @@ function eval_pyson(value){
|
||||
var win = new Sao.Window.Form(screen, callback.bind(this), {
|
||||
new_: true,
|
||||
save_current: true,
|
||||
title: this.attributes.string,
|
||||
rec_name: rec_name
|
||||
});
|
||||
}.bind(this));
|
||||
@@ -3028,7 +3031,11 @@ function eval_pyson(value){
|
||||
this.el.append(this.content);
|
||||
|
||||
var modes = (attributes.mode || 'tree,form').split(',');
|
||||
this.screen = new Sao.Screen(attributes.relation, {
|
||||
var model = attributes.relation;
|
||||
var breadcrumb = jQuery.extend([], this.view.screen.breadcrumb);
|
||||
breadcrumb.push(
|
||||
attributes.string || Sao.common.MODELNAME.get(model));
|
||||
this.screen = new Sao.Screen(model, {
|
||||
mode: modes,
|
||||
view_ids: (attributes.view_ids || '').split(','),
|
||||
views_preload: attributes.views || {},
|
||||
@@ -3036,7 +3043,8 @@ function eval_pyson(value){
|
||||
row_activate: this.activate.bind(this),
|
||||
exclude_field: attributes.relation_field || null,
|
||||
limit: null,
|
||||
pre_validate: attributes.pre_validate
|
||||
pre_validate: attributes.pre_validate,
|
||||
breadcrumb: breadcrumb,
|
||||
});
|
||||
this.screen.pre_validate = attributes.pre_validate == 1;
|
||||
|
||||
@@ -3270,7 +3278,6 @@ function eval_pyson(value){
|
||||
var win = new Sao.Window.Form(this.screen, update_sequence, {
|
||||
new_: true,
|
||||
many: field_size,
|
||||
title: this.attributes.string
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -3378,8 +3385,7 @@ function eval_pyson(value){
|
||||
return this.validate().then(function() {
|
||||
var record = this.screen.current_record;
|
||||
if (record) {
|
||||
var win = new Sao.Window.Form(this.screen, function() {},
|
||||
{title: this.attributes.string});
|
||||
var win = new Sao.Window.Form(this.screen, function() {});
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
@@ -3497,7 +3503,9 @@ function eval_pyson(value){
|
||||
'class': this.class_ + '-content panel-body'
|
||||
});
|
||||
this.el.append(this.content);
|
||||
|
||||
var model = attributes.relation;
|
||||
var breadcrumb = jQuery.extend([], this.view.screen.breadcrumb);
|
||||
breadcrumb.push(attributes.string || Sao.common.MODELNAME.get(model));
|
||||
this.screen = new Sao.Screen(attributes.relation, {
|
||||
mode: ['tree'],
|
||||
view_ids: (attributes.view_ids || '').split(','),
|
||||
@@ -3505,7 +3513,8 @@ function eval_pyson(value){
|
||||
order: attributes.order,
|
||||
row_activate: this.activate.bind(this),
|
||||
readonly: true,
|
||||
limit: null
|
||||
limit: null,
|
||||
breadcrumb: breadcrumb,
|
||||
});
|
||||
this.screen.message_callback = this.record_label.bind(this);
|
||||
this.prm = this.screen.switch_view('tree').done(function() {
|
||||
@@ -3675,8 +3684,7 @@ function eval_pyson(value){
|
||||
}.bind(this);
|
||||
screen.switch_view().done(function() {
|
||||
screen.load([this.screen.current_record.id]);
|
||||
new Sao.Window.Form(screen, callback,
|
||||
{title: this.attributes.string});
|
||||
new Sao.Window.Form(screen, callback);
|
||||
}.bind(this));
|
||||
},
|
||||
new_: function() {
|
||||
@@ -3692,7 +3700,6 @@ function eval_pyson(value){
|
||||
new Sao.Window.Form(screen, callback, {
|
||||
'new_': true,
|
||||
'save_current': true,
|
||||
title: this.attributes.string,
|
||||
rec_name: this.entry.val()
|
||||
});
|
||||
}.bind(this));
|
||||
|
||||
+38
-25
@@ -94,30 +94,43 @@
|
||||
this.domain = kwargs.domain || null;
|
||||
this.context = kwargs.context || null;
|
||||
this.save_current = kwargs.save_current;
|
||||
var title_prm = jQuery.when(kwargs.title || '');
|
||||
title_prm = title_prm.then(function(title) {
|
||||
if (!title) {
|
||||
title = Sao.common.MODELNAME.get(this.screen.model_name);
|
||||
}
|
||||
this.title = title;
|
||||
var revision = this.screen.context._datetime;
|
||||
var label;
|
||||
if (revision &&
|
||||
Sao.common.MODELHISTORY.contains(this.screen.model_name)) {
|
||||
var date_format = Sao.common.date_format(
|
||||
this.screen.context.date_format);
|
||||
var time_format = '%H:%M:%S.%f';
|
||||
var revision_label = ' @ ' + Sao.common.format_datetime(
|
||||
date_format, time_format, revision);
|
||||
label = Sao.common.ellipsize(
|
||||
this.title, 80 - revision_label.length) +
|
||||
revision_label;
|
||||
title = this.title + revision_label;
|
||||
} else {
|
||||
label = Sao.common.ellipsize(this.title, 80);
|
||||
}
|
||||
return title;
|
||||
}.bind(this));
|
||||
var title_prm = jQuery.when(kwargs.title || '').then(
|
||||
function(title) {
|
||||
if (screen.breadcrumb.length) {
|
||||
var breadcrumb = jQuery.extend([], screen.breadcrumb);
|
||||
if (title) {
|
||||
breadcrumb.push(title);
|
||||
}
|
||||
this.title = breadcrumb.slice(-3, -1).map(function(x) {
|
||||
return Sao.common.ellipsize(x, 30);
|
||||
}).concat(breadcrumb.slice(-1)).join(' › ');
|
||||
if (breadcrumb.length > 3) {
|
||||
this.title = '... › ' + this.title;
|
||||
}
|
||||
} else {
|
||||
if (!title) {
|
||||
title = Sao.common.MODELNAME.get(this.screen.model_name);
|
||||
}
|
||||
this.title = title;
|
||||
}
|
||||
var revision = this.screen.context._datetime;
|
||||
var label;
|
||||
if (revision &&
|
||||
Sao.common.MODELHISTORY.contains(this.screen.model_name)) {
|
||||
var date_format = Sao.common.date_format(
|
||||
this.screen.context.date_format);
|
||||
var time_format = '%H:%M:%S.%f';
|
||||
var revision_label = ' @ ' + Sao.common.format_datetime(
|
||||
date_format, time_format, revision);
|
||||
label = Sao.common.ellipsize(
|
||||
this.title, 80 - revision_label.length) +
|
||||
revision_label;
|
||||
title = this.title + revision_label;
|
||||
} else {
|
||||
label = Sao.common.ellipsize(this.title, 80);
|
||||
}
|
||||
return label;
|
||||
}.bind(this));
|
||||
|
||||
this.prev_view = screen.current_view;
|
||||
this.screen.screen_container.alternate_view = true;
|
||||
@@ -713,6 +726,7 @@
|
||||
views_preload: views_preload,
|
||||
row_activate: this.activate.bind(this),
|
||||
readonly: true,
|
||||
breadcrumb: [this.title],
|
||||
});
|
||||
this.screen.load_next_view().done(function() {
|
||||
this.screen.switch_view().done(function() {
|
||||
@@ -775,7 +789,6 @@
|
||||
new Sao.Window.Form(screen, callback.bind(this), {
|
||||
new_: true,
|
||||
save_current: true,
|
||||
title: this.title
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user