Skip to content

Commit

Permalink
<select> para types (falta update) (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Dec 6, 2016
1 parent 8648954 commit 9b17343
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions src/txt-to-sql.jade
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,13 @@ html(lang=lang)
html.td([createInput(name, type, value, width, id || name)])
]).create();
}
function createList(label, name, value, alternatives, clazz) {
var valuesID=name+'_values';
function createList(label, id, value, alternatives, clazz) {
var options=alternatives.map(function(item) {
return html.option({value:item, selected:value==item}, item);
});
return html.tr([
html.td([html.label(label)]),
html.td([html.select({id:name, class:clazz}, options)])
html.td([html.select({id:id, class:clazz}, options)])
]).create();
}
function handleGenerate(event){
Expand Down Expand Up @@ -329,14 +328,14 @@ html(lang=lang)
createOption(messages.opts.addDropTable, 'addDropTable', 'checkbox', prepared.opts.addDropTable, 1),
createOption(messages.opts.compactInsertLimit, 'compactInsertLimit', 'text', prepared.opts.compactInsertLimit, 1),
]).create();
console.log(JSON.stringify(txtToSql.engineTypes));
var fields = prepared.columns.map(function(column, index) {
var ipk = column.inPrimaryKey!==null && column.inPrimaryKey;
var hnv = column.hasNullValues!==null && column.hasNullValues;
var hcn = column.hasCientificNotation!==null && column.hasCientificNotation;
return html.tr([
html.td([createInput('name', 'text', column.name, 15, 'col_name_'+index)]),
html.td([createInput('type', 'text', column.type, 10, 'col_type_'+index)]),
// html.td([createInput('type', 'text', column.type, 10, 'col_type_'+index)]),
html.td([createList('type', 'col_type_'+index, column.type, txtToSql.engineTypes[prepared.opts.outputEngine], 'width10'),]),
html.td([createInput('inPrimaryKey', 'checkbox', ipk, 0, 'col_pk_'+index)]),
html.td([createInput('hasNullValues', 'checkbox', hnv, 0, 'col_nulls_'+index)]),
html.td([createInput('maxLength', 'text', column.maxLength, 0, 'col_len_'+index)]),
Expand Down
9 changes: 4 additions & 5 deletions web/txt-to-sql.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,13 @@
html.td([createInput(name, type, value, width, id || name)])
]).create();
}
function createList(label, name, value, alternatives, clazz) {
var valuesID=name+'_values';
function createList(label, id, value, alternatives, clazz) {
var options=alternatives.map(function(item) {
return html.option({value:item, selected:value==item}, item);
});
return html.tr([
html.td([html.label(label)]),
html.td([html.select({id:name, class:clazz}, options)])
html.td([html.select({id:id, class:clazz}, options)])
]).create();
}
function handleGenerate(event){
Expand Down Expand Up @@ -278,14 +277,14 @@
createOption(messages.opts.addDropTable, 'addDropTable', 'checkbox', prepared.opts.addDropTable, 1),
createOption(messages.opts.compactInsertLimit, 'compactInsertLimit', 'text', prepared.opts.compactInsertLimit, 1),
]).create();
console.log(JSON.stringify(txtToSql.engineTypes));
var fields = prepared.columns.map(function(column, index) {
var ipk = column.inPrimaryKey!==null && column.inPrimaryKey;
var hnv = column.hasNullValues!==null && column.hasNullValues;
var hcn = column.hasCientificNotation!==null && column.hasCientificNotation;
return html.tr([
html.td([createInput('name', 'text', column.name, 15, 'col_name_'+index)]),
html.td([createInput('type', 'text', column.type, 10, 'col_type_'+index)]),
// html.td([createInput('type', 'text', column.type, 10, 'col_type_'+index)]),
html.td([createList('type', 'col_type_'+index, column.type, txtToSql.engineTypes[prepared.opts.outputEngine], 'width10'),]),
html.td([createInput('inPrimaryKey', 'checkbox', ipk, 0, 'col_pk_'+index)]),
html.td([createInput('hasNullValues', 'checkbox', hnv, 0, 'col_nulls_'+index)]),
html.td([createInput('maxLength', 'text', column.maxLength, 0, 'col_len_'+index)]),
Expand Down

0 comments on commit 9b17343

Please sign in to comment.