starting to implement functional transforms
This commit is contained in:
@@ -90,7 +90,7 @@
|
|||||||
<div bind="toolPanelDiv" id="tool-panel">
|
<div bind="toolPanelDiv" id="tool-panel">
|
||||||
<div bind="summaryBarDiv" id="summary-bar">
|
<div bind="summaryBarDiv" id="summary-bar">
|
||||||
<span>
|
<span>
|
||||||
{{doc_count}} rows
|
{{doc_count}} documents
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="download">
|
<div id="download">
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ var costco = function() {
|
|||||||
|
|
||||||
var toUpdate = [];
|
var toUpdate = [];
|
||||||
|
|
||||||
function getDb() {
|
function handleEditorChange(e) {
|
||||||
|
console.log(e.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function computeChanges() {
|
function computeChanges() {
|
||||||
@@ -25,8 +25,7 @@ var costco = function() {
|
|||||||
return mapDocs(text);
|
return mapDocs(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!docs.length)
|
if(!docs.length) docs = [docs];
|
||||||
docs = [docs];
|
|
||||||
|
|
||||||
toUpdate = docs;
|
toUpdate = docs;
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ var costco = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getDb: getDb,
|
handleEditorChange: handleEditorChange,
|
||||||
computeChanges: computeChanges,
|
computeChanges: computeChanges,
|
||||||
mapDocs: mapDocs,
|
mapDocs: mapDocs,
|
||||||
updateDocs: updateDocs,
|
updateDocs: updateDocs,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ var removalist = function() {
|
|||||||
$( '.menu li' ).click(function(e) {
|
$( '.menu li' ).click(function(e) {
|
||||||
if ($(e.target).hasClass('transform')) {
|
if ($(e.target).hasClass('transform')) {
|
||||||
util.show('dialog');
|
util.show('dialog');
|
||||||
util.render('bulkEdit', 'dialog-content');
|
util.render('bulkEdit', 'dialog-content', {name: app.currentColumn});
|
||||||
$('.cancelButton').click(function(e) {
|
$('.cancelButton').click(function(e) {
|
||||||
util.hide('dialog');
|
util.hide('dialog');
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ app.after = {
|
|||||||
},
|
},
|
||||||
dataTable: function() {
|
dataTable: function() {
|
||||||
$('.column-header-menu').click(function(e) {
|
$('.column-header-menu').click(function(e) {
|
||||||
|
app.currentColumn = $(e.target).siblings().text();
|
||||||
util.position('menu', e);
|
util.position('menu', e);
|
||||||
util.render('columnActions', 'menu');
|
util.render('columnActions', 'menu');
|
||||||
});
|
});
|
||||||
@@ -38,7 +39,16 @@ app.after = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
exportActions: removalist.handleMenuClick,
|
exportActions: removalist.handleMenuClick,
|
||||||
columnActions: removalist.handleMenuClick
|
columnActions: removalist.handleMenuClick,
|
||||||
|
bulkEdit: function() {
|
||||||
|
var editor = $('.expression-preview-code');
|
||||||
|
editor.val("function(doc) {\n doc['"+ app.currentColumn+"'] = doc['"+ app.currentColumn+"'];\n return doc;\n}");
|
||||||
|
editor.focus().get(0).setSelectionRange(18, 18);
|
||||||
|
editor.keydown(function(e) {
|
||||||
|
// if you don't setTimeout it won't grab the latest character if you call e.target.value
|
||||||
|
window.setTimeout(function(){costco.handleEditorChange(e)}, 1, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.sammy = $.sammy(function () {
|
app.sammy = $.sammy(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user