|
@@ -297,7 +297,7 @@ class HTMLBuilder {
|
|
}
|
|
}
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
- static file(data={}, props={})
|
|
|
|
|
|
+ static file(data={}, props={}, onchange=undefined)
|
|
{
|
|
{
|
|
/*<form action="#">
|
|
/*<form action="#">
|
|
<div class="file-field input-field">
|
|
<div class="file-field input-field">
|
|
@@ -313,6 +313,7 @@ class HTMLBuilder {
|
|
setDef(data, "btnLabel", "Ouvrir")
|
|
setDef(data, "btnLabel", "Ouvrir")
|
|
setDef(props, "form", {})
|
|
setDef(props, "form", {})
|
|
setDef(props, "btnDiv", {})
|
|
setDef(props, "btnDiv", {})
|
|
|
|
+
|
|
var form = HTMLBuilder.elem('form', props.form);
|
|
var form = HTMLBuilder.elem('form', props.form);
|
|
var wrapperDiv= HTMLBuilder.div({class: _row_class+_inline_fields});
|
|
var wrapperDiv= HTMLBuilder.div({class: _row_class+_inline_fields});
|
|
|
|
|
|
@@ -321,10 +322,14 @@ class HTMLBuilder {
|
|
wrapperDiv.append(HTMLBuilder.div({class:_col_class()+_inline_fields},
|
|
wrapperDiv.append(HTMLBuilder.div({class:_col_class()+_inline_fields},
|
|
HTMLBuilder.p(data.placeholder)));
|
|
HTMLBuilder.p(data.placeholder)));
|
|
}
|
|
}
|
|
- var fileDiv = HTMLBuilder.div(mc(props.fileDiv, _file_input_class+_col_class()))
|
|
|
|
|
|
+ var fileDiv = HTMLBuilder.div(mc(props.fileDiv, _file_input_class+_col_class(11)))
|
|
var btnDiv= HTMLBuilder.div({class: "btn "});
|
|
var btnDiv= HTMLBuilder.div({class: "btn "});
|
|
btnDiv.append(HTMLBuilder.span({}, data.btnLabel));
|
|
btnDiv.append(HTMLBuilder.span({}, data.btnLabel));
|
|
btnDiv.append(HTMLBuilder.input('file', {id: data.id+"_f"}));
|
|
btnDiv.append(HTMLBuilder.input('file', {id: data.id+"_f"}));
|
|
|
|
+ btnDiv.find("input").on('change', function(){
|
|
|
|
+ $('#'+data.id+"_fp").val($( this ).
|
|
|
|
+ val().replace(/C:\\fakepath\\/i, ''))
|
|
|
|
+ });
|
|
fileDiv.append(btnDiv);
|
|
fileDiv.append(btnDiv);
|
|
|
|
|
|
var textDiv = HTMLBuilder.div({class: _file_path_wrapper_class});
|
|
var textDiv = HTMLBuilder.div({class: _file_path_wrapper_class});
|
|
@@ -333,8 +338,12 @@ class HTMLBuilder {
|
|
);
|
|
);
|
|
fileDiv.append(textDiv);
|
|
fileDiv.append(textDiv);
|
|
wrapperDiv.append(fileDiv);
|
|
wrapperDiv.append(fileDiv);
|
|
- wrapperDiv.append(HTMLBuilder.iconButton('cloud_upload', {class: _col_class()+_inline_fields}));
|
|
|
|
|
|
+ wrapperDiv.append(HTMLBuilder.iconButton('cloud_upload',
|
|
|
|
+ {class: _col_class(1)+_inline_fields, onclick: onclick}));
|
|
form.append(wrapperDiv);
|
|
form.append(wrapperDiv);
|
|
|
|
+
|
|
return form;
|
|
return form;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|