diff options
| author | Christophe Matthieu <chm@openerp.com> | 2012-10-24 14:27:00 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2012-10-24 14:27:00 +0200 |
| commit | 9fe8d72078038b248cb82c209e242ec4c0ab6e2d (patch) | |
| tree | 08b5cbbc9a85dec83f7c5918df7227554312c9ac /addons/web/static/src | |
| parent | fbd53c418eed6ae5acca67d8c641bb7e9965a087 (diff) | |
[IMP] base: widget one2many_binary
bzr revid: chm@openerp.com-20121024122700-k1ycsuyejmh9gqc9
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 46 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 59 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 15 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 9 |
4 files changed, 119 insertions, 10 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 64b782835f2..3c1022c6e46 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -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; +} diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index f84d30a93ea..1096dd7564d 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -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) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 0d28bd410fc..08240456b37 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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(); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 639501e286e..f2f9e0f4989 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -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"> |
