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

Header

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