-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
assets: backwards compatibility for Flask-Assets
* assets: backwards compatibility for Flask-Assets * docs: improvements * Closes #90
- Loading branch information
Showing
396 changed files
with
30,120 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
invenio-access>=1.1.0 | ||
invenio-accounts>=1.1.0 | ||
invenio-accounts>=1.1.0 | ||
invenio-db>=1.0.3 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* This file is part of Invenio. | ||
* Copyright (C) 2016-2019 CERN. | ||
* | ||
* Invenio is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
code[class*="language-"], | ||
pre[class*="language-"] { | ||
line-height: 1.0; | ||
} | ||
|
||
:not(pre) > code[class*="language-"], | ||
pre[class*="language-"] { | ||
background: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* This file is part of Invenio. | ||
* Copyright (C) 2015-2019 CERN. | ||
* | ||
* Invenio is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
import d3 from "d3"; | ||
import flight from "flightjs"; | ||
|
||
function CSV_D3JS() { | ||
var CSV_D3JS; | ||
|
||
this.tabulate = function(data, target, columns) { | ||
var table = d3 | ||
.select(target) | ||
.append("table") | ||
.classed({ | ||
table: true, | ||
"table-hover": true, | ||
"table-bordered": true, | ||
}); | ||
CSV_D3JS.thead = table.append("thead"); | ||
CSV_D3JS.tbody = table.append("tbody"); | ||
CSV_D3JS.columns = columns; | ||
CSV_D3JS.data = data; | ||
|
||
// append the header row | ||
CSV_D3JS.thead | ||
.append("tr") | ||
.selectAll("th") | ||
.data(CSV_D3JS.columns) | ||
.enter() | ||
.append("th") | ||
.text(function(column) { | ||
return column; | ||
}); | ||
|
||
CSV_D3JS.next = 1; | ||
CSV_D3JS.chunk_size = 500; | ||
CSV_D3JS.chunks = Math.ceil(CSV_D3JS.data.length / CSV_D3JS.chunk_size); | ||
|
||
CSV_D3JS.loadNext(undefined, { | ||
id: CSV_D3JS.id, | ||
}); | ||
if (CSV_D3JS.chunks > 1) { | ||
CSV_D3JS.trigger(document, "showLoader", { | ||
id: CSV_D3JS.id, | ||
}); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
this.loadNext = function(ev, data) { | ||
if (data.id === CSV_D3JS.id && CSV_D3JS.next <= CSV_D3JS.chunks) { | ||
// create a row for each object in the data chunk | ||
CSV_D3JS.tbody | ||
.selectAll("tr") | ||
.data(CSV_D3JS.data.slice(0, CSV_D3JS.next * CSV_D3JS.chunk_size)) | ||
.enter() | ||
.append("tr") | ||
.selectAll("td") | ||
.data(function(row) { | ||
return CSV_D3JS.columns.map(function(column) { | ||
return { column: column, value: row[column] }; | ||
}); | ||
}) | ||
.enter() | ||
.append("td") | ||
.text(function(d) { | ||
return d.value; | ||
}); | ||
|
||
if (CSV_D3JS.next === CSV_D3JS.chunks) { | ||
CSV_D3JS.trigger(document, "hideLoader", { | ||
id: CSV_D3JS.id, | ||
}); | ||
} | ||
CSV_D3JS.next += 1; | ||
} | ||
}; | ||
|
||
this.after("initialize", function() { | ||
CSV_D3JS = this; | ||
CSV_D3JS.id = CSV_D3JS.node.id; | ||
|
||
var delimiter = CSV_D3JS.$node.data("csv-delimiter"), | ||
encoding = CSV_D3JS.$node.data("csv-encoding"), | ||
resource = CSV_D3JS.$node.data("csv-source"), | ||
dsv = d3.dsv(delimiter, "text/csv; charset=" + encoding); | ||
|
||
dsv(resource, function(data) { | ||
var col = Object.keys(data[0]); | ||
CSV_D3JS.tabulate(data, CSV_D3JS.node, col); | ||
}); | ||
|
||
this.on(document, "loadNext", this.loadNext); | ||
}); | ||
} | ||
|
||
export default flight.component(CSV_D3JS); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* This file is part of Invenio. | ||
* Copyright (C) 2015-2019 CERN. | ||
* | ||
* Invenio is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
import $ from 'jquery'; | ||
import CSV_D3JS from './csv_d3js'; | ||
import Loader from './loader.js'; | ||
|
||
$(function () { | ||
$("[data-csv-source]").each(function () { | ||
CSV_D3JS.attachTo($(this)); | ||
}) | ||
$("[data-csv-target]").each(function () { | ||
Loader.attachTo($(this)); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* This file is part of Invenio. | ||
* Copyright (C) 2015-2019 CERN. | ||
* | ||
* Invenio is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
import flight from "flightjs"; | ||
|
||
function Loader() { | ||
var Loader; | ||
|
||
this.handleShowLoader = function(ev, data) { | ||
if (data.id === Loader.id) { | ||
this.$node.show(); | ||
} | ||
}; | ||
|
||
this.handleHideLoader = function(ev, data) { | ||
if (data.id === Loader.id) { | ||
this.$node.hide(); | ||
} | ||
}; | ||
|
||
this.after("initialize", function() { | ||
Loader = this; | ||
Loader.id = Loader.$node.data("csv-target"); | ||
|
||
Loader.on(document, "showLoader", Loader.handleShowLoader); | ||
Loader.on(document, "hideLoader", Loader.handleHideLoader); | ||
Loader.on("click", function(ev) { | ||
ev.preventDefault(); | ||
Loader.trigger(document, "loadNext", { | ||
id: Loader.id, | ||
}); | ||
}); | ||
|
||
Loader.$node.hide(); | ||
}); | ||
} | ||
|
||
export default flight.component(Loader); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.