Skip to content
Snippets Groups Projects
Commit d38ae96b authored by Arnaud Levy's avatar Arnaud Levy
Browse files

title if empty

parent d41c6f00
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,20 @@ window.osuny.communication.menuItems = {
this.kinds = document.querySelectorAll('[data-kind]');
this.url = document.querySelector('.communication_website_menu_item_url');
this.switchUrl = this.kindInput.dataset.url;
this.about = document.querySelector('#communication_website_menu_item_about_id');
this.title = document.querySelector('#communication_website_menu_item_title');
for (i = 0; i < this.kinds.length; i += 1) {
kind = this.kinds[i];
kind.addEventListener('click', this.onKindChange.bind(this));
}
this.about.addEventListener('change', this.onAboutChange.bind(this));
this.chooseKind(this.kindInput.value);
},
onKindChange: function (event) {
'use strict';
var target = event.target,
// Not working on IE, FIXME
div = target.closest('[data-kind]'),
kind = div.dataset.kind;
this.chooseKind(kind);
......@@ -50,6 +54,15 @@ window.osuny.communication.menuItems = {
});
},
onAboutChange: function () {
'use strict';
var option = this.about.options[this.about.selectedIndex],
name = option.text;
if (this.title.value === '') {
this.title.value = name.trim();
}
},
invoke: function () {
'use strict';
return {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment