diff options
| author | Olivier Dony <odo@openerp.com> | 2012-08-29 17:54:00 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2012-08-29 17:54:00 +0200 |
| commit | bc74fc920cd159ebcbcee62d0b3e99eaac15641e (patch) | |
| tree | c4c1d4633be52a442420d27251035321eb5ab801 /addons/pad/static | |
| parent | ba7aee832d999b940c1139218d6966db660510fe (diff) | |
| parent | 6e80e425d1626d46c0f48054a5beb339fa1cd557 (diff) | |
[MERGE] Rebase incorrect top-level merge of `pad/wiki` refactoring + extra merge of product form simplification
To be completed by an extra merge containing the remaining
work-in-progress stuff of pad/wiki refactoring.
bzr revid: odo@openerp.com-20120829155400-memirrjghutw5pl7
Diffstat (limited to 'addons/pad/static')
| -rw-r--r-- | addons/pad/static/src/css/etherpad.css | 53 | ||||
| -rw-r--r-- | addons/pad/static/src/js/pad.js | 45 | ||||
| -rw-r--r-- | addons/pad/static/src/xml/pad.xml | 22 |
3 files changed, 62 insertions, 58 deletions
diff --git a/addons/pad/static/src/css/etherpad.css b/addons/pad/static/src/css/etherpad.css index a0240afcab7..8ea7972071e 100644 --- a/addons/pad/static/src/css/etherpad.css +++ b/addons/pad/static/src/css/etherpad.css @@ -1,52 +1,39 @@ -.oe_etherpad_head{ +.oe_pad_head { width: 100%; display: block; - padding-left:3px; - cursor:pointer; + padding: 4px; } -.oe_etherpad_fullscreen div.oe_etherpad_head .oe_normal { - display: none; -} -.oe_etherpad_normal div.oe_etherpad_head .oe_fullscreen { - display: none; + +.oe_pad_readonly { + border: 1px solid #ddd; + padding: 8px; } -.oe_etherpad_fullscreen { + +.oe_pad_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% + z-index: 1000; } -.etherpad_body{ - overflow:hidden; +.oe_pad_fullscreen .oe_pad_content { + height: 100%; } -.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{ +.etherpad_readonly ul, .etherpad_readonly ol { + margin-before: 1em; + margin-after: 1em; + margin-start: 0px; + margin-end: 0px; + padding-start: 40px !important; +} +.etherpad_readonly ul li{ list-style-type: disc; } -.etherpad_readonly ol li{ +.etherpad_readonly ol li{ list-style-type: decimal; } .etherpad_readonly .indent li{ diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index df182650afe..a295e860a51 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -1,32 +1,47 @@ openerp.pad = function(instance) { -instance.web.form.FieldPad = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldPad = instance.web.form.AbstractField.extend({ template: 'FieldPad', - initialize_content: function() { + start: function() { + this._super(); var self = this; - this.$textarea = undefined; - this.$el.find('div.oe_etherpad_head').click(function(ev) { - self.$el.toggleClass('oe_etherpad_fullscreen').toggleClass('oe_etherpad_normal'); + this.$el.find('div.oe_pad_head').click(function(ev) { + self.$el.toggleClass('oe_pad_fullscreen'); + }); + this.on("change:effective_readonly", this, function() { + this.render_value(); }); }, - set_value: function(value_) { - this._super(value_); - this.render_value(); + set_value: function(val) { + var self = this; + var _super = self._super; + _super.apply(self,[val]); + if (val === false || val === "") { + self.field_manager.dataset.call('pad_generate_url').then(function(r) { + _super.apply(self,[r]); + self.render_value(); + }); + } else { + self.render_value(); + } }, render_value: function() { + console.log("display"); var self = this; var value = this.get('value'); - if(value !== false) { - var url = value.split('\n')[0]; + + if (!_.str.startsWith(value, "http")) { + self.$('.oe_pad_content').html(instance.web.qweb.render('FieldPad.unconfigured')); + } else { 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.$el.find('div.oe_etherpad_default').html(code); + var code = '<iframe width="100%" height="100%" frameborder="0" src="'+value+'?showChat=false&userName='+pad_username+'"></iframe>'; + this.$('.oe_pad_content').html(code); } else { - $.get(url+'/export/html').success(function(data) { - self.$el.html('<div class="etherpad_readonly">'+data+'</div>'); + $.get(value+'/export/html').success(function(data) { + self.$('.oe_pad_content').html('<div class="oe_pad_readonly">'+data+'</div>'); }).error(function() { - self.$el.text('Unable to load pad'); + self.$('.oe_pad_content').text('Unable to load pad'); }); } } diff --git a/addons/pad/static/src/xml/pad.xml b/addons/pad/static/src/xml/pad.xml index e128fb183fb..58266a2594a 100644 --- a/addons/pad/static/src/xml/pad.xml +++ b/addons/pad/static/src/xml/pad.xml @@ -2,17 +2,19 @@ <!-- 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 class="oe_form_field_text oe_pad"> + <div class="oe_pad_head"> + <span class="oe_pad_switch">Fullscreen</span> </div> - </t> + <div class="oe_pad_content"></div> + </div> +</t> +<t t-name="FieldPad.unconfigured"> + Please configure your etherpad server.<br/> + OpenERP Entreprise customers may safely use pad.openerp.com as a server using the following template:<br/> + <blockquote> + http://pad.openerp.com/p/%(db)s-%(model)s-%(salt)s + </blockquote> </t> - </templates> |
