[IMP] Improved menu link dialog

bzr revid: fme@openerp.com-20131104113412-q5d8263741pq9wna
This commit is contained in:
Fabien Meghazi 2013-11-04 12:34:12 +01:00
parent cf58fd485b
commit f880400e43
3 changed files with 18 additions and 1 deletions

View File

@ -821,6 +821,7 @@
if (!val || !$e[0].checkValidity()) {
// FIXME: error message
$e.closest('.form-group').addClass('has-error');
$e.focus();
return;
}

View File

@ -143,8 +143,24 @@
if (self.data) {
self.bind_data(self.data.name, self.data.url, self.data.new_window);
}
var $link_text = self.$('#link-text').focus();
self.$('#link-existing').change(function () {
if (!$link_text.val()) {
$link_text.val($(this).find('option:selected').text());
$link_text.focus();
}
});
});
},
save: function () {
var $e = this.$('#link-text');
if (!$e.val() || !$e[0].checkValidity()) {
$e.closest('.form-group').addClass('has-error');
$e.focus();
return;
}
return this._super.apply(this, arguments);
},
make_link: function (url, new_window, label) {
var menu_label = this.$('input#link-text').val() || label;
if (this.data) {

View File

@ -51,7 +51,7 @@
</label>
</h3>
<input type="text" class="form-control"
id="link-text" autofocus="autofocus"/>
id="link-text" required="required"/>
</div>
</div>
</t>