Commit a05cbc57 authored by Hardik Juneja's avatar Hardik Juneja

erp5_officejs: Add auto sync functionality and move document list dialog upwards [UX changes]

parent 43435f58
...@@ -14,17 +14,15 @@ ...@@ -14,17 +14,15 @@
<form class="view-web-page-form"> <form class="view-web-page-form">
<div class="center"> <div class="center">
<div class="ui-field-contain"> <div class="ui-field-contain">
<label data-i18n="Title:">Title:</label> <label data-i18n="Title:">Title:</label>
<input type="text" name="title" value="{{title}}"> <input type="text" name="title" value="{{title}}">
</div> </div>
<button type="submit" data-i18n="Save" style="display:none;">Save</button> <button type="submit" data-i18n="Save" style="display:none;">Save</button>
</div>
<div class="ui-field-contain"> <div class="ui-field-contain">
    <fieldset data-role="collapsible">
         <legend>Extra Properties</legend>
<div class="ui-field-contain"> <div class="ui-field-contain">
<label data-i18n="Reference:">Reference:</label> <label data-i18n="Reference:">Reference:</label>
...@@ -46,8 +44,8 @@ ...@@ -46,8 +44,8 @@
<textarea name="description">{{description}}</textarea> <textarea name="description">{{description}}</textarea>
</div> </div>
</div> </div>
</div>
</fieldset>
<div class='document-content'></div> <div class='document-content'></div>
</div> </div>
......
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.58608.59350.33075</string> </value> <value> <string>954.38520.8745.1109</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>1442858061.15</float> <float>1476433509.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -21,6 +21,28 @@ ...@@ -21,6 +21,28 @@
</3> </3>
</section> </section>
</article> </article>
<article class="ui-content ui-body-c document-access">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">
<span class="ui-icon ui-icon-custom ui-icon-file-text-o">&nbsp;</span>
Your Documents
</h3>
</section>
<section class="ui-body-c ui-content-section">
<p style="color: red">Continue by <b>synchronizing</b> with your remote storage or <b>accessing</b> your documents</p>
<div class="ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<a class="ui-btn" href="#page=sync&auto_repair=true" data-i18n="Synchronize">Synchronize</a>
</div>
<div class="ui-block-b">
<a class="ui-btn" href="#page=document_list" data-i18n="Go to document List">Access document List</a>
</div>
</div>
</div>
</section>
</article>
<article class="ui-content ui-body-c"> <article class="ui-content ui-body-c">
<section class="ui-content-header-plain"> <section class="ui-content-header-plain">
...@@ -52,27 +74,5 @@ ...@@ -52,27 +74,5 @@
<!--/div--> <!--/div-->
</section> </section>
</article> </article>
<article class="ui-content ui-body-c document-access">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">
<span class="ui-icon ui-icon-custom ui-icon-file-text-o">&nbsp;</span>
Your Documents
</h3>
</section>
<section class="ui-body-c ui-content-section">
<p style="color: red">Continue by <b>synchronizing</b> with your remote storage or <b>accessing</b> your documents</p>
<div class="ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<a class="ui-btn" href="#page=sync" data-i18n="Synchronize">Synchronize</a>
</div>
<div class="ui-block-b">
<a class="ui-btn" href="#page=document_list" data-i18n="Go to document List">Access document List</a>
</div>
</div>
</div>
</section>
</article>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>947.12629.17894.55808</string> </value> <value> <string>954.38531.13446.10769</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1448032104.14</float> <float>1476434371.85</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
}) })
.push(function () { .push(function () {
return gadget.reload(); return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
}); });
} }
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</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>947.12629.17894.55808</string> </value> <value> <string>954.38525.9614.27067</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>1447936126.33</float> <float>1476437867.08</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
}) })
.push(function () { .push(function () {
return gadget.reload(); return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
}); });
} }
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>947.53845.25131.55500</string> </value> <value> <string>954.38524.51199.12134</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1450259852.52</float> <float>1476437846.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div class="ui-form"> <div class="ui-form">
<div class="ui-field-contain"> <div class="ui-field-contain">
<label data-i18n="Connection URL:">Connection URL:</label> <label data-i18n="Connection URL:">Connection URL:</label>
<input type="url" name="erp5_url" required disabled/> <input type="url" name="erp5_url" class="ui-focus" required disabled/>
</div> </div>
<div class="select-storage ui-controlgroup ui-controlgroup-horizontal"> <div class="select-storage ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-b ui-responsive"> <div class="ui-grid-b ui-responsive">
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="ui-controlgroup ui-controlgroup-horizontal"> <div class="ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-a ui-responsive"> <div class="ui-grid-a ui-responsive">
<div class="ui-block-a"> <div class="ui-block-a">
<a class="ui-btn" href="#page=sync" data-i18n="Synchronize">Synchronize</a> <a class="ui-btn" href="#page=sync&auto_repair=true" data-i18n="Synchronize">Synchronize</a>
</div> </div>
<div class="ui-block-b"> <div class="ui-block-b">
<a class="ui-btn" href="#page=document_list" data-i18n="Go to document List">Access document List</a> <a class="ui-btn" href="#page=document_list" data-i18n="Go to document List">Access document List</a>
......
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.60950.25016.15394</string> </value> <value> <string>954.38565.29657.34116</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1466162879.59</float> <float>1476436854.76</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
}) })
.push(function () { .push(function () {
return gadget.reload(); return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
}); });
} }
...@@ -163,6 +166,7 @@ ...@@ -163,6 +166,7 @@
erp5_url_input.value = erp5_url || "https://www.example.org"; erp5_url_input.value = erp5_url || "https://www.example.org";
erp5_url_input.removeAttribute("disabled"); erp5_url_input.removeAttribute("disabled");
erp5_url_input.parentNode.classList.remove('ui-state-disabled'); erp5_url_input.parentNode.classList.remove('ui-state-disabled');
erp5_url_input.focus();
}); });
}); });
......
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.61016.16868.60825</string> </value> <value> <string>954.38591.30253.42973</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1466159556.89</float> <float>1476438691.35</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -9,9 +9,24 @@ ...@@ -9,9 +9,24 @@
templater.getElementById("page-template").innerHTML templater.getElementById("page-template").innerHTML
); );
function repair_and_redirect(gadget) {
gadget.props.element.querySelector("button").disabled = true;
return new RSVP.Queue()
.push(function () {
return gadget.repair()
})
.push(function (result) {
if (result !== undefined && result.hasOwnProperty('redirect')){
return gadget.redirect(result.redirect);
}
return gadget.redirect({});
});
}
gadget_klass gadget_klass
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
g.props.auto_repair = false;
return g.getElement() return g.getElement()
.push(function (element) { .push(function (element) {
g.props.element = element; g.props.element = element;
...@@ -22,6 +37,11 @@ ...@@ -22,6 +37,11 @@
.declareAcquiredMethod("translateHtml", "translateHtml") .declareAcquiredMethod("translateHtml", "translateHtml")
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
if (arguments[0].auto_repair === "true") {
gadget.props.auto_repair = true;
}
return gadget.updateHeader({ return gadget.updateHeader({
title: "Synchronize" title: "Synchronize"
}) })
...@@ -39,6 +59,10 @@ ...@@ -39,6 +59,10 @@
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this;
if (gadget.props.auto_repair === true) {
return repair_and_redirect(gadget);
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return promiseEventListener( return promiseEventListener(
...@@ -48,16 +72,7 @@ ...@@ -48,16 +72,7 @@
); );
}) })
.push(function () { .push(function () {
gadget.props.element.querySelector("button") return repair_and_redirect(gadget);
.disabled = true;
return gadget.repair();
})
.push(function (result) {
if (result !== undefined && result.hasOwnProperty('redirect')){
return gadget.redirect(result.redirect);
}
return gadget.redirect({});
}); });
}); });
......
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.58607.65382.65228</string> </value> <value> <string>954.38795.35440.52684</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442858160.45</float> <float>1476450033.82</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