Commit 8d00b49a authored by Vincent Bechu's avatar Vincent Bechu Committed by Cédric Le Ninivin

erp5_officejs: delete logout from menu and add maximize button in header

/reviewed-on nexedi/erp5!167
parent 9fc4ddfd
......@@ -15,7 +15,9 @@
g.props.ckeditor = CKEDITOR.replace(
textarea,
{
removeButtons: 'NewPage,Preview',
removeButtons: 'NewPage,Preview,Cut,Paste,Copy,PasteText,' +
'PasteFromWord,Flash,Iframe,Form,Checkbox,Radio,TextField,' +
'Textarea,Select,Button,ImageButton,HiddenField,Maximize',
removePlugins: '',
disableNativeSpellChecker: false,
extraAllowedContent: "details section article"
......@@ -32,13 +34,12 @@
command: 'saveRJS',
toolbar: 'document,1'
});
g.props.ckeditor.on('maximize', function () {
return g.maximize();
g.props.ckeditor.on('instanceReady', function (event) {
event.editor.execCommand('maximize');
});
});
})
.declareAcquiredMethod("submitContent", "triggerSubmit")
.declareAcquiredMethod("maximize", "triggerMaximize")
.declareMethod('render', function (options) {
this.props.key = options.key || "text_content";
this.props.ckeditor.setData(options.value || "");
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.31859.27287.17783</string> </value>
<value> <string>954.4005.3918.16742</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1452872881.96</float>
<float>1474449146.05</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -38,7 +38,6 @@
<li><a href="#page=document_list" data-i18n="Document List">Document List</a></li>
<li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li>
<li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li>
<li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>
</ul>
</div>
</script>
......
......@@ -255,7 +255,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.28216.64976.63368</string> </value>
<value> <string>954.2922.61218.8379</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1464191586.4</float>
<float>1474450659.36</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -152,6 +152,7 @@
left_button,
right_link,
right_button,
maximize_button,
default_right_text,
default_right_icon = "",
title_link = {},
......@@ -257,6 +258,26 @@
promise_list.push(gadget.translateHtml(""));
}
// handle maximize button
if (options.hasOwnProperty('maximize_action')) {
if (!options.maximized) {
maximize_button = {
title: "Maximize",
icon: "expand",
name: "maximize"
};
} else {
maximize_button = {
title: "Minimize",
icon: "compress",
name: "maximize"
};
}
promise_list.push(gadget.translateHtml(header_button_template(maximize_button)));
} else {
promise_list.push(gadget.translateHtml(""));
}
return new RSVP.Queue()
.push(function () {
return RSVP.all(promise_list);
......@@ -264,7 +285,8 @@
.push(function (my_translated_html_list) {
gadget.props.title_element.innerHTML = my_translated_html_list[0];
gadget.props.left_link.innerHTML = my_translated_html_list[1];
gadget.props.right_link.innerHTML = my_translated_html_list[2];
gadget.props.right_link.innerHTML = my_translated_html_list[3]
+ my_translated_html_list[2];
});
})
......@@ -283,6 +305,14 @@
if (name === "submit") {
return form_gadget.triggerSubmit();
}
if (name === "maximize") {
form_gadget.stats.options.maximized =
!form_gadget.stats.options.maximized;
return form_gadget.triggerSubmit("maximize")
.push(function () {
return form_gadget.render(form_gadget.stats.options);
});
}
throw new Error("Unsupported button " + name);
}
......
......@@ -210,7 +210,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -224,7 +224,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.58607.14824.6775</string> </value>
<value> <string>954.15931.48097.6604</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -242,7 +242,7 @@
</tuple>
<state>
<tuple>
<float>1442857960.12</float>
<float>1475164833.83</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -71,22 +71,25 @@
.declareAcquiredMethod('allDocs', 'jio_allDocs')
.declareAcquiredMethod("redirect", "redirect")
.allowPublicAcquisition('triggerMaximize', function () {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
})
.fail(function (e) {
console.log(e);
});
})
.allowPublicAcquisition('triggerSubmit', function () {
.allowPublicAcquisition('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
});
}
return this.props.element.querySelector('button').click();
})
.declareMethod('triggerSubmit', function () {
.declareMethod('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
});
}
return this.props.element.querySelector('button').click();
})
......@@ -102,7 +105,9 @@
gadget.props.element.innerHTML = html;
return gadget.updateHeader({
title: options.doc.title + " | Web Illustration",
save_action: true
save_action: true,
maximize_action: true,
maximized: options.doc.title !== ""
});
})
.push(function () {
......@@ -114,8 +119,7 @@
// Render text content gadget
/////////////////////////////////////////
.declareService(function () {
var gadget = this,
text_gadget = null;
var gadget = this;
return new RSVP.Queue()
.push(function () {
......@@ -137,15 +141,17 @@
'style',
'width:100%; border: 0 none; height: 600px'
);
text_gadget = text_content_gadget;
return text_content_gadget.render({
"key": 'text_content',
"value": gadget.options.doc.text_content
});
})
.push(function () {
return text_gadget.getElement();
}, function (error) {
if (gadget.options.doc.title !== "") {
return gadget.triggerSubmit("maximize");
}
})
.push(undefined, function (error) {
var display_error_element;
if (error === "Timed out after 5000 ms") {
display_error_element =
......
......@@ -255,7 +255,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -269,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.45471.29918.56183</string> </value>
<value> <string>954.15924.25382.7799</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1465463607.76</float>
<float>1475164165.45</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -72,22 +72,25 @@
.declareAcquiredMethod('allDocs', 'jio_allDocs')
.declareAcquiredMethod("redirect", "redirect")
.allowPublicAcquisition('triggerMaximize', function () {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
})
.fail(function (e) {
console.log(e);
});
})
.allowPublicAcquisition('triggerSubmit', function () {
.allowPublicAcquisition('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
});
}
return this.props.element.querySelector('button').click();
})
.declareMethod('triggerSubmit', function () {
.declareMethod('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
});
}
return this.props.element.querySelector('button').click();
})
......@@ -103,7 +106,9 @@
gadget.props.element.innerHTML = html;
return gadget.updateHeader({
title: options.doc.title + " | Web Page",
save_action: true
save_action: true,
maximize_action: true,
maximized: gadget.options.doc.title !== ""
});
})
.push(function () {
......@@ -115,8 +120,7 @@
// Render text content gadget
/////////////////////////////////////////
.declareService(function () {
var gadget = this,
text_gadget = null;
var gadget = this;
return new RSVP.Queue()
.push(function () {
......@@ -138,15 +142,17 @@
'style',
'width:100%; border: 0 none; height: 600px'
);
text_gadget = text_content_gadget;
return text_content_gadget.render({
"key": 'text_content',
"value": gadget.options.doc.text_content
});
})
.push(function () {
return text_gadget.getElement();
}, function (error) {
if (gadget.options.doc.title !== "") {
return gadget.triggerSubmit("maximize");
}
})
.push(undefined, function (error) {
var display_error_element;
if (error === "Timed out after 5000 ms") {
display_error_element =
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.59099.34897.19985</string> </value>
<value> <string>954.15935.39380.57002</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1446740911.15</float>
<float>1475164868.59</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