lib/gollum/public/gollum/javascript/gollum.dialog.js in gollum-2.4.15 vs lib/gollum/public/gollum/javascript/gollum.dialog.js in gollum-2.5.0
- old
+ new
@@ -35,15 +35,18 @@
for ( var i=0; i < fieldArray.length; i++ ) {
if ( typeof fieldArray[i] == 'object' ) {
fieldMarkup += '<div class="field">';
switch ( fieldArray[i].type ) {
- // only text is supported for now
case 'text':
fieldMarkup += Dialog.createFieldText( fieldArray[i] );
break;
+ case 'file':
+ fieldMarkup += Dialog.createFieldFile( fieldArray[i] );
+ break;
+
default:
break;
}
fieldMarkup += '</div>';
@@ -58,11 +61,11 @@
var html = '';
if ( fieldAttributes.name ) {
html += '<label';
if ( fieldAttributes.id ) {
- html += ' for="' + fieldAttributes.name + '"';
+ html += ' for="gollum-dialog-dialog-generated-field-' + fieldAttributes.id + '"';
}
html += '>' + fieldAttributes.name + '</label>';
}
html += '<input type="text"';
@@ -80,9 +83,25 @@
}
if( fieldAttributes.context ){
html += '<span class="context">' + fieldAttributes.context + '</span>';
}
+
+ return html;
+ },
+
+ createFieldFile: function( fieldAttributes ) {
+ // Not actually a field, but an embedded form.
+ var html = '';
+
+ var id = fieldAttributes.id || 'upload';
+ var name = fieldAttributes.name || 'file';
+ var action = fieldAttributes.action || 'uploadFile';
+
+ html += '<form method=post enctype="multipart/form-data" ' +
+ 'action="' + action + '" ' + 'id="' + id + '">';
+ html += '<input type=file name="' + name + '">';
+ html += '</form>';
return html;
},
createMarkup: function( title, body ) {