[FIX] css: further etherpad fixes:

bzr revid: fva@openerp.com-20120924134600-5avqr2vohdsh7y9n
This commit is contained in:
Frédéric van der Essen 2012-09-24 15:46:00 +02:00
parent db6c61f666
commit a7f63f3fb2
3 changed files with 118 additions and 78 deletions

View File

@ -1,17 +1,36 @@
.oe_pad_head { .oe_pad {
box-sizing: border-box; margin-top: 16px;
width: 100%;
display: block;
padding: 4px;
text-align: right;
}
.oe_pad_head .oe_pad_switch {
} }
.oe_pad_readonly { .oe_pad_switch_positioner {
border: 1px solid #ddd; position: relative;
padding: 8px; }
.oe_pad_switch {
position: absolute;
top: 5px;
left: 383px;
width: 28px;
height: 28px;
background-image: -webkit-linear-gradient(top, white, #f0f0f0);
border: solid 1px #ccc;
border-radius:3px;
text-align: center;
line-height: 22px;
overflow: hidden;
-webkit-box-sizing: border-box;
color: #666666;
padding-top:-3px;
padding-left:-1px;
cursor: pointer;
}
.oe_pad_switch:hover{
background-image: -webkit-linear-gradient(top, #f4f4f4, #e4e4e4);
}
.oe_pad_fullscreen .oe_pad_switch {
top:4px;
} }
.oe_pad_fullscreen { .oe_pad_fullscreen {
@ -27,9 +46,9 @@
z-index: 1000; z-index: 1000;
} }
.oe_pad_content { .oe_pad.oe_configured .oe_pad_content.oe_editing{
border: solid 1px #c4c4c4; border: solid 1px #c4c4c4;
height: 150px; height:300px;
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.1); -webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.1);
-moz-box-shadow: 0 5px 10px rgba(0,0,0,0.1); -moz-box-shadow: 0 5px 10px rgba(0,0,0,0.1);
-ms-box-shadow: 0 5px 10px rgba(0,0,0,0.1); -ms-box-shadow: 0 5px 10px rgba(0,0,0,0.1);
@ -37,12 +56,7 @@
box-shadow: 0 5px 10px rgba(0,0,0,0.1); box-shadow: 0 5px 10px rgba(0,0,0,0.1);
} }
.oe_pad_content > p { .oe_pad.oe_configured.oe_pad_fullscreen .oe_pad_content {
text-align: center;
opacity: 0.75;
}
.oe_pad_fullscreen .oe_pad_content {
height: 100%; height: 100%;
border: none; border: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
@ -52,6 +66,16 @@
box-shadow: none; box-shadow: none;
} }
.oe_pad.oe_unconfigured > p {
text-align: center;
opacity: 0.75;
}
.oe_pad_loading{
text-align: center;
opacity: 0.75;
}
.etherpad_readonly ul, .etherpad_readonly ol { .etherpad_readonly ul, .etherpad_readonly ol {
margin-before: 1em; margin-before: 1em;
margin-after: 1em; margin-after: 1em;

View File

@ -1,49 +1,47 @@
openerp.pad = function(instance) { openerp.pad = function(instance) {
instance.web.form.FieldPad = instance.web.form.AbstractField.extend({ instance.web.form.FieldPad = instance.web.form.AbstractField.extend({
template: 'FieldPad', template: 'FieldPad',
start: function() { configured: false,
this._super(); content: "",
var self = this; set_value: function(val) {
this.$el.find('div.oe_pad_head').click(function(ev) { var self = this;
self.$el.toggleClass('oe_pad_fullscreen'); var _super = self._super;
}); _super.apply(self,[val]);
this.on("change:effective_readonly", this, function() { this._dirty_flag = true;
this.render_value(); self.renderElement();
}); },
}, renderElement: function(){
set_value: function(val) { var self = this;
var self = this; var value = this.get('value');
var _super = self._super; if(!_.str.startsWith(value,'http')){
_super.apply(self,[val]); this.configured = false;
this._dirty_flag = true; this.content = "";
self.render_value(); }else{
}, this.configured = true;
render_value: function() { if(!this.get('effective_readonly')){
console.log("display"); this.content = '<iframe width="100%" height="100%" frameborder="0" src="'+value+'?showChat=false&userName='+this.session.username+'"></iframe>';
var self = this; }else{
var value = this.get('value'); this.content = '<div class="oe_pad_loading">... Loading pad ...</div>';
$.get(value+'/export/html').success(function(data){
if (!_.str.startsWith(value, "http")) { self.$('.oe_pad_content').html('<div class="oe_pad_readonly">'+data+'<div>');
self.$('.oe_pad_content').html(instance.web.qweb.render('FieldPad.unconfigured')); }).error(function(){
} else { self.$('.oe_pad_content').text('Unable to load pad');
if (!this.get("effective_readonly")) { });
var pad_username = this.session.username; }
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(value+'/export/html').success(function(data) {
self.$('.oe_pad_content').html('<div class="oe_pad_readonly">'+data+'</div>');
}).error(function() {
self.$('.oe_pad_content').text('Unable to load pad');
});
} }
} this._super();
}, this.$('.oe_pad_content').html(this.content);
}); this.$('.oe_pad_switch').click(function(){
self.$el.toggleClass('oe_pad_fullscreen');
instance.web.form.widgets = instance.web.form.widgets.extend({ });
'pad': 'instance.web.form.FieldPad', this.on('change:effective_readonly',this,function(){
}); self.renderElement();
});
},
});
instance.web.form.widgets = instance.web.form.widgets.extend({
'pad': 'instance.web.form.FieldPad',
});
}; };

View File

@ -2,17 +2,35 @@
<!-- vim:fdl=1: <!-- vim:fdl=1:
--> -->
<templates id="template" xml:space="preserve"> <templates id="template" xml:space="preserve">
<t t-name="FieldPad">
<div class="oe_form_field_text oe_pad"> <t t-name="FieldPad">
<div class="oe_pad_head">
<button class="oe_pad_switch oe_button">Fullscreen</button> <t t-if="!widget.configured">
</div> <div class="oe_form_field_text oe_pad oe_unconfigured">
<div class="oe_pad_content"></div> <p>
</div> You must configure the etherpad through the menu Setting > Companies > Companies, in the configuration tab of your company.
</t> </p>
<t t-name="FieldPad.unconfigured"> </div>
<p> </t>
You must configure the etherpad through the menu Setting > Companies > Companies, in the configuration tab of your company.<br/>
</p> <t t-if="widget.configured">
</t> <t t-if="widget.get('effective_readonly')">
<div class="oe_form_field_text oe_pad oe_configured">
<div class="oe_pad_content etherpad_readonly">
</div>
</div>
</t>
<t t-if="!widget.get('effective_readonly')">
<div class="oe_form_field_text oe_pad oe_configured">
<div class="oe_pad_switch_positioner">
<span class="oe_pad_switch oe_e">&amp;Ntilde;</span>
</div>
<div class="oe_pad_content oe_editing">
</div>
</div>
</t>
</t>
</t>
</templates> </templates>