Linting to perfection

This commit is contained in:
Maxime Beauchemin 2016-03-25 21:55:28 -07:00
parent c9203554e7
commit 8c0870e6ea
5 changed files with 19 additions and 20 deletions

View File

@ -57,7 +57,7 @@
}],
"max-depth": [2, 5],
"max-len": [0, 80, 4],
"max-nested-callbacks": [1, 2],
"max-nested-callbacks": [1, 3],
"max-params": [1, 4],
"new-parens": [2],
"newline-after-var": [0],

View File

@ -1,30 +1,25 @@
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;
var px = require('./modules/dashed.js');
require('../stylesheets/dashed.css');
require('../stylesheets/welcome.css');
require('bootstrap');
require('datatables');
require('d3');
require('../node_modules/cal-heatmap/cal-heatmap.css');
var CalHeatMap = require('cal-heatmap');
function modelViewTable(selector, modelEndpoint, ordering) {
// Builds a dataTable from a flask appbuilder api endpoint
$.getJSON(modelEndpoint + '/api/read', function (data) {
var tableData = jQuery.map(data.result, function(el, i) {
var row = $.map(data.list_columns, function(col, i) {
var tableData = jQuery.map(data.result, function (el, i) {
var row = $.map(data.list_columns, function (col, i) {
return el[col];
});
return [row];
});
var cols = jQuery.map(data.list_columns, function(col, i) {
return { "sTitle": data.label_columns[col] }
var cols = jQuery.map(data.list_columns, function (col, i) {
return { sTitle: data.label_columns[col] };
});
$(selector).DataTable({
aaData: tableData,
@ -43,8 +38,8 @@ $(document).ready(function () {
start: new Date().setFullYear(new Date().getFullYear() - 1),
range: 13,
data: '/dashed/activity_per_day',
domain : "month",
subDomain : "day",
domain: "month",
subDomain: "day",
itemName: "action",
tooltip: true
});

View File

@ -9,6 +9,10 @@ body {
font-size: 100%;
}
.no-wrap {
white-space: nowrap;
}
input.form-control {
background-color: white;
}

View File

@ -72,7 +72,7 @@ class AuditMixinNullable(AuditMixin):
@property
def modified(self):
s = humanize.naturaltime(datetime.now() - self.changed_on)
return "<nobr>{}</nobr>".format(s)
return '<span class="no-wrap">{}</nobr>'.format(s)
@property
def icons(self):

View File

@ -547,14 +547,14 @@ class Dashed(BaseView):
@expose("/activity_per_day")
def activity_per_day(self):
"""endpoint to power the calendar heatmap on the welcome page"""
Log = models.Log
Log = models.Log # noqa
qry = (
db.session
.query(
Log.dt,
sqla.func.count())
.group_by(Log.dt)
.all()
.query(
Log.dt,
sqla.func.count())
.group_by(Log.dt)
.all()
)
payload = {str(time.mktime(dt.timetuple())): ccount for dt, ccount in qry if dt}
return Response(json.dumps(payload), mimetype="application/json")