Commit 924411f0 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs][erp5_officejs_ui_test] Add maximize in text editor

/reviewed-on nexedi/erp5!544
parent a5aec50a
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc
editable: options.editable ? 1 : 0
}); });
}) })
...@@ -51,7 +50,6 @@ ...@@ -51,7 +50,6 @@
var gadget = this; var gadget = this;
return gadget.getDeclaredGadget('form_view') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -61,9 +59,9 @@ ...@@ -61,9 +59,9 @@
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -72,9 +70,9 @@ ...@@ -72,9 +70,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -83,9 +81,9 @@ ...@@ -83,9 +81,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -94,9 +92,9 @@ ...@@ -94,9 +92,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -105,21 +103,22 @@ ...@@ -105,21 +103,22 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": gadget.state.doc.text_content, "default": gadget.state.doc.text_content,
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "renderjs_extra": '{"editor": "fck_editor", "maximize": true}',
"url": "../officejs_ckeditor_gadget/app/", "type": "GadgetField",
"sandbox": "iframe" "url": "gadget_editor.html",
"sandbox": "public"
} }
}}, }},
"_links": { "_links": {
...@@ -144,22 +143,17 @@ ...@@ -144,22 +143,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
save_action: true,
selection_url: url_list[0], selection_url: url_list[0],
save_action: true previous_url: url_list[1],
}; next_url: url_list[2]
if (!gadget.state.editable) { });
header_dict.previous_url = url_list[1];
header_dict.next_url = url_list[2];
header_dict.edit_content = url_list[3];
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP));
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.37368.2625.44083</string> </value> <value> <string>964.45581.43675.37307</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507276723.18</float> <float>1515490519.85</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"Text Editor": { "Text Editor": {
"url": "officejs_text_editor/", "url": "officejs_text_editor/",
"cache": "gadget_officejs_text_editor.appcache", "cache": "gadget_officejs_text_editor.appcache",
"sub_gadget": ["officejs_ckeditor_gadget", "officejs_setting_gadget"] "sub_gadget": ["officejs_setting_gadget"]
}, },
"Illustration Editor": { "Illustration Editor": {
"url": "officejs_svg_editor/", "url": "officejs_svg_editor/",
......
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.47833.26373.64597</string> </value> <value> <string>964.45862.32132.53930</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1511961491.29</float> <float>1515504420.29</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -391,7 +391,9 @@ ...@@ -391,7 +391,9 @@
</item> </item>
<item> <item>
<key> <string>configuration_stylesheet_url</string> </key> <key> <string>configuration_stylesheet_url</string> </key>
<value> <string>gadget_officejs_nojqm.css</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>configuration_translation_gadget_url</string> </key> <key> <string>configuration_translation_gadget_url</string> </key>
...@@ -650,7 +652,7 @@ ...@@ -650,7 +652,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>
...@@ -664,7 +666,7 @@ ...@@ -664,7 +666,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.16277.24517.44253</string> </value> <value> <string>964.45575.40638.63488</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -682,7 +684,7 @@ ...@@ -682,7 +684,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504529296.63</float> <float>1515487277.43</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -88,37 +88,37 @@ ...@@ -88,37 +88,37 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//button[@data-i18n='Save']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Menu']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>waitForElementPresent</td>
<td>name=editable</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -236,16 +236,6 @@ ...@@ -236,16 +236,6 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>identifier=cke_1_contents</td> <td>identifier=cke_1_contents</td>
......
...@@ -77,16 +77,6 @@ ...@@ -77,16 +77,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>identifier=title</td> <td>identifier=title</td>
...@@ -153,16 +143,6 @@ ...@@ -153,16 +143,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td>search</td> <td>search</td>
......
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