Commit 7b278e5e authored by Toby Hodges's avatar Toby Hodges

Merge branch 'default-platform' into 'master'

Set a default platform for exercises & activities

Closes #45

See merge request !36
parents a81513db 8f41d013
Pipeline #10452 passed with stages
in 1 minute and 19 seconds
......@@ -13,3 +13,6 @@ commonmark:
options: ["SMART"]
highlighter: rouge
exclude: ["README.md", "TEACHING.md"]
# options are: "NONE", "ImageJ GUI", "ImageJ Macro", "Jython", "MATLAB"
default-platform: "NONE"
......@@ -18,6 +18,9 @@ function set_activity_view_defaults() {
document.getElementById("{{ platform[0] | slugify }}-activity-div").style.display = 'none';
{% endfor %}
{% if page.activities %}
{% unless site.default-platform == "NONE" %}
document.getElementById("{{ site.default-platform | slugify }}-activity-div").style.display = 'block';
{% endunless %}
};
function change_activity_content_by_platform(form_control){
{% endif %}
......@@ -45,6 +48,9 @@ function set_exercises_view_defaults() {
document.getElementById("{{ platform[0] | slugify }}-exercises-div").style.display = 'none';
{% endfor %}
{% if page.exercises %}
{% unless site.default-platform == "NONE" %}
document.getElementById("{{ site.default-platform | slugify }}-exercises-div").style.display = 'block';
{% endunless %}
};
function change_exercises_content_by_platform(form_control){
{% endif %}
......@@ -136,10 +142,16 @@ window.onload = set_view_defaults;
{% if page.activities %}
Show activity for: <select id="id_activity_platform" name="activityplatformlist" onchange="change_activity_content_by_platform('id_activity_platform');return false;">
{% if site.default-platform == "NONE" %}
<option value="default-activity" id="default-activity-option" selected="selected"> Select a platform... </option>
{% else %}
<option value="{{ site.default-platform | slugify }}-activity" id="{{ site.default-platform | slugify }}-option" selected="selected"> {{ site.default-platform }} </option>
{% endif %}
{% endif %}
{% for platform in page.activities %}
{% unless platform[0] == site.default-platform %}
<option value="{{ platform[0] | slugify }}-activity" id="{{ platform[0] | slugify }}-activity-option"> {{ platform[0] }} </option>
{% endunless %}
{% endfor %}
{% if page.activities %}
</select>
......@@ -168,10 +180,16 @@ Show activity for: <select id="id_activity_platform" name="activityplatformlist"
{% if page.exercises %}
Perform additional excercises for: <select id="id_exercises_platform" name="exercisesplatformlist" onchange="change_exercises_content_by_platform('id_exercises_platform');return false;">
<option value="default-exercises" id="default-exercises-option" selected="selected"> Select a platform... </option>
{% if site.default-platform == "NONE" %}
<option value="null-exercises" id="null-exercises-option" selected="selected"> Select a platform... </option>
{% else %}
<option value="{{ site.default-platform | slugify }}-exercises" id="{{ site.default-platform | slugify }}-exercises-option" selected="selected"> {{ site.default-platform }} </option>
{% endif %}
{% endif %}
{% for platform in page.exercises %}
{% unless platform[0] == site.default-platform %}
<option value="{{ platform[0] | slugify }}-exercises" id="{{ platform[0] | slugify }}-exercises-option"> {{ platform[0] }} </option>
{% endunless %}
{% endfor %}
{% if page.exercises %}
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment