[FIX] website: edit menu not showing url & mailto prefix with '/'
Before this commit: 1. you could not edit a menu URL because the input was hidden. This was due to radio options being switched (new page is now selected choice) when you create a menu. But when you edit, there is no choice and the input should be shown. 2. if you set a menu url to an email address, the display link would be prefixed by a / and so it would open mysite.com/mailto:XXX instead of just the mailto Now: 1. Input is now hidden only when you add a new menu, not when editing a menu. 2. mailto link now works as expected: it will open your desktop mail software
This commit is contained in:
@@ -714,8 +714,9 @@ class Menu(models.Model):
|
||||
else:
|
||||
url = self.url
|
||||
if not self.url.startswith('/'):
|
||||
if '@' in self.url and not self.url.startswith('mailto'):
|
||||
url = 'mailto:%s' % self.url
|
||||
if '@' in self.url:
|
||||
if not self.url.startswith('mailto'):
|
||||
url = 'mailto:%s' % self.url
|
||||
elif not self.url.startswith('http'):
|
||||
url = '/%s' % self.url
|
||||
return url
|
||||
|
||||
@@ -261,11 +261,11 @@ var MenuEntryDialog = widget.LinkDialog.extend({
|
||||
*/
|
||||
start: function () {
|
||||
var self = this;
|
||||
self.$('#o_link_dialog_url_input').closest('.form-group').hide();
|
||||
this.$('.o_link_dialog_preview').remove();
|
||||
this.$('.window-new, .link-style').closest('.form-group').remove();
|
||||
this.$('label[for="o_link_dialog_label_input"]').text(_t("Menu Label"));
|
||||
if (this.menu_link_options) { // add menu link option only when adding new menu
|
||||
self.$('#o_link_dialog_url_input').closest('.form-group').hide();
|
||||
this.$('#o_link_dialog_label_input').closest('.form-group').after(qweb.render('website.contentMenu.dialog.edit.link_menu_options'));
|
||||
// remove the label that is automatically added before
|
||||
this.$('#o_link_dialog_url_input').parent().siblings().html('');
|
||||
|
||||
Reference in New Issue
Block a user