Commit 4712b3ac authored by Hardik Juneja's avatar Hardik Juneja Committed by Cédric Le Ninivin

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

parent e5dbbbca
......@@ -14,17 +14,15 @@
<form class="view-web-page-form">
<div class="center">
<div class="ui-field-contain">
<div class="center">
<div class="ui-field-contain">
<label data-i18n="Title:">Title:</label>
<input type="text" name="title" value="{{title}}">
</div>
<button type="submit" data-i18n="Save" style="display:none;">Save</button>
</div>
<div class="ui-field-contain">
    <fieldset data-role="collapsible">
         <legend>Extra Properties</legend>
<div class="ui-field-contain">
<label data-i18n="Reference:">Reference:</label>
......@@ -46,8 +44,8 @@
<textarea name="description">{{description}}</textarea>
</div>
</div>
</div>
</fieldset>
<div class='document-content'></div>
</div>
......
......@@ -218,7 +218,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>
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.58608.59350.33075</string> </value>
<value> <string>954.38520.8745.1109</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +250,7 @@
</tuple>
<state>
<tuple>
<float>1442858061.15</float>
<float>1476433509.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -21,6 +21,28 @@
</3>
</section>
</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">
<section class="ui-content-header-plain">
......@@ -52,27 +74,5 @@
<!--/div-->
</section>
</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>
</html>
\ No newline at end of file
......@@ -220,7 +220,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>
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.12629.17894.55808</string> </value>
<value> <string>954.38531.13446.10769</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1448032104.14</float>
<float>1476434371.85</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -25,6 +25,9 @@
})
.push(function () {
return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
});
}
......
......@@ -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>947.12629.17894.55808</string> </value>
<value> <string>954.38525.9614.27067</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1447936126.33</float>
<float>1476437867.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -60,6 +60,9 @@
})
.push(function () {
return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
});
}
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.53845.25131.55500</string> </value>
<value> <string>954.38524.51199.12134</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1450259852.52</float>
<float>1476437846.74</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -30,7 +30,7 @@
<div class="ui-form">
<div class="ui-field-contain">
<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 class="select-storage ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-b ui-responsive">
......@@ -56,7 +56,7 @@
<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>
<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>
......
......@@ -259,7 +259,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>
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>951.60950.25016.15394</string> </value>
<value> <string>954.38565.29657.34116</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1466162879.59</float>
<float>1476436854.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -59,6 +59,9 @@
})
.push(function () {
return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
});
}
......@@ -163,6 +166,7 @@
erp5_url_input.value = erp5_url || "https://www.example.org";
erp5_url_input.removeAttribute("disabled");
erp5_url_input.parentNode.classList.remove('ui-state-disabled');
erp5_url_input.focus();
});
});
......
......@@ -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.61016.16868.60825</string> </value>
<value> <string>954.38591.30253.42973</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1466159556.89</float>
<float>1476438691.35</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,9 +9,24 @@
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
.ready(function (g) {
g.props = {};
g.props.auto_repair = false;
return g.getElement()
.push(function (element) {
g.props.element = element;
......@@ -22,6 +37,11 @@
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareMethod("render", function () {
var gadget = this;
if (arguments[0].auto_repair === "true") {
gadget.props.auto_repair = true;
}
return gadget.updateHeader({
title: "Synchronize"
})
......@@ -39,6 +59,10 @@
.declareService(function () {
var gadget = this;
if (gadget.props.auto_repair === true) {
return repair_and_redirect(gadget);
}
return new RSVP.Queue()
.push(function () {
return promiseEventListener(
......@@ -48,16 +72,7 @@
);
})
.push(function () {
gadget.props.element.querySelector("button")
.disabled = true;
return gadget.repair();
})
.push(function (result) {
if (result !== undefined && result.hasOwnProperty('redirect')){
return gadget.redirect(result.redirect);
}
return gadget.redirect({});
return repair_and_redirect(gadget);
});
});
......
......@@ -214,7 +214,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>
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.58607.65382.65228</string> </value>
<value> <string>954.38795.35440.52684</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1442858160.45</float>
<float>1476450033.82</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