Permalink
Please sign in to comment.
Browse files
Setup ESlint for project; resolves #89. (#97)
* Setup ESlint to project; resolves #89. - Add ESlint config - Update gitignore - Update TravisCI config - Add Rake task - Clean-up JS files - Ignore some JS files
- Loading branch information...
Showing
with
1,634 additions
and 85 deletions.
- +13 −0 .eslintrc
- +2 −0 .gitignore
- +3 −0 .travis.yml
- +8 −0 README.md
- +6 −1 Rakefile
- +1 −1 app/assets/javascripts/application.js
- +6 −6 app/assets/javascripts/cable.js
- +28 −29 app/assets/javascripts/graphs.js
- +2 −2 app/assets/javascripts/sigma.min.js
- +1 −1 app/assets/javascripts/sigma.parsers.gexf.min.js
- +2 −0 app/assets/javascripts/sorttable.js
- +43 −43 app/assets/stylesheets/auk/override_bootstrap.scss
- +1,498 −0 package-lock.json
- +21 −2 package.json
@@ -0,0 +1,13 @@ | |||
{ | |||
"extends": "airbnb-base/legacy", | |||
"globals": { | |||
"jQuery": true, | |||
"$": true, | |||
"sigma": true, | |||
"auk": true | |||
}, | |||
"rules": { | |||
"no-param-reassign": [2, { "props": false }], | |||
"func-names": ["error", "never"] | |||
} | |||
} |
@@ -1,13 +1,13 @@ | |||
// Action Cable provides the framework to deal with WebSockets in Rails. | |||
// You can generate new channels where WebSocket features live using the `rails generate channel` command. | |||
// You can generate new channels where WebSocket features live using the | |||
// `rails generate channel` command. | |||
// | |||
//= require action_cable | |||
//= require_self | |||
//= require_tree ./channels | |||
|
|||
(function() { | |||
this.App || (this.App = {}); | |||
(function () { | |||
this.App || (this.App = {}); // eslint-disable-line no-unused-expressions | |||
|
|||
App.cable = ActionCable.createConsumer(); | |||
|
|||
}).call(this); | |||
App.cable = ActionCable.createConsumer(); // eslint-disable-line no-undef | |||
}.call(this)); |
@@ -1,34 +1,33 @@ | |||
$(document).on('turbolinks:load', function() { | |||
if (typeof $("#graph").data("gexf") != 'undefined') { | |||
var gexfFileData = $("#graph").data("gexf"); | |||
create_graph(gexfFileData); | |||
} | |||
}); | |||
|
|||
function create_graph(data) { | |||
var so = new sigma("graph");; | |||
if (data != ``) { | |||
data = $.parseXML(data); | |||
sigma.parsers.gexf( | |||
data, | |||
so, | |||
function(y) { | |||
function createGraph(data) { | |||
var so = new sigma('graph'); // eslint-disable-line new-cap | |||
if (data !== '') { | |||
data = $.parseXML(data); // eslint-disable-line no-param-reassign | |||
sigma.parsers.gexf(data, so, function (y) { // eslint-disable-line no-unused-vars | |||
so.settings({ | |||
nodeColor: 'default', | |||
edgeColor: 'default', | |||
labelThreshold: 6, | |||
labelThreshold: 6 | |||
}); | |||
if (so.graph.nodes().length == 0) { | |||
so.graph.addNode({id: "empty", | |||
label: "(This graph is empty.)", | |||
x: 10, | |||
y: 10, | |||
size: 10, | |||
color: '#999'}); | |||
if (so.graph.nodes().length === 0) { | |||
so.graph.addNode({ | |||
id: 'empty', | |||
label: '(This graph is empty.)', | |||
x: 10, | |||
y: 10, | |||
size: 10, | |||
color: '#999' | |||
}); | |||
} | |||
} | |||
); | |||
so.refresh(); | |||
} else { | |||
$("#graph").append("Cannot find Gexf file"); | |||
}} | |||
}); | |||
so.refresh(); | |||
} else { | |||
$('#graph').append('Cannot find Gexf file'); | |||
} | |||
} | |||
|
|||
$(document).on('turbolinks:load', function () { | |||
if (typeof $('#graph').data('gexf') !== 'undefined') { | |||
var gexfFileData = $('#graph').data('gexf'); // eslint-disable-line vars-on-top | |||
createGraph(gexfFileData); | |||
} | |||
}); |
Oops, something went wrong.
0 comments on commit
d15b88b