diff options
| author | Fabien Pinckaers <fp@openerp.com> | 2012-07-18 00:14:08 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@openerp.com> | 2012-07-18 00:14:08 +0200 |
| commit | 36cde3d9fca0f786a8fa8dabf94bac71e1ae637a (patch) | |
| tree | e05d1c8ede03d63cafacaf7150456570c0961a0f /addons/pad/static/src | |
| parent | 2a89c6079c9f7f5d9135bcda777fda3f3ed8d859 (diff) | |
| parent | 45c50d3a31cc9627e61384bd0c1c80f22c5e740e (diff) | |
[IMP] some cleaning in etherpad
bzr revid: fp@openerp.com-20120717221408-zk30i103f0erk4a3
Diffstat (limited to 'addons/pad/static/src')
| -rw-r--r-- | addons/pad/static/src/css/etherpad.css | 71 | ||||
| -rw-r--r-- | addons/pad/static/src/js/pad.js | 55 | ||||
| -rw-r--r-- | addons/pad/static/src/xml/pad.xml | 10 |
3 files changed, 120 insertions, 16 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..fd804c95472 --- /dev/null +++ b/addons/pad/static/src/css/etherpad.css @@ -0,0 +1,71 @@ +.etherpad_head{ + width: 99.7%; + display: block; + border-radius: 3px 3px 0px 0px; + background: -webkit-linear-gradient( #F7F7F7, #F1F1F1 80%); + padding-left:3px; + cursor:pointer; +} +.etherpad_zoom_head{ + position: fixed; + left: 0px; + top: 0px; + width: 100%; + height: 15px; +} +.etherpad_zoom{ + position: fixed; + left: 0px; + top: 15px; + width: 100%; + height: 98% !important; + z-index:10001 !important; + background-color:white; +} +.etherpad_default{ + width: 100%; + height: 450px; +} +.etherpad_body{ + overflow:hidden; +} + +.etherpad_readonly{ + width: 97.2%; + height: 450px; + padding:7px 7px 10px 10px; + 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..3f13df45d48 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -1,18 +1,41 @@ 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() { - 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 }); - }); - } -}); - -}; +instance.web.form.FieldEtherpad = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { + template: 'FieldEtherpad', + initialize_content: function() { + this.$textarea = undefined; + this.$element.find('span').text(this.field.string); + this.$element.find('span').click(_.bind(function(ev){ + this.$element.find('span').toggleClass('etherpad_zoom_head'); + var iszoom = this.$element.find('span').hasClass('etherpad_zoom_head'); + this.$element.find('span').text((iszoom?'Back to Task':this.field.string)); + this.$element.find('div').toggleClass('etherpad_zoom'); + $("body").toggleClass('etherpad_body'); + },this)); + }, + set_value: function(value_) { + this._super(value_); + this.render_value(); + }, + render_value: function() { + var show_value = instance.web.format_value(this.get('value'), this, ''); + if (!this.get("effective_readonly")) { + var pad_username = this.session.username; + this.$element.find('div').html('<iframe width="100%" height="100%" frameborder="0" src="'+show_value.split('\n')[0]+'?showChat=false&showLineNumbers=false&userName='+pad_username+'"></iframe>'); + } else { + if(this.get('value') != false) + { + var self = this; + if(show_value.split('\n')[0] != '') + $.get(show_value.split('\n')[0]+'/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({ + 'etherpad': 'instance.web.form.FieldEtherpad', + }); +}; diff --git a/addons/pad/static/src/xml/pad.xml b/addons/pad/static/src/xml/pad.xml index e922294d03d..334064e88a1 100644 --- a/addons/pad/static/src/xml/pad.xml +++ b/addons/pad/static/src/xml/pad.xml @@ -2,4 +2,14 @@ <!-- vim:fdl=1: --> <templates id="template" xml:space="preserve"> + +<t t-name="FieldEtherpad"> + <t t-if="!widget.get('effective_readonly')"> + <div class="oe_form_field_text"> + <span class="etherpad_head"></span> + <div class="etherpad_default" ></div> + </div> + </t> +</t> + </templates> |
