Skip to content

Commit 62fe3b0

Browse files
authored
Merge branch 'ccmd-frontend' into 115-sidebar-about
2 parents 5ea00c5 + 38156e1 commit 62fe3b0

File tree

4 files changed

+12
-31
lines changed

4 files changed

+12
-31
lines changed

prefix_finder/frontend/templates/home.html

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,6 @@
2323
</span>
2424
</label>
2525

26-
{% if lookups.substructure %}
27-
<label class="homepage__field">
28-
In particular
29-
<span class="homepage__select">
30-
<select name="substructure">
31-
<option value="">Any type</option>
32-
{% for code, title, disabled in lookups.substructure %}
33-
<option {% if query.substructure == code %}selected{% elif disabled %}disabled{% endif %} value="{{ code }}">{% if title|slice:"1" in "AEIOU" %}An{%else%}A{%endif%} {{ title|lower }}</option>
34-
{% endfor %}
35-
</select>
36-
</span>
37-
</label>
38-
{% endif %}
39-
4026
<label class="homepage__field">
4127
Registered in
4228
<span class="homepage__select">
@@ -49,27 +35,13 @@
4935
</span>
5036
</label>
5137

52-
{% if lookups.subnational %}
53-
<label class="homepage__field">
54-
In the state or region of
55-
<span class="homepage__select">
56-
<select name="subnational">
57-
<option value="">Any subnational location</option>
58-
{% for code, title, disabled in lookups.subnational %}
59-
<option {% if query.subnational == code %}selected{% elif disabled %}disabled{% endif %} value="{{ code }}">{{ title }}</option>
60-
{% endfor %}
61-
</select>
62-
</span>
63-
</label>
64-
{% endif %}
65-
6638
<label class="homepage__field">
6739
Working in
6840
<span class="homepage__select">
6941
<select name="sector" >
7042
<option value="">Any sector</option>
7143
{% for code, title, disabled in lookups.sector %}
72-
<option {% if query.sector == code %}selected{% elif disabled %}disabled{% endif %} value="{{ code }}">{{ title }}</option>
44+
<option {% if query.sector == code %}selected{% elif disabled %}disabled{% endif %} value="{{ code }}">{{ title }}</option>
7345
{% endfor %}
7446
</select>
7547
</span>

prefix_finder/frontend/templates/sidebar.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
<div class="sidebar__main">
77
{% if request.resolver_match.url_name == "list" %}
8-
<a href="{% url "results" %}" class="button button--main-color button--block"><i class="material-icons">arrow_back</i><span>Back to List</span></a>
8+
{% if request.META.HTTP_REFERER %}
9+
<a href="{{ request.META.HTTP_REFERER }}" class="button button--main-color button--block"><i class="material-icons">arrow_back</i><span>Back to List</span></a>
10+
{% else %}
11+
<a href="{% url "results" %}" class="button button--main-color button--block"><i class="material-icons">arrow_back</i><span>Back to List</span></a>
12+
{% endif %}
913

1014
{% elif request.resolver_match.url_name == "about" %}
1115
<a href="{% url "home" %}" class="button button--main-color button--block"><i class="material-icons">arrow_back</i><span>Back to Home</span></a>

prefix_finder/frontend/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ def refresh_data(branch="master"):
181181

182182
try:
183183
sha = requests.get(
184-
'https://api.github.com/repos/org-id/register/branches/'+branch
184+
'https://api.github.com/repos/org-id/register/branches/'+branch,
185+
auth=(settings.GITHUB_USER, settings.GITHUB_API_TOKEN) if settings.GITHUB_USER and settings.GITHUB_API_TOKEN else ''
185186
).json()['commit']['sha']
186187
using_github = True
187188
if sha == git_commit_ref.get(branch,''):

prefix_finder/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
SECRET_KEY=(str, secret_key),
3333
DB_NAME=(str, os.path.join(BASE_DIR, 'db.sqlite3')),
3434
LOCAL_DATA=(bool, False),
35+
GITHUB_USER=(str, ''),
36+
GITHUB_API_TOKEN=(str, ''),
3537
)
3638

3739
PIWIK = {
@@ -40,6 +42,8 @@
4042
}
4143

4244
LOCAL_DATA = env('LOCAL_DATA')
45+
GITHUB_USER = env('GITHUB_USER')
46+
GITHUB_API_TOKEN = env('GITHUB_API_TOKEN')
4347

4448
# Quick-start development settings - unsuitable for production
4549
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

0 commit comments

Comments
 (0)