Skip to content

Commit

Permalink
Merge pull request #119 from epfl-si/new-chart-render
Browse files Browse the repository at this point in the history
New chart render
  • Loading branch information
jdelasoie authored Jun 22, 2020
2 parents 6a1ff50 + 2d11d44 commit e74f3ea
Show file tree
Hide file tree
Showing 78 changed files with 2,465 additions and 953 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[run]
branch = True

include =
include =
./infoscience_exports/*.py

omit =
omit =
*/migrations/*,
*/test/*,
*/pytests/*,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ env/lib64
env/pyvenv.cfg
db_data/
backup/
/infoscience_exports/exports/test/html/export_rendered.html
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
up down logs restart restart-web \
superadmin collectstatic migrations migrate \
dump restore release push-prod deploy \
fast-test test coverage shell bash \
fast-test test test-render stop coverage shell bash \
migration-load-dump migration-build-delta \
migration-post-generate-csvs migration-migrate \
migration-migrate-selective-with-subset migration-migrate-all \
Expand Down Expand Up @@ -98,6 +98,9 @@ reset: build up
up:
docker-compose -f docker-compose-dev.yml up -d

stop:
docker-compose -f docker-compose-dev.yml stop

down:
docker-compose -f docker-compose-dev.yml down

Expand Down Expand Up @@ -246,6 +249,10 @@ test: check-env
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py test exports --settings=settings.test --noinput

test-render: check-env
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py test --failfast exports.test.test_crud_views:ExportRenderTest --settings=settings.test-silent-coverage --noinput

shell:
docker-compose -f docker-compose-dev.yml exec web \
python infoscience_exports/manage.py shell_plus
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ faker = "*"
"flake8" = "*"
ipdb = "*"
ipython = "*"
lxml = "*"
mkdocs = "*"
mock = "*"
nose-progressive = "*"
Expand Down
35 changes: 34 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

185 changes: 0 additions & 185 deletions add_title_shorts.patch

This file was deleted.

Binary file added doc/INF_Export-Rendu-Champs.docx
Binary file not shown.
6 changes: 3 additions & 3 deletions infoscience_exports/exports/marc21xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Author:

def __init__(self, author):
self.fullname = author
self.search_url = "{}/search?p={}".format(
settings.SITE_DOMAIN, author.replace(",", "+").replace(" ", "+"))
self.search_url = "https://infoscience.epfl.ch/search?p={}".format(
author.replace(",", "+").replace(" ", "+"))
self.initname = self.compute_name()

def compute_name(self):
Expand Down Expand Up @@ -277,7 +277,7 @@ def import_marc21xml(url, can_display_pending_publications):
dict_record = parse_dict(record.as_dict())
dict_result['Id'] = dict_record['control_number']
dict_result['Infoscience_URL'] = "{}/record/{}".format(
settings.SITE_DOMAIN, dict_record['control_number'])
'https://infoscience.epfl.ch', dict_record['control_number'])
dict_result['ELA_Icon'] = dict_record['electronic_location_access']['icon']
dict_result['ELA_URL'] = dict_record['electronic_location_access']['fulltexts']
dict_result['DOI'] = dict_record['other_standard_identification_doi']
Expand Down
11 changes: 8 additions & 3 deletions infoscience_exports/exports/options_notices.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,15 @@ def validate_url(url):
url = modify_url(url, queries, "sf", "year", True)
url = modify_url(url, queries, "so", "d", False)

if 'rg' in queries and queries['rg'][0] == '10':
url = url.replace("rg=10", "rg=" + str(settings.RANGE_DISPLAY))
if settings.RANGE_DISPLAY:
max_limit = settings.RANGE_DISPLAY
else:
max_limit = 100 # should be a good limit by default

if 'rg' in queries and queries['rg'][0] == '10': #HACK: 10 = meaning we have the default, so we want more
url = url.replace("rg=10", "rg=" + str(max_limit))
elif '&rg=' not in url:
url = url + "&rg=" + str(settings.RANGE_DISPLAY)
url = url + "&rg=" + str(max_limit)

return url

Expand Down
2 changes: 1 addition & 1 deletion infoscience_exports/exports/pytests/test_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def expected_url(name):
return "{}/search?p={}".format(settings.SITE_DOMAIN, name)
return "{}/search?p={}".format("https://infoscience.epfl.ch", name)


def test_standard_case():
Expand Down
18 changes: 14 additions & 4 deletions infoscience_exports/exports/static/js/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ jQuery(function($) {
$('#export_form').submit();
});

$('#display-mrc21xml').ready(function () {
$('#display-mrc21xml-loading').hide();
$("#display-mrc21xml").show();
});

$('#display-mrc21xml').load(function () {
$('#display-mrc21xml-loading').hide();
$("#display-mrc21xml").show();
});

$('#btn-preview').click(function () {
$("#display-mrc21xml").html('<div class="alert alert-info" role="alert"><span>'+$("#display-mrc21xml").attr('data-progress')+'</span></div>');
$('#display-mrc21xml-loading').show();
$("#display-mrc21xml").hide();
var params = {};
params['url'] = $("#id_url").val();
params['format'] = $("#id_formats_type").find(":selected").val();
Expand Down Expand Up @@ -52,9 +63,8 @@ jQuery(function($) {
params['adv_book_chapter_doi'] = $("#id_show_book_chapter_doi").is(':checked');
params['adv_patent_status'] = $("#id_show_patent_status").is(':checked');

$.get(INFOSCIENCE_PATH+'/preview/', {params: params}, function (data) {
($("#display-mrc21xml").html(data));
});
full_url = INFOSCIENCE_PATH + '/preview/?' + $.param(params);
$("#display-mrc21xml").attr("src", full_url);
});

$('.fa-clipboard').click(function () {
Expand Down
2 changes: 1 addition & 1 deletion infoscience_exports/exports/templates/base/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!--<script type="text/javascript" src="//infoscience.epfl.ch/js/jquery.min.js"></script>-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="//infoscience.epfl.ch/js/tind.js?d87f701abc988557a2d54ac310781f13"></script>

{% block headcss %}{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion infoscience_exports/exports/templates/base/en/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
{% block headcss %}{% endblock %}

<script src="{% static "js/export.js" %}" type="text/javascript"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="{% static "css/export.css" %}" rel="stylesheet">

Expand Down
2 changes: 1 addition & 1 deletion infoscience_exports/exports/templates/base/fr/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{% block headcss %}{% endblock %}

<script src="{% static "js/export.js" %}" type="text/javascript"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="{% static "css/export.css" %}" rel="stylesheet">

Expand Down
Loading

0 comments on commit e74f3ea

Please sign in to comment.