Navigation Menu

Skip to content

Commit

Permalink
Updates based off PR reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Jun 21, 2017
1 parent 2e54f1a commit e03269e
Show file tree
Hide file tree
Showing 36 changed files with 116 additions and 109 deletions.
4 changes: 2 additions & 2 deletions csunplugged/general/urls.py
Expand Up @@ -5,10 +5,10 @@
from . import views

urlpatterns = [
url(r"^$", views.GeneralIndexView.as_view(), name="home"),
url(r"^about/$", views.GeneralAboutView.as_view(), name="about"),
url(r"^computational-thinking/$", views.ComputationalThinkingView.as_view(), name="computational_thinking"),
url(r"^contact/$", views.GeneralContactView.as_view(), name="contact"),
url(r"^people/$", views.GeneralPeopleView.as_view(), name="people"),
url(r"^principles/$", views.GeneralPrinciplesView.as_view(), name="principles"),
url(r"^computational-thinking/$", views.ComputationalThinkingView.as_view(), name="computational_thinking"),
url(r"^$", views.GeneralIndexView.as_view(), name="home"),
]
4 changes: 2 additions & 2 deletions csunplugged/resources/management/commands/_ResourcesLoader.py
Expand Up @@ -16,8 +16,8 @@ def __init__(self, structure_file, BASE_PATH):
"""Create the loader for loading resources.
Args:
structure_file: file path for structure YAML file (string)
BASE_PATH: base file path (string)
structure_file: file path for structure YAML file (str).
BASE_PATH: base file path (str).
"""
super().__init__(BASE_PATH)
self.structure_file = structure_file
Expand Down
2 changes: 1 addition & 1 deletion csunplugged/resources/models.py
Expand Up @@ -18,6 +18,6 @@ def __str__(self):
"""Text representation of Resource object.
Returns:
Name of resource (string).
Name of resource (str).
"""
return self.name
12 changes: 6 additions & 6 deletions csunplugged/resources/views/binary_cards.py
Expand Up @@ -9,11 +9,11 @@ def resource_image(request, resource):
"""Create a image for Binary Cards resource.
Args:
request: HTTP request object.
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A list of Pillow image objects.
A list of Pillow image objects (list).
"""
BASE_IMAGE_PATH = "static/img/resources/binary-cards/"
IMAGE_SIZE_X = 2480
Expand Down Expand Up @@ -76,11 +76,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
text for subtitle (str).
"""
if retrieve_query_parameter(request, "display_numbers"):
display_numbers_text = "with numbers"
Expand Down
12 changes: 6 additions & 6 deletions csunplugged/resources/views/binary_cards_small.py
Expand Up @@ -9,11 +9,11 @@ def resource_image(request, resource):
"""Create a image for Binary Cards (Small) resource.
Args:
request: HTTP request object.
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A list of Pillow image objects.
A list of Pillow image objects (list).
"""
BASE_IMAGE_PATH = "static/img/resources/binary-cards-small/"
IMAGE_SIZE_X = 2480
Expand Down Expand Up @@ -75,11 +75,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
text for subtitle (str).
"""
if retrieve_query_parameter(request, "dot_counts"):
display_numbers_text = "with dot counts"
Expand Down
10 changes: 5 additions & 5 deletions csunplugged/resources/views/binary_to_alphabet.py
Expand Up @@ -8,8 +8,8 @@ def resource_image(request, resource):
"""Create a image for Binary to Alphabet resource.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A Pillow image object.
Expand Down Expand Up @@ -89,11 +89,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
Text for subtitle (str).
"""
text = "{} - {}".format(
retrieve_query_parameter(request, "worksheet_version"),
Expand Down
12 changes: 6 additions & 6 deletions csunplugged/resources/views/binary_windows.py
Expand Up @@ -9,11 +9,11 @@ def resource_image(request, resource):
"""Create a image for Binary Windows resource.
Args:
request: HTTP request object (Request).
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A list of Pillow image objects (list of Image objects).
A list of Pillow image objects (list).
"""
BASE_IMAGE_PATH = "static/img/resources/binary-windows/"
FONT_PATH = "static/fonts/PatrickHand-Regular.ttf"
Expand Down Expand Up @@ -69,7 +69,7 @@ def add_dot_counts(image, starting_value, font):
font: Font used for adding text (Pillow Font).
Returns:
Pillow Image with text added.
Pillow Image with text added (Pillow Image).
"""
value = starting_value
draw = ImageDraw.Draw(image)
Expand Down Expand Up @@ -106,7 +106,7 @@ def add_digit_values(image, value_type, on, x_coord_start, x_coord_increment, ba
font: Font used for adding text (Pillow Font).
Returns:
Pillow Image with binary values.
Pillow Image with binary values (Pillow Image).
"""
text_coord_x = x_coord_start

Expand Down Expand Up @@ -157,11 +157,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object (Request).
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (str)
text for subtitle (str).
"""
number_of_bits = retrieve_query_parameter(request, "number_bits")
value_type = retrieve_query_parameter(request, "value_type")
Expand Down
12 changes: 6 additions & 6 deletions csunplugged/resources/views/generate_resource_pdf.py
Expand Up @@ -16,9 +16,9 @@ def generate_resource_pdf(request, resource, module_path):
"""Return a response containing a generated PDF resource.
Args:
request: HTTP request object
resource: Object of resource data.
module_path: Path to module for generating resource.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
module_path: Path to module for generating resource (str).
Returns:
Tuple of PDF file of generated resource and filename.
Expand Down Expand Up @@ -58,9 +58,9 @@ def generate_resource_image(get_request, resource, module_path):
Images are resized to size.
Args:
get_request: HTTP request object
resource: Object of resource data.
module_path: Path to module for generating resource.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
module_path: Path to module for generating resource (str).
Returns:
List of Base64 strings of a generated resource images for one copy.
Expand Down
6 changes: 3 additions & 3 deletions csunplugged/resources/views/modulo_clock.py
Expand Up @@ -9,11 +9,11 @@ def resource_image(request, resource):
"""Create a image for Binary Cards resource.
Args:
request: HTTP request object (QueryDict).
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A list of Pillow image objects.
A list of Pillow image objects (list).
"""
parameter_options = valid_options()
modulo_number = int(retrieve_query_parameter(request, "modulo_number", parameter_options["modulo_number"]))
Expand Down Expand Up @@ -60,7 +60,7 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object (QueryDict).
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
Expand Down
12 changes: 6 additions & 6 deletions csunplugged/resources/views/parity_cards.py
Expand Up @@ -8,11 +8,11 @@ def resource_image(request, resource):
"""Create a image for Parity Cards resource.
Args:
request: HTTP request object.
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A list of Pillow image objects.
A list of Pillow image objects (list).
"""
CARDS_COLUMNS = 4
CARDS_ROWS = 5
Expand Down Expand Up @@ -58,11 +58,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
text for subtitle (str).
"""
text = "{} back - {}".format(
retrieve_query_parameter(request, "back_colour"),
Expand Down
14 changes: 7 additions & 7 deletions csunplugged/resources/views/sorting_network.py
Expand Up @@ -9,8 +9,8 @@ def resource_image(request, resource):
"""Create a image for Sorting Network resource.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A Pillow image object.
Expand Down Expand Up @@ -55,11 +55,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
text for subtitle (str).
"""
prefilled_values = retrieve_query_parameter(request, "prefilled_values")
if prefilled_values == "blank":
Expand All @@ -75,10 +75,10 @@ def number_range(request):
"""Return number range tuple for resource.
Args:
request: HTTP request object
request: HTTP request object (HttpRequest).
Returns:
Tuple of (range_min, range_max, font_size)
Tuple of (range_min, range_max, font_size).
"""
parameter_options = valid_options()
prefilled_values = retrieve_query_parameter(request, "prefilled_values", parameter_options["prefilled_values"])
Expand Down
12 changes: 6 additions & 6 deletions csunplugged/resources/views/sorting_network_cards.py
Expand Up @@ -9,11 +9,11 @@ def resource_image(request, resource):
"""Create a image for Sorting Network Cards resource.
Args:
request: HTTP request object.
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A list of Pillow image objects.
A list of Pillow image objects (list).
"""
IMAGE_SIZE_X = 2000
IMAGE_SIZE_Y = 3000
Expand Down Expand Up @@ -107,11 +107,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
text for subtitle (str).
"""
return "{} - {}".format(
retrieve_query_parameter(request, "type").replace("_", " "),
Expand Down
12 changes: 6 additions & 6 deletions csunplugged/resources/views/treasure_hunt.py
Expand Up @@ -9,8 +9,8 @@ def resource_image(request, resource):
"""Create a image for Treasure Hunt resource.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
A Pillow image object.
Expand Down Expand Up @@ -77,11 +77,11 @@ def subtitle(request, resource):
also on the resource image.
Args:
request: HTTP request object
resource: Object of resource data.
request: HTTP request object (HttpRequest).
resource: Object of resource data (Resource).
Returns:
text for subtitle (string)
text for subtitle (str)
"""
prefilled_values = retrieve_query_parameter(request, "prefilled_values")
if prefilled_values == "blank":
Expand All @@ -98,7 +98,7 @@ def number_range(request):
"""Return number range tuple for resource.
Args:
request: HTTP request object
request: HTTP request object (HttpRequest).
Returns:
Tuple of (range_min, range_max, font_size)
Expand Down
5 changes: 3 additions & 2 deletions csunplugged/templates/resources/base-resource-pdf.html
@@ -1,3 +1,5 @@
{% load static %}

<html>
<head>
<title>{{ filename }}</title>
Expand Down Expand Up @@ -31,8 +33,7 @@
{% endfor %}
{% endfor %}
<footer class="fixed-running-element">
{% load static %}
<img src="./img/logo-small.png"> - {{ resource.name }} - csunplugged.org{% url 'resources:resource' resource.slug %}
<img src="./img/logo-small.png"> - {{ resource.name }} - cs-unplugged.appspot.com{% url 'resources:resource' resource.slug %}
</footer>
</body>
</html>
Expand Up @@ -24,7 +24,7 @@ <h1>
</h1>
<h2>
<img src="{% get_static_prefix %}{{ implementation.language.icon }}" class="inline-image" />
{{ implementation.language.name }} Solution
{{ implementation.language.name }} solution
</h2>
{% endblock page_heading %}

Expand Down
2 changes: 1 addition & 1 deletion csunplugged/templates/topics/topic-other-resources.html
Expand Up @@ -19,7 +19,7 @@ <h1>{{ topic.name }}</h1>
{% endblock page_heading %}

{% block left_column_content %}
<h2>Other Resources</h2>
<h2>Other resources</h2>

{% render_html_field topic.other_resources %}
{% endblock left_column_content %}

0 comments on commit e03269e

Please sign in to comment.