Skip to content
This repository was archived by the owner on Dec 22, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ VirtualBox and Vagrant, and cloning the [git repository][repo]:
5. Activate the virtualenv environment: `source env/bin/activate`
6. Start the development server: `python manage.py runserver
192.168.33.10:8000`
* Note the IP address on the end: if you omit this,
* Note the IP address on the end: if you omit this, the server will not be accessible from your real machine
7. Point your web browser to <http://192.168.33.10:8000>

When you've finished working, you can quit the webserver if it's still
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@
iframe.style.zIndex = "2147483640";
iframe.style.boxSizing = "border-box";
iframe.style.MozBoxSizing = "border-box";
iframe.style.padding = "15px";
iframe.style.borderLeft = "2px #555 dashed";
iframe.style.background = "white";
iframe.style.padding = "0 0 0 5px";
iframe.style.borderLeft = "1px #555 dashed";
iframe.style.borderTop = "none";
iframe.style.background = "#ddd";
iframe.style.height = "100%";
iframe.style.width = "350px";
iframe.style.bottom = "0";
Expand Down
6 changes: 3 additions & 3 deletions oabutton/apps/bookmarklet/templates/bookmarklet/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

{% block footer %}
<div class="container bookmarklet-footer">
<hr />
<p>For instructions, more info and your contribution head to <a href="http://www.openaccessbutton.org" target="_blank">www.openaccessbutton.org</a></p>
<hr />
<p>For more information and the world map of contributions, visit
<b><a href="http://www.openaccessbutton.org" target="_blank">OpenAccessButton.org</a></b>
</p>
<div class="row">
<div>
<a class="pull-left" href="mailto:[email protected]?subject=OAButton Bug Report (version {{ VERSION }})">Report a bug</a>
Expand Down
4 changes: 1 addition & 3 deletions oabutton/apps/bookmarklet/templates/bookmarklet/page1.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
{{ bookmarklet.slug }}

<div class="control-group raleway-font">
<p>You've hit a paywall!?</p>
<p>That sucks.</p>
<p>Tell us why and we'll put you on the map.</p>
<p>Share your problem accessing this paper, and put yourself on the Open Access map:</p>
</div>


Expand Down
5 changes: 2 additions & 3 deletions oabutton/apps/bookmarklet/templates/bookmarklet/page2.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{% extends "bookmarklet/layout.html" %}{% block content %}
<div class="control-group raleway-font">
<p>
Before we try and get you access, why not share your frustration -
help make this problem visible!
Share your interest in this research to make the barrier to access more visible:
</p>

<p>
Expand All @@ -27,7 +26,7 @@
</p>

<p>
We're also on <a href="https://www.facebook.com/openaccessbutton">Facebook</a> and <a href="https://twitter.com/OA_Button">Twitter</a>! Join us!
Follow us on <a href="https://www.facebook.com/openaccessbutton">Facebook</a> and <a href="https://twitter.com/OA_Button">Twitter</a> for Open Access updates.
</p>
</div>

Expand Down
11 changes: 5 additions & 6 deletions oabutton/apps/bookmarklet/templates/bookmarklet/page3.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ <h2>Thanks!</h2>
{% endif %}


<p>Below are a number of ways to get access to your paper, unfortunately
they won't always work but it's worth a shot.
<p>We are working on ways to instantly suggest alternative sites
where you could find this research. We're sorry that this feature
is currently offline while we develop the new version. Your interest
and support is important, please get in touch and help us connect
people like yourself to vital research quickly.
</p>


Expand Down Expand Up @@ -50,10 +53,6 @@ <h4>Email a request for the paper directly to the author</h4>
<hr />
{% endif %}

<div>
<h4>Searching for related documents</h4>
</div>

<div class="row-block">
<div class="row">
<div id="pmc_links" class="col-md-12 row-block">
Expand Down
8 changes: 6 additions & 2 deletions oabutton/apps/template_email/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from django.template import loader, Context

from socket import gaierror

class TemplateEmail(EmailMultiAlternatives):
"""
Expand Down Expand Up @@ -63,4 +63,8 @@ def send(self, *args, **kwargs):
self.to[i] = '"%s %s" <%s>' % (user.first_name, user.last_name,
user.email)

super(TemplateEmail, self).send(*args, **kwargs)
try:
super(TemplateEmail, self).send(*args, **kwargs)
except gaierror:
# TODO: logging?
return False
3 changes: 2 additions & 1 deletion oabutton/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class Bookmarklet(forms.Form):
widget=forms.TextInput(attrs={
'placeholder': "e.g. London, United Kingdom",
'class': "form-control input-block-level",
'required': True}))
# 'required': False
}))

doi = forms.CharField(required=False, label="Digital Object Identifier (DOI)",
widget=forms.TextInput(attrs={'class': "form-control input-block-level"},
Expand Down
17 changes: 12 additions & 5 deletions oabutton/static/public/js/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $(function() {
rounded_lat = Math.round(position.coords.latitude * 10) / 10;
rounded_long = Math.round(position.coords.longitude * 10) / 10;
$('#id_coords').val([rounded_lat, rounded_long]);
$('#id_location').attr({'placeholder': 'Detected from browser', 'required': false, 'readonly': 'readonly'});
$('#id_location').attr({'placeholder': 'Detected from browser', 'required': 'false', 'readonly': 'readonly'});
}

function denyAccess(error) {
Expand Down Expand Up @@ -163,6 +163,11 @@ $(function() {
rememberDetails();

function geocode(form) {
// Geolocation is optional
if ($('#id_location').val() == "")
return false;

// Geocode the location if provided
return $.ajax({
url: 'https://maps.googleapis.com/maps/api/geocode/json',
data: {
Expand All @@ -180,6 +185,9 @@ $(function() {
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
// Unable to geocode; clear form and submit
$('#id_location').val('');
form.submit();
}
});
}
Expand All @@ -188,10 +196,9 @@ $(function() {
var form = $(this);

// Do geocoding only if needed
if (!$('#id_coords').val()) {
event.preventDefault();
geocode(form);
}
if (!$('#id_coords').val())
if (geocode(form) !== false)
event.preventDefault();
}

$('#id_accessed').val(new Date().toISOString());
Expand Down
8 changes: 4 additions & 4 deletions oabutton/static/public/js/lib/jquery.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions oabutton/static/public/js/lib/jquery.min.map

Large diffs are not rendered by default.