[build][s]: usual build.
This commit is contained in:
17
dist/recline.css
vendored
17
dist/recline.css
vendored
@@ -39,12 +39,9 @@ table.recline-grid {
|
|||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recline-grid td {
|
.recline-grid tbody tr {
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
border-bottom: solid 1px #ccc;
|
||||||
|
|
||||||
.recline-grid tr td:first-child, .recline-grid tr th:first-child {
|
|
||||||
width: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.recline-grid tbody tr:last-child {
|
.recline-grid tbody tr:last-child {
|
||||||
@@ -56,9 +53,7 @@ table.recline-grid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* direct borrowing from twitter buttons */
|
/* direct borrowing from twitter buttons */
|
||||||
.recline-grid th,
|
.recline-grid th {
|
||||||
.transform-column-view .expression-preview-table-wrapper th
|
|
||||||
{
|
|
||||||
background-color: #e6e6e6;
|
background-color: #e6e6e6;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6));
|
||||||
@@ -208,12 +203,6 @@ div.data-table-cell-content-numeric > a.data-table-cell-edit {
|
|||||||
* Read-only mode
|
* Read-only mode
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
|
|
||||||
.recline-read-only .recline-grid.no-hidden tr td:first-child,
|
|
||||||
.recline-read-only .recline-grid.no-hidden tr th:first-child
|
|
||||||
{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recline-read-only .recline-grid .write-op,
|
.recline-read-only .recline-grid .write-op,
|
||||||
.recline-read-only .recline-grid a.data-table-cell-edit
|
.recline-read-only .recline-grid a.data-table-cell-edit
|
||||||
{
|
{
|
||||||
|
|||||||
41
dist/recline.dataset.js
vendored
41
dist/recline.dataset.js
vendored
@@ -202,6 +202,7 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
self.recordCount = queryResult.total;
|
self.recordCount = queryResult.total;
|
||||||
var docs = _.map(queryResult.hits, function(hit) {
|
var docs = _.map(queryResult.hits, function(hit) {
|
||||||
var _doc = new my.Record(hit);
|
var _doc = new my.Record(hit);
|
||||||
|
_doc.fields = self.fields;
|
||||||
_doc.bind('change', function(doc) {
|
_doc.bind('change', function(doc) {
|
||||||
self._changes.updates.push(doc.toJSON());
|
self._changes.updates.push(doc.toJSON());
|
||||||
});
|
});
|
||||||
@@ -254,18 +255,9 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
return dfd.promise();
|
return dfd.promise();
|
||||||
},
|
},
|
||||||
|
|
||||||
// ### recordSummary
|
// Deprecated (as of v0.5) - use record.summary()
|
||||||
//
|
|
||||||
// Get a simple html summary of a Dataset record in form of key/value list
|
|
||||||
recordSummary: function(record) {
|
recordSummary: function(record) {
|
||||||
var html = '<div class="recline-record-summary">';
|
return record.summary();
|
||||||
this.fields.each(function(field) {
|
|
||||||
if (field.id != 'id') {
|
|
||||||
html += '<div class="' + field.id + '"><strong>' + field.get('label') + '</strong>: ' + record.getFieldValue(field) + '</div>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// ### _backendFromString(backendString)
|
// ### _backendFromString(backendString)
|
||||||
@@ -329,14 +321,22 @@ my.Dataset.restore = function(state) {
|
|||||||
return dataset;
|
return dataset;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ## <a id="record">A Record (aka Row)</a>
|
// ## <a id="record">A Record</a>
|
||||||
//
|
//
|
||||||
// A single entry or row in the dataset
|
// A single record (or row) in the dataset
|
||||||
my.Record = Backbone.Model.extend({
|
my.Record = Backbone.Model.extend({
|
||||||
constructor: function Record() {
|
constructor: function Record() {
|
||||||
Backbone.Model.prototype.constructor.apply(this, arguments);
|
Backbone.Model.prototype.constructor.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ### initialize
|
||||||
|
//
|
||||||
|
// Create a Record
|
||||||
|
//
|
||||||
|
// You usually will not do this directly but will have records created by
|
||||||
|
// Dataset e.g. in query method
|
||||||
|
//
|
||||||
|
// Certain methods require presence of a fields attribute (identical to that on Dataset)
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
_.bindAll(this, 'getFieldValue');
|
_.bindAll(this, 'getFieldValue');
|
||||||
},
|
},
|
||||||
@@ -365,6 +365,21 @@ my.Record = Backbone.Model.extend({
|
|||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ### summary
|
||||||
|
//
|
||||||
|
// Get a simple html summary of this record in form of key/value list
|
||||||
|
summary: function(record) {
|
||||||
|
var self = this;
|
||||||
|
var html = '<div class="recline-record-summary">';
|
||||||
|
this.fields.each(function(field) {
|
||||||
|
if (field.id != 'id') {
|
||||||
|
html += '<div class="' + field.id + '"><strong>' + field.get('label') + '</strong>: ' + self.getFieldValue(field) + '</div>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
html += '</div>';
|
||||||
|
return html;
|
||||||
|
},
|
||||||
|
|
||||||
// Override Backbone save, fetch and destroy so they do nothing
|
// Override Backbone save, fetch and destroy so they do nothing
|
||||||
// Instead, Dataset object that created this Record should take care of
|
// Instead, Dataset object that created this Record should take care of
|
||||||
// handling these changes (discovery will occur via event notifications)
|
// handling these changes (discovery will occur via event notifications)
|
||||||
|
|||||||
153
dist/recline.js
vendored
153
dist/recline.js
vendored
@@ -39,7 +39,7 @@ this.recline.Backend.CSV = this.recline.Backend.CSV || {};
|
|||||||
});
|
});
|
||||||
} else if (dataset.url) {
|
} else if (dataset.url) {
|
||||||
$.get(dataset.url).done(function(data) {
|
$.get(dataset.url).done(function(data) {
|
||||||
var rows = my.parseCSV(dataset.data, dataset);
|
var rows = my.parseCSV(data, dataset);
|
||||||
dfd.resolve({
|
dfd.resolve({
|
||||||
records: rows,
|
records: rows,
|
||||||
useMemoryStore: true
|
useMemoryStore: true
|
||||||
@@ -1086,6 +1086,7 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
self.recordCount = queryResult.total;
|
self.recordCount = queryResult.total;
|
||||||
var docs = _.map(queryResult.hits, function(hit) {
|
var docs = _.map(queryResult.hits, function(hit) {
|
||||||
var _doc = new my.Record(hit);
|
var _doc = new my.Record(hit);
|
||||||
|
_doc.fields = self.fields;
|
||||||
_doc.bind('change', function(doc) {
|
_doc.bind('change', function(doc) {
|
||||||
self._changes.updates.push(doc.toJSON());
|
self._changes.updates.push(doc.toJSON());
|
||||||
});
|
});
|
||||||
@@ -1138,18 +1139,9 @@ my.Dataset = Backbone.Model.extend({
|
|||||||
return dfd.promise();
|
return dfd.promise();
|
||||||
},
|
},
|
||||||
|
|
||||||
// ### recordSummary
|
// Deprecated (as of v0.5) - use record.summary()
|
||||||
//
|
|
||||||
// Get a simple html summary of a Dataset record in form of key/value list
|
|
||||||
recordSummary: function(record) {
|
recordSummary: function(record) {
|
||||||
var html = '<div class="recline-record-summary">';
|
return record.summary();
|
||||||
this.fields.each(function(field) {
|
|
||||||
if (field.id != 'id') {
|
|
||||||
html += '<div class="' + field.id + '"><strong>' + field.get('label') + '</strong>: ' + record.getFieldValue(field) + '</div>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// ### _backendFromString(backendString)
|
// ### _backendFromString(backendString)
|
||||||
@@ -1213,14 +1205,22 @@ my.Dataset.restore = function(state) {
|
|||||||
return dataset;
|
return dataset;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ## <a id="record">A Record (aka Row)</a>
|
// ## <a id="record">A Record</a>
|
||||||
//
|
//
|
||||||
// A single entry or row in the dataset
|
// A single record (or row) in the dataset
|
||||||
my.Record = Backbone.Model.extend({
|
my.Record = Backbone.Model.extend({
|
||||||
constructor: function Record() {
|
constructor: function Record() {
|
||||||
Backbone.Model.prototype.constructor.apply(this, arguments);
|
Backbone.Model.prototype.constructor.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ### initialize
|
||||||
|
//
|
||||||
|
// Create a Record
|
||||||
|
//
|
||||||
|
// You usually will not do this directly but will have records created by
|
||||||
|
// Dataset e.g. in query method
|
||||||
|
//
|
||||||
|
// Certain methods require presence of a fields attribute (identical to that on Dataset)
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
_.bindAll(this, 'getFieldValue');
|
_.bindAll(this, 'getFieldValue');
|
||||||
},
|
},
|
||||||
@@ -1249,6 +1249,21 @@ my.Record = Backbone.Model.extend({
|
|||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ### summary
|
||||||
|
//
|
||||||
|
// Get a simple html summary of this record in form of key/value list
|
||||||
|
summary: function(record) {
|
||||||
|
var self = this;
|
||||||
|
var html = '<div class="recline-record-summary">';
|
||||||
|
this.fields.each(function(field) {
|
||||||
|
if (field.id != 'id') {
|
||||||
|
html += '<div class="' + field.id + '"><strong>' + field.get('label') + '</strong>: ' + self.getFieldValue(field) + '</div>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
html += '</div>';
|
||||||
|
return html;
|
||||||
|
},
|
||||||
|
|
||||||
// Override Backbone save, fetch and destroy so they do nothing
|
// Override Backbone save, fetch and destroy so they do nothing
|
||||||
// Instead, Dataset object that created this Record should take care of
|
// Instead, Dataset object that created this Record should take care of
|
||||||
// handling these changes (discovery will occur via event notifications)
|
// handling these changes (discovery will occur via event notifications)
|
||||||
@@ -1940,10 +1955,6 @@ my.Grid = Backbone.View.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .column-header-menu .data-table-menu li a': 'onColumnHeaderClick',
|
|
||||||
'click .row-header-menu': 'onRowHeaderClick',
|
|
||||||
'click .root-header-menu': 'onRootHeaderClick',
|
|
||||||
'click .data-table-menu li a': 'onMenuClick',
|
|
||||||
// does not work here so done at end of render function
|
// does not work here so done at end of render function
|
||||||
// 'scroll .recline-grid tbody': 'onHorizontalScroll'
|
// 'scroll .recline-grid tbody': 'onHorizontalScroll'
|
||||||
},
|
},
|
||||||
@@ -1951,74 +1962,6 @@ my.Grid = Backbone.View.extend({
|
|||||||
// ======================================================
|
// ======================================================
|
||||||
// Column and row menus
|
// Column and row menus
|
||||||
|
|
||||||
onColumnHeaderClick: function(e) {
|
|
||||||
this.tempState.currentColumn = $(e.target).closest('.column-header').attr('data-field');
|
|
||||||
},
|
|
||||||
|
|
||||||
onRowHeaderClick: function(e) {
|
|
||||||
this.tempState.currentRow = $(e.target).parents('tr:first').attr('data-id');
|
|
||||||
},
|
|
||||||
|
|
||||||
onRootHeaderClick: function(e) {
|
|
||||||
var tmpl = ' \
|
|
||||||
{{#columns}} \
|
|
||||||
<li><a data-action="showColumn" data-column="{{.}}" href="JavaScript:void(0);">Show column: {{.}}</a></li> \
|
|
||||||
{{/columns}}';
|
|
||||||
var tmp = Mustache.render(tmpl, {'columns': this.state.get('hiddenFields')});
|
|
||||||
this.el.find('.root-header-menu .dropdown-menu').html(tmp);
|
|
||||||
},
|
|
||||||
|
|
||||||
onMenuClick: function(e) {
|
|
||||||
var self = this;
|
|
||||||
e.preventDefault();
|
|
||||||
var actions = {
|
|
||||||
bulkEdit: function() { self.showTransformColumnDialog('bulkEdit', {name: self.tempState.currentColumn}); },
|
|
||||||
facet: function() {
|
|
||||||
self.model.queryState.addFacet(self.tempState.currentColumn);
|
|
||||||
},
|
|
||||||
facet_histogram: function() {
|
|
||||||
self.model.queryState.addHistogramFacet(self.tempState.currentColumn);
|
|
||||||
},
|
|
||||||
filter: function() {
|
|
||||||
self.model.queryState.addTermFilter(self.tempState.currentColumn, '');
|
|
||||||
},
|
|
||||||
sortAsc: function() { self.setColumnSort('asc'); },
|
|
||||||
sortDesc: function() { self.setColumnSort('desc'); },
|
|
||||||
hideColumn: function() { self.hideColumn(); },
|
|
||||||
showColumn: function() { self.showColumn(e); },
|
|
||||||
deleteRow: function() {
|
|
||||||
var self = this;
|
|
||||||
var doc = _.find(self.model.records.models, function(doc) {
|
|
||||||
// important this is == as the currentRow will be string (as comes
|
|
||||||
// from DOM) while id may be int
|
|
||||||
return doc.id == self.tempState.currentRow;
|
|
||||||
});
|
|
||||||
doc.destroy().then(function() {
|
|
||||||
self.model.records.remove(doc);
|
|
||||||
self.trigger('recline:flash', {message: "Row deleted successfully"});
|
|
||||||
}).fail(function(err) {
|
|
||||||
self.trigger('recline:flash', {message: "Errorz! " + err});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
actions[$(e.target).attr('data-action')]();
|
|
||||||
},
|
|
||||||
|
|
||||||
showTransformColumnDialog: function() {
|
|
||||||
var self = this;
|
|
||||||
var view = new my.ColumnTransform({
|
|
||||||
model: this.model
|
|
||||||
});
|
|
||||||
// pass the flash message up the chain
|
|
||||||
view.bind('recline:flash', function(flash) {
|
|
||||||
self.trigger('recline:flash', flash);
|
|
||||||
});
|
|
||||||
view.state = this.tempState;
|
|
||||||
view.render();
|
|
||||||
this.el.append(view.el);
|
|
||||||
view.el.modal();
|
|
||||||
},
|
|
||||||
|
|
||||||
setColumnSort: function(order) {
|
setColumnSort: function(order) {
|
||||||
var sort = [{}];
|
var sort = [{}];
|
||||||
sort[0][this.tempState.currentColumn] = {order: order};
|
sort[0][this.tempState.currentColumn] = {order: order};
|
||||||
@@ -2052,33 +1995,8 @@ my.Grid = Backbone.View.extend({
|
|||||||
<table class="recline-grid table-striped table-condensed" cellspacing="0"> \
|
<table class="recline-grid table-striped table-condensed" cellspacing="0"> \
|
||||||
<thead class="fixed-header"> \
|
<thead class="fixed-header"> \
|
||||||
<tr> \
|
<tr> \
|
||||||
{{#notEmpty}} \
|
|
||||||
<th class="column-header"> \
|
|
||||||
<div class="btn-group root-header-menu"> \
|
|
||||||
<a class="btn dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a> \
|
|
||||||
<ul class="dropdown-menu data-table-menu"> \
|
|
||||||
</ul> \
|
|
||||||
</div> \
|
|
||||||
<span class="column-header-name"></span> \
|
|
||||||
</th> \
|
|
||||||
{{/notEmpty}} \
|
|
||||||
{{#fields}} \
|
{{#fields}} \
|
||||||
<th class="column-header {{#hidden}}hidden{{/hidden}}" data-field="{{id}}" style="width: {{width}}px; max-width: {{width}}px; min-width: {{width}}px;"> \
|
<th class="column-header {{#hidden}}hidden{{/hidden}}" data-field="{{id}}" style="width: {{width}}px; max-width: {{width}}px; min-width: {{width}}px;" title="{{label}}"> \
|
||||||
<div class="btn-group column-header-menu"> \
|
|
||||||
<a class="btn dropdown-toggle" data-toggle="dropdown"><i class="icon-cog"></i><span class="caret"></span></a> \
|
|
||||||
<ul class="dropdown-menu data-table-menu pull-right"> \
|
|
||||||
<li><a data-action="facet" href="JavaScript:void(0);">Term Facet</a></li> \
|
|
||||||
<li><a data-action="facet_histogram" href="JavaScript:void(0);">Date Histogram Facet</a></li> \
|
|
||||||
<li><a data-action="filter" href="JavaScript:void(0);">Text Filter</a></li> \
|
|
||||||
<li class="divider"></li> \
|
|
||||||
<li><a data-action="sortAsc" href="JavaScript:void(0);">Sort ascending</a></li> \
|
|
||||||
<li><a data-action="sortDesc" href="JavaScript:void(0);">Sort descending</a></li> \
|
|
||||||
<li class="divider"></li> \
|
|
||||||
<li><a data-action="hideColumn" href="JavaScript:void(0);">Hide this column</a></li> \
|
|
||||||
<li class="divider"></li> \
|
|
||||||
<li class="write-op"><a data-action="bulkEdit" href="JavaScript:void(0);">Transform...</a></li> \
|
|
||||||
</ul> \
|
|
||||||
</div> \
|
|
||||||
<span class="column-header-name">{{label}}</span> \
|
<span class="column-header-name">{{label}}</span> \
|
||||||
</th> \
|
</th> \
|
||||||
{{/fields}} \
|
{{/fields}} \
|
||||||
@@ -2181,14 +2099,6 @@ my.GridRow = Backbone.View.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
template: ' \
|
template: ' \
|
||||||
<td> \
|
|
||||||
<div class="btn-group row-header-menu"> \
|
|
||||||
<a class="btn dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a> \
|
|
||||||
<ul class="dropdown-menu data-table-menu"> \
|
|
||||||
<li class="write-op"><a data-action="deleteRow" href="JavaScript:void(0);">Delete this row</a></li> \
|
|
||||||
</ul> \
|
|
||||||
</div> \
|
|
||||||
</td> \
|
|
||||||
{{#cells}} \
|
{{#cells}} \
|
||||||
<td data-field="{{field}}" style="width: {{width}}px; max-width: {{width}}px; min-width: {{width}}px;"> \
|
<td data-field="{{field}}" style="width: {{width}}px; max-width: {{width}}px; min-width: {{width}}px;"> \
|
||||||
<div class="data-table-cell-content"> \
|
<div class="data-table-cell-content"> \
|
||||||
@@ -3721,7 +3631,7 @@ my.Timeline = Backbone.View.extend({
|
|||||||
"startDate": start,
|
"startDate": start,
|
||||||
"endDate": end,
|
"endDate": end,
|
||||||
"headline": String(record.get('title') || ''),
|
"headline": String(record.get('title') || ''),
|
||||||
"text": record.get('description') || this.model.recordSummary(record)
|
"text": record.get('description') || record.summary()
|
||||||
};
|
};
|
||||||
return tlEntry;
|
return tlEntry;
|
||||||
} else {
|
} else {
|
||||||
@@ -4365,7 +4275,6 @@ my.QueryEditor = Backbone.View.extend({
|
|||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var tmplData = this.model.toJSON();
|
var tmplData = this.model.toJSON();
|
||||||
tmplData.to = this.model.get('from') + this.model.get('size');
|
|
||||||
var templated = Mustache.render(this.template, tmplData);
|
var templated = Mustache.render(this.template, tmplData);
|
||||||
this.el.html(templated);
|
this.el.html(templated);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user