Skip to content

Commit

Permalink
Linting to perfection
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Mar 26, 2016
1 parent c920355 commit 8c0870e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dashed/assets/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
19 changes: 7 additions & 12 deletions dashed/assets/javascripts/welcome.js
Original file line number Diff line number Diff line change
@@ -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');


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,
Expand All @@ -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
});
Expand Down
4 changes: 4 additions & 0 deletions dashed/assets/stylesheets/dashed.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ body {
font-size: 100%;
}

.no-wrap {
white-space: nowrap;
}

input.form-control {
background-color: white;
}
Expand Down
2 changes: 1 addition & 1 deletion dashed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def changed_by_(self):
@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):
Expand Down
12 changes: 6 additions & 6 deletions dashed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,14 @@ def checkbox(self, model_view, id_, attr, value):
@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")
Expand Down

0 comments on commit 8c0870e

Please sign in to comment.