Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit 1322a52

Browse files
committed
Merge remote-tracking branch 'upstream/main' into main
2 parents 508faea + a346ce6 commit 1322a52

File tree

7 files changed

+65
-36
lines changed

7 files changed

+65
-36
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ geodjango/
133133

134134
tests-ui/screenshots/
135135

136+
static/
136137

137138

138139
static/

publications/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ class OJSservers(models.Model):
2929
last_harvest = models.DateTimeField(auto_now_add=True,null=True)
3030

3131
class Subscription(models.Model):
32-
search_text = models.CharField(max_length=4096)
32+
name = models.CharField(max_length=4096)
3333
timeperiod_startdate = models.DateField(null=True)
3434
timeperiod_enddate = models.DateField(null=True)
3535
search_area = models.GeometryCollectionField(null=True, blank=True)
3636
user_name = models.CharField(max_length=4096)
3737

3838
def __str__(self):
3939
"""Return string representation."""
40-
return self.search_text
40+
return self.name
4141

4242
class Meta:
4343
ordering = ['user_name']

publications/static/js/subscriptions.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ async function rendersubscriptions() {
6363
rendersubscriptions();
6464

6565

66-
67-
68-
69-
70-
71-
=======
7266
//to trigger datepicker
7367
$(function () {
7468
$('#datepicker1').datepicker({

publications/static/js/timeline.js

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,51 @@
1+
const container = document.getElementById("timeline");
2+
3+
// Create a DataSet (allows two way data-binding)
4+
const articles = new vis.DataSet([
5+
{ id: 1, content: "article 1", start: "2007-03-05", end: "2015-10-10" },
6+
{ id: 2, content: "article 2", start: "2005-08-23", end: "2013-06-01" },
7+
{ id: 3, content: "article 3", start: "2015-08-20", end: "2018-04-26"},
8+
{ id: 4, content: "article 4", start: "2004-01-11", end: "2005-02-25" },
9+
{ id: 5, content: "article 5", start: "2011-03-12", end: "2014-10-11"},
10+
{ id: 6, content: "article 6", start: "2002-02-25", end : "2013-02-25" , title : '<b>titleofarticle</b><br><p>Journal</p>'},
11+
{ id: 7, content: "article 7", start: "2003-08-04", end: "2012-07-08" },
12+
{ id: 8, content: "article 8", start: "2011-03-18", end: "2011-10-28" },
13+
{ id: 9, content: "article 9", start: "2011-06-04", end: "2014-09-29" },
14+
{ id: 10, content: "article 10", start: "2006-08-27", end: "2013-02-24" },
15+
{ id: 11, content: "article 11", start: "2002-01-28", end: "2004-10-19" },
16+
{ id: 12, content: "article 12", start: "2007-11-21", end: "2012-09-25" },
17+
{ id: 13, content: "article 13", start: "2005-01-20", end: "2011-04-20" },
18+
{ id: 14, content: "article 14", start: "2009-03-24", end: "2014-11-23" },
19+
{ id: 15, content: "article 15", start: "2002-10-16", end: "2008-02-20" },
20+
{ id: 16, content: "article 16", start: "2001-08-07", end: "2005-07-06" },
21+
{ id: 17, content: "article 17", start: "2006-12-24", end: "2015-11-04" },
22+
{ id: 18, content: "article 18", start: "2009-07-05", end: "2015-08-30" },
23+
{ id: 19, content: "article 19", start: "2014-06-02", end: "2015-05-20" },
24+
{ id: 20, content: "article 20", start: "2002-09-12", end: "2010-08-08" },
25+
{ id: 21, content: "article 21", start: "2008-03-04", end: "2013-05-04" },
26+
{ id: 22, content: "article 22", start: "2010-02-21", end: "2015-07-31" },
27+
{ id: 23, content: "article 23", start: "2004-10-30", end: "2006-04-07" },
28+
{ id: 24, content: "article 24", start: "2000-06-15", end: "2003-08-13" },
29+
{ id: 25, content: "article 25", start: "2011-03-19", end: "2014-10-29" },
30+
]);
31+
32+
// Configuration for the Timeline
33+
const options = {
34+
stack: true,
35+
verticalScroll: true,
36+
zoomKey: 'ctrlKey',
37+
maxHeight: 600,
38+
timeAxis: {scale: 'year', step: 2},
39+
start : "2000-01-01",
40+
};
41+
42+
// Create a Timeline
43+
timeline = new vis.Timeline(container, articles, options);
44+
//timeline.setWindow('2010-05-01', '2019-04-01');
45+
46+
47+
48+
149

2-
async function getarticle() {
3-
try {
4-
let response = await fetch(publications_url);
5-
let body = await response.json();
6-
return body.results;
7-
} catch (error) {
8-
console.log(error);
9-
}
10-
}
11-
12-
async function renderarticle() {
13-
let data = await getarticle();
14-
console.log('Type:', data.features[0].properties['publicationDate'])
15-
const f = data.features.length
16-
for (var index = 0; index < f ; ++index){
17-
document.getElementById("timeline").innerHTML += '<li>' +'<a href="#">' + data.features[index].properties['title'] + "-" + data.features[index].properties['publicationDate'] +'</a>'+ '</li>';
18-
}
19-
}
20-
21-
renderarticle();
2250

2351

publications/templates/main.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<!-- Leaflet-->
77

88
<link rel="stylesheet" href="{% static 'css/leaflet.css' %}" />
9+
<script type="text/javascript" src="https://unpkg.com/vis-timeline@latest/standalone/umd/vis-timeline-graph2d.min.js"></script>
910
<script src="{% static 'js/leaflet.js' %}"></script>
1011
{% endblock %}
1112

@@ -60,7 +61,7 @@
6061
{% block content %}
6162
<div class="row">
6263
<!-- chart -->
63-
<div class="col-sm-2">
64+
<div class="col-sm-5">
6465
<div id="sidebar" class="flex-column p-2">
6566
<p>Timeline</p>
6667
<div class="p-2" id="timeline">

publications/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
path("logout/", customlogout, name="logout"),
2929
path("usersettings/", user_settings, name="usersettings"),
3030
path("subscriptions/", user_subscriptions, name="subscriptions"),
31-
path("addsubscriptions/", add_subscriptions, name="addsubscriptions"),
31+
path("addsubscriptions/", add_subscriptions, name="addsubscriptions"),
3232
path("delete/", delete_account, name="delete"),
33-
path("changeuser/", change_useremail, name="changeuser"),
33+
path("changeuser/", change_useremail, name="changeuser"),
3434
]

publications/views.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,22 @@ def user_settings(request):
122122
return render(request,'user_settings.html')
123123

124124
def user_subscriptions(request):
125-
subs = Subscription.objects.all()
126-
count_subs = Subscription.objects.all().count()
127-
return render(request,'subscriptions.html',{'sub':subs,'count':count_subs})
128-
125+
if request.user.is_authenticated:
126+
subs = Subscription.objects.all()
127+
count_subs = Subscription.objects.all().count()
128+
return render(request,'subscriptions.html',{'sub':subs,'count':count_subs})
129+
else:
130+
pass
129131
def add_subscriptions(request):
130132
if request.method == "POST":
131133
search_term = request.POST.get("search", False)
132134
start_date = request.POST.get('start_date', False)
133135
end_date = request.POST.get('end_date', False)
134136
currentuser = request.user
135-
user_name = currentuser.username
137+
if currentuser.is_authenticated:
138+
user_name = currentuser.username
139+
else :
140+
user_name = None
136141
start_date_object = datetime.strptime(start_date, '%m/%d/%Y')
137142
end_date_object = datetime.strptime(end_date, '%m/%d/%Y')
138143

0 commit comments

Comments
 (0)