Commit 1fc38e49 authored by Vincent Bechu's avatar Vincent Bechu

Header

parent 0d3ad7ac
......@@ -92,6 +92,7 @@
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")
.declareAcquiredMethod("triggerPanel", "triggerPanel")
.declareAcquiredMethod("triggerMaximize", "triggerMaximize")
/////////////////////////////////////////////////////////////////
// declared methods
......@@ -130,6 +131,12 @@
modified: true
});
})
.declareMethod('setButtonTitle', function (options) {
return this.changeState({
title_button_icon: options.icon,
title_button_name: options.action
});
})
/*
.declareMethod('notifyUpdate', function () {
return this.render(this.stats.options);
......@@ -227,6 +234,7 @@
default_title_icon = "",
default_right_icon = "",
title_link,
title_button,
promise_list = [];
// Main title
if (modification_dict.hasOwnProperty('error') ||
......@@ -234,7 +242,8 @@
modification_dict.hasOwnProperty('submitted') ||
modification_dict.hasOwnProperty('title_text') ||
modification_dict.hasOwnProperty('title_icon') ||
modification_dict.hasOwnProperty('title_url')) {
modification_dict.hasOwnProperty('title_url') ||
modification_dict.hasOwnProperty('title_button_name')) {
if (gadget.state.error) {
default_title_icon = "exclamation";
} else if (!gadget.state.loaded) {
......@@ -249,7 +258,14 @@
icon: default_title_icon || gadget.state.title_icon,
url: gadget.state.title_url
};
if (title_link.url === undefined) {
if (gadget.state.title_button_name) {
title_button = {
title: gadget.state.title_text,
icon: gadget.state.title_button_icon,
name: gadget.state.title_button_name
};
promise_list.push(gadget.translateHtml(header_button_template(title_button)));
} else if (title_link.url === undefined) {
promise_list.push(gadget.translateHtml(header_title_template(title_link)));
} else {
promise_list.push(gadget.translateHtml(header_title_link_template(title_link)));
......@@ -352,6 +368,9 @@
if (name === "submit") {
return this.triggerSubmit();
}
if (name === "maximize") {
return this.triggerMaximize();
}
throw new Error("Unsupported button " + name);
});
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.19028.47293.9045</string> </value>
<value> <string>963.64055.11832.51507</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1502270945.98</float>
<float>1512664162.38</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment