summaryrefslogtreecommitdiff
path: root/addons/pad/static/src
diff options
context:
space:
mode:
authorPurnendu Singh (OpenERP) <psi@tinyerp.com>2012-08-06 11:41:13 +0530
committerPurnendu Singh (OpenERP) <psi@tinyerp.com>2012-08-06 11:41:13 +0530
commit2bbdc47dc8d791cd502c8fc37ec9a5273ee10292 (patch)
treebc8dbba2cad6cc3eb2d9b343b1552d53698b6987 /addons/pad/static/src
parentd72386f18fff4abc3e7dcd2b9223a25028375a19 (diff)
parent0d2d7ee5855ecbd463ccc6fd902f3af54c504410 (diff)
[MERGE] merge with main addons
bzr revid: psi@tinyerp.com-20120806061113-1ck1nrda2sdq06im
Diffstat (limited to 'addons/pad/static/src')
-rw-r--r--addons/pad/static/src/css/etherpad.css70
-rw-r--r--addons/pad/static/src/js/pad.js44
-rw-r--r--addons/pad/static/src/xml/pad.xml13
3 files changed, 116 insertions, 11 deletions
diff --git a/addons/pad/static/src/css/etherpad.css b/addons/pad/static/src/css/etherpad.css
new file mode 100644
index 00000000000..a0240afcab7
--- /dev/null
+++ b/addons/pad/static/src/css/etherpad.css
@@ -0,0 +1,70 @@
+.oe_etherpad_head{
+ width: 100%;
+ display: block;
+ padding-left:3px;
+ cursor:pointer;
+}
+.oe_etherpad_fullscreen div.oe_etherpad_head .oe_normal {
+ display: none;
+}
+.oe_etherpad_normal div.oe_etherpad_head .oe_fullscreen {
+ display: none;
+}
+.oe_etherpad_fullscreen {
+ position: fixed;
+ top: 0px;
+ left: 0px;
+ width: 100%;
+ height: 100%;
+ background-color: white;
+ z-index:10001 !important;
+}
+.etherpad_default{
+ width: 100%;
+ height: 450px;
+}
+.oe_etherpad_fullscreen .etherpad_default{
+ height: 100%
+}
+
+.etherpad_body{
+ overflow:hidden;
+}
+
+.etherpad_readonly{
+ width: 100%;
+ height: 450px;
+ overflow:auto;
+}
+.etherpad_readonly ul,.etherpad_readonly ol{
+ -webkit-margin-before: 1em;
+ -webkit-margin-after: 1em;
+ -webkit-margin-start: 0px;
+ -webkit-margin-end: 0px;
+ -webkit-padding-start: 40px !important;
+}
+.etherpad_readonly ul li{
+ list-style-type: disc;
+}
+.etherpad_readonly ol li{
+ list-style-type: decimal;
+}
+.etherpad_readonly .indent li{
+ list-style-type: none !important;
+}
+
+.etherpad_readonly{
+ font-family: arial, sans-serif;
+ font-size: 13px;
+ line-height: 17px;
+}
+
+.etherpad_readonly ul.indent { list-style-type: none !important; }
+.etherpad_readonly ol li{ list-style-type: decimal !important; }
+.etherpad_readonly ol ol li{ list-style-type: lower-latin !important; }
+.etherpad_readonly ol ol ol li{ list-style-type: lower-roman !important; }
+.etherpad_readonly ol ol ol ol li{ list-style-type: decimal !important; }
+.etherpad_readonly ol ol ol ol ol li{ list-style-type: lower-latin !important; }
+.etherpad_readonly ol ol ol ol ol ol li{ list-style-type: lower-roman !important; }
+.etherpad_readonly ol ol ol ol ol ol ol li{ list-style-type: decimal !important; }
+.etherpad_readonly ol ol ol ol ol ol ol ol li{ list-style-type: lower-latin !important; }
diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js
index 2e5f8820ac4..6384eb72da8 100644
--- a/addons/pad/static/src/js/pad.js
+++ b/addons/pad/static/src/js/pad.js
@@ -1,18 +1,40 @@
openerp.pad = function(instance) {
-instance.web.Sidebar = instance.web.Sidebar.extend({
- init: function(parent) {
- this._super(parent);
- this.add_items('other',[{ label: "Pad", callback: this.on_add_pad }]);
- },
- on_add_pad: function() {
+instance.web.form.FieldPad = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
+ template: 'FieldPad',
+ initialize_content: function() {
var self = this;
- var view = this.getParent();
- var model = new instance.web.Model('ir.attachment');
- model.call('pad_get', [view.model ,view.datarecord.id],{}).then(function(r) {
- self.do_action({ type: "ir.actions.act_url", url: r });
+ this.$textarea = undefined;
+ this.$element.find('div.oe_etherpad_head').click(function(ev) {
+ self.$element.toggleClass('oe_etherpad_fullscreen').toggleClass('oe_etherpad_normal');
});
- }
+ },
+ set_value: function(value_) {
+ this._super(value_);
+ this.render_value();
+ },
+ render_value: function() {
+ var self = this;
+ var value = this.get('value');
+ if(value !== false) {
+ var url = value.split('\n')[0];
+ if (!this.get("effective_readonly")) {
+ var pad_username = this.session.username;
+ var code = '<iframe width="100%" height="100%" frameborder="0" src="'+url+'?showChat=false&userName='+pad_username+'"></iframe>';
+ this.$element.find('div.oe_etherpad_default').html(code);
+ } else {
+ $.get(url+'/export/html').success(function(data) {
+ self.$element.html('<div class="etherpad_readonly">'+data+'</div>');
+ }).error(function() {
+ self.$element.text('Unable to load pad');
+ });
+ }
+ }
+ },
+});
+
+instance.web.form.widgets = instance.web.form.widgets.extend({
+ 'pad': 'instance.web.form.FieldPad',
});
};
diff --git a/addons/pad/static/src/xml/pad.xml b/addons/pad/static/src/xml/pad.xml
index e922294d03d..e128fb183fb 100644
--- a/addons/pad/static/src/xml/pad.xml
+++ b/addons/pad/static/src/xml/pad.xml
@@ -2,4 +2,17 @@
<!-- vim:fdl=1:
-->
<templates id="template" xml:space="preserve">
+
+<t t-name="FieldPad">
+ <t t-if="!widget.get('effective_readonly')">
+ <div class="oe_form_field_text oe_etherpad_normal">
+ <div class="oe_etherpad_head">
+ <span class="oe_normal">Fullscreen</span>
+ <span class="oe_fullscreen">Return to Record</span>
+ </div>
+ <div class="oe_etherpad_default" ></div>
+ </div>
+ </t>
+</t>
+
</templates>