[IMP] base: widget one2many_binary
bzr revid: chm@openerp.com-20121024122700-k1ycsuyejmh9gqc9
This commit is contained in:
parent
fbd53c418e
commit
9fe8d72078
|
@ -2927,3 +2927,49 @@ div.ui-widget-overlay {
|
|||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.openerp .oe_fileuploader {
|
||||
display: inline-block;
|
||||
clear: both;
|
||||
}
|
||||
.openerp .oe_fileuploader .oe_add {
|
||||
float: left;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
position: relative;
|
||||
left: +2px;
|
||||
top: +7px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.openerp .oe_fileuploader .oe_add button {
|
||||
position: absolute;
|
||||
bottom: +0px;
|
||||
left: +0px;
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
.openerp .oe_fileuploader .oe_add .oe_hidden_input_file input.oe_form_binary_file {
|
||||
width: 300px;
|
||||
left: -100px;
|
||||
top: 1px;
|
||||
height: 24px;
|
||||
width: 300px;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
color: transparent;
|
||||
}
|
||||
.openerp .oe_fileuploader .oe_add button span {
|
||||
position: relative;
|
||||
bottom: +4px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.openerp .oe_fileuploader {
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
@ -2273,6 +2273,65 @@ $sheet-max-width: 860px
|
|||
float: right
|
||||
color: #333
|
||||
// }}}
|
||||
|
||||
.openerp .oe_fileuploader .oe_add .oe_hidden_input_file input.oe_form_binary_file {
|
||||
width: 300px;
|
||||
left: -100px;
|
||||
top: 1px;
|
||||
height: 24px;
|
||||
width: 300px;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
color: transparent;
|
||||
}
|
||||
.openerp .oe_fileuploader .oe_add button span {
|
||||
position: relative;
|
||||
bottom: +4px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.openerp .oe_fileuploader {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.oe_fileuploader
|
||||
display: inline-block
|
||||
clear: both
|
||||
.oe_add
|
||||
float: left
|
||||
width: 24px
|
||||
height: 24px
|
||||
position: relative
|
||||
z-index: 10
|
||||
left: +2px
|
||||
top: +7px
|
||||
overflow: hidden
|
||||
button
|
||||
position: absolute
|
||||
bottom: +0px
|
||||
left: +0px
|
||||
height: 24px
|
||||
width: 24px
|
||||
margin: 0px
|
||||
padding: 0px
|
||||
input.oe_form_binary_file
|
||||
width: 300px
|
||||
left: -100px
|
||||
top: 1px
|
||||
height: 24px
|
||||
width: 300px
|
||||
background: transparent
|
||||
border: 0
|
||||
margin: 0px
|
||||
padding: 0px
|
||||
color: transparent
|
||||
button span
|
||||
position: relative
|
||||
bottom: +4px
|
||||
font-size: 30px
|
||||
|
||||
// Kitten Mode {{{
|
||||
.kitten-mode-activated
|
||||
background-image: url(http://placekitten.com/g/1365/769)
|
||||
|
|
|
@ -4918,6 +4918,7 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
|
|||
this._super(this);
|
||||
this.$list_file = this.$('.oe_placeholder_files');
|
||||
this.$el.on('change', 'input.oe_form_binary_file', this.on_file_change );
|
||||
this.display_files();
|
||||
},
|
||||
set_value: function(value_) {
|
||||
var values = this.files = (value_ && !this.files) ? value_ : this.files;
|
||||
|
@ -4934,8 +4935,8 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
|
|||
if(this.$list_file) {
|
||||
var render = $(instance.web.qweb.render('FieldBinaryFileUploader.files', {'widget': this}));
|
||||
this.$list_file.replaceWith( render );
|
||||
this.$list_file = this.$(".oe_fileuploader_files");
|
||||
this.$list_file.on('click', '.oe_fileuploader_delete', this.on_file_delete);
|
||||
this.$list_file = this.$(".oe_files");
|
||||
this.$list_file.on('click', '.oe_delete', this.on_file_delete);
|
||||
}
|
||||
},
|
||||
on_file_change: function (event) {
|
||||
|
@ -4966,9 +4967,11 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
|
|||
instance.web.blockUI();
|
||||
}
|
||||
|
||||
// TODO : unactivate send on wizard and form
|
||||
|
||||
// submit file
|
||||
self.$('form.oe_form_binary_form').submit();
|
||||
this.$(".oe_fileuploader_form").hide();
|
||||
this.$('form.oe_form_binary_form').submit();
|
||||
this.$(".oe_fileuploader").hide();
|
||||
|
||||
// add file on result
|
||||
this.files.push({
|
||||
|
@ -4987,6 +4990,8 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
|
|||
instance.web.unblockUI();
|
||||
}
|
||||
|
||||
// TODO : activate send on wizard and form
|
||||
|
||||
for(var i in this.files){
|
||||
if(this.files[i].filename == result.filename && this.files[i].upload) {
|
||||
this.files[i] = {
|
||||
|
@ -5001,7 +5006,7 @@ instance.web.form.FieldOne2ManyBinaryMultiFiles = instance.web.form.AbstractFiel
|
|||
|
||||
var $input = this.$('input.oe_form_binary_file');
|
||||
$input.after($input.clone(true)).remove();
|
||||
this.$(".oe_fileuploader_form").show();
|
||||
this.$(".oe_fileuploader").show();
|
||||
},
|
||||
on_file_delete: function (event) {
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -1175,7 +1175,7 @@
|
|||
</div>
|
||||
</t>
|
||||
<t t-name="FieldBinaryFileUploader.files">
|
||||
<ul class="oe_fileuploader_files">
|
||||
<ul class="oe_files">
|
||||
<t t-foreach="widget.files" t-as="file">
|
||||
<li>
|
||||
<span t-if="(file.upload or file.percent_loaded<100)" t-attf-title="{(file.name || file.filename) + (file.date?' \n('+file.date+')':'' )}" t-attf-name="{file.name || file.filename}">
|
||||
|
@ -1188,17 +1188,16 @@
|
|||
<t t-raw="file.name || file.filename"/>
|
||||
</a>
|
||||
<t t-if="(!file.upload or file.percent_loaded>=100)">
|
||||
<a class="oe_fileuploader_delete" title="Delete this file" t-attf-data-id="{file.id}">x</a>
|
||||
<a class="oe_delete" title="Delete this file" t-attf-data-id="{file.id}">x</a>
|
||||
</t>
|
||||
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
</t>
|
||||
<t t-name="FieldBinaryFileUploader">
|
||||
<div t-att-style="widget.node.attrs.style" t-att-class="widget.node.attrs.class">
|
||||
<div t-att-style="widget.node.attrs.style" t-attf-class="oe_fileuploader #{widget.node.attrs.class ? widget.node.attrs.class :''}">
|
||||
<div class="oe_placeholder_files"/>
|
||||
<div class="oe_fileuploader_form">
|
||||
<div class="oe_add">
|
||||
<!-- uploader of file -->
|
||||
<button><span class="oe_e">p</span></button>
|
||||
<t t-call="HiddenInputFile">
|
||||
|
|
Loading…
Reference in New Issue