Skip to content

Commit

Permalink
Move from highcharts-browserify to highcharts, upgrade eslint, lint f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
benthemonkey committed Mar 6, 2016
1 parent c99a8c0 commit 7100208
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ rules:
func-style: [2, "expression"]
indent: [1, 4]
key-spacing: [1, {"beforeColon": false, "afterColon": true}]
keyword-spacing: [1, {"before": true, "after": true}]
linebreak-style: 2
max-len: [1, 120]
new-cap: [2, {"capIsNewExceptions": ["HmacSHA256"]}]
Expand All @@ -103,7 +104,6 @@ rules:
padded-blocks: [1, "never"]
quotes: [1, "single"]
semi: [2, "always"]
space-after-keywords: [1, "always"]
space-before-blocks: [1, "always"]
space-before-function-paren: [1, "never"]
spaced-comment: [1, "always"]
Expand Down
21 changes: 11 additions & 10 deletions js/directory.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
/* eslint strict:0 */

jQuery(function() {
$(function() {
'use strict';

var checkForDataTables = function() {
if (typeof($().DataTable) === 'undefined') {
setTimeout(checkForDataTables, 100);
} else {
init();
}
},
init = function() {
var init = function() {
$.getJSON('/points/ajax/getDirectory.php', function(data) {
var i;
var path = 'http://slivka.northwestern.edu/points/img/slivkans/';
Expand Down Expand Up @@ -54,7 +47,15 @@ jQuery(function() {
$('#submitdirectorypass').click();
}
});
}
};

var checkForDataTables = function() {
if (typeof($().DataTable) === 'undefined') {
setTimeout(checkForDataTables, 100);
} else {
init();
}
};

$.getScript('/points/node_modules/datatables/media/js/jquery.dataTables.min.js', checkForDataTables);
});
2 changes: 1 addition & 1 deletion js/points-center/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var _ = {
forEach: require('lodash/forEach')
};
var utils = require('./utils');
var slivkans, nicknames;
var slivkans;
var submitConfigOrQuarterInfo = function(name, value, confirmMessage) {
if (window.confirm(confirmMessage)) {
$.post(utils.ajaxRoot + '/ajax/submitConfigOrQuarterInfo.php', { name: name, value: value }, function(status) {
Expand Down
5 changes: 3 additions & 2 deletions js/points-center/breakdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var _ = {
forEach: require('lodash/forEach'),
template: require('lodash/template')
};
var highcharts = require('highcharts-browserify');
var highcharts = require('highcharts');
var ajaxRoot = require('./utils').ajaxRoot;
var slivkans, qtrs;
var eventsTemplate = _.template($('#eventsTemplate').html(), { imports: { forEach: _.forEach } });
Expand All @@ -19,8 +19,9 @@ var $eventsChart = $('#eventsChart');
var $imsChart = $('#imsChart');

var drawChart = function($el, tableData, titleIn, width) {
$el.highcharts({
highcharts.chart({
chart: {
renderTo: $el[0],
width: width
},
credits: {
Expand Down
2 changes: 1 addition & 1 deletion js/points-center/committee-headquarters.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ module.exports = {

if (newVal < -3) {
ptsInput.val(-3);
}else if (newVal > 3) {
} else if (newVal > 3) {
ptsInput.val(3);
} else {
ptsInput.val(newVal);
Expand Down
11 changes: 0 additions & 11 deletions js/points-center/correction.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
'use strict';

var _ = {
findIndex: require('lodash/findIndex')
};
var typeahead = require('typeahead.js');
var utils = require('./utils');
var slivkans;
var resetForm = function() {
$('#filled-by').val('');
$('.filled-by-control').removeClass('has-success has-error');
$('#event-name').val('Select One');
$('#comments').val('');
$('#submit-error').fadeOut();
};

var validateFilledBy = function() {
return utils.updateValidity($('.filled-by-control'), utils.findSlivkan(slivkans, $('#filled-by').val()));
Expand Down
1 change: 1 addition & 0 deletions js/points-center/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
window.$ = window.jQuery = require('jquery');
require('bootstrap-sass/assets/javascripts/bootstrap');
require('bootstrap-multiselect/dist/js/bootstrap-multiselect');
require('typeahead.js');

$(function() {
var nprogress = require('nprogress');
Expand Down
1 change: 1 addition & 0 deletions js/points-center/rankings.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var qtrToQuarter = function(qtr) {
case 2:
return 'Spring 20' + yr;
case 3:
default:
return 'Fall 20' + yr;
}
};
Expand Down
2 changes: 1 addition & 1 deletion js/points-center/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ module.exports = {
$(window).on('keydown', function(event) {
if (event.keyCode === 13) { // prevent [Enter] from causing form submit
event.preventDefault();
return false;
event.stopPropogation();
}
});

Expand Down
4 changes: 2 additions & 2 deletions js/points-center/table.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

var datatables = require('datatables');
var utils = require('./utils');
var i, table, events;

var columnFilter = function() {
Expand Down Expand Up @@ -31,6 +29,8 @@ var columnFilter = function() {
table.draw();
};

require('datatables'); // used for its side-effects

module.exports = {
init: function() {
var eventName, name, date;
Expand Down
13 changes: 0 additions & 13 deletions js/points-center/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ var _ = {
};
var Bloodhound = require('typeahead.js/dist/bloodhound');

// Track TAB_PRESSED for destroyTypeahead
var TAB_PRESSED = false;

$(window).on('keydown', function(event) {
if (event.keyCode === 9 && !event.shiftKey) {
TAB_PRESSED = true;
}
}).on('keyup', function(event) {
if (event.keyCode === 9) {
TAB_PRESSED = false;
}
});

module.exports.ajaxRoot = '/points';

module.exports.appendSlivkanInputs = function(n) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "points-center",
"version": "0.1.0",
"private": true,
"description": "Slivka Points Center",
"main": "js/points-center/index.js",
"dependencies": {
"bootstrap-multiselect": "0.9.13",
"bootstrap-sass": "^3.3.5",
"datatables": "1.10.9",
"font-awesome": "4.5.0",
"highcharts-browserify": "0.1.5",
"highcharts": "^4.2.3",
"jquery": "1.11.1",
"lodash": "4.5.1",
"moment": "2.11.2",
Expand Down

0 comments on commit 7100208

Please sign in to comment.