Skip to content

Commit 3e7610c

Browse files
authored
Merge pull request #200 from fraz3alpha/remove-expandable-sections-in-regionnaire-table
More purging and clarification of the regionnaire limitations
2 parents 5e0fe66 + 6f4ee3c commit 3e7610c

File tree

3 files changed

+5
-266
lines changed

3 files changed

+5
-266
lines changed

browser-extensions/common/js/lib/challenges_ui.js

Lines changed: 2 additions & 263 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function generateRegionnaireTableEntry(table, data) {
213213
var regionnaireMapId = 'regionnaire_map'
214214
var map_row = $("<tr/>").append($('<td colspan="4"><div id="'+regionnaireMapId+'" style="height:400px; width:400"></div></td>'))
215215
challenge_tbody_detail.append(map_row)
216-
var map_row = $("<tr/>").append($('<td colspan="4" align="center">Click the flags, pie-charts, and events in the map above for more info.<br/>Click on the countries below to expand the data.<br/>Note: Only currenty active events are included in the map and stats</td>'))
216+
var map_row = $("<tr/>").append($('<td colspan="4" align="center">Note: Only currenty active events are included in the map and stats</td>'))
217217
challenge_tbody_detail.append(map_row)
218218

219219
// draw_regionnaire_data_table(challenge_tbody_detail, challenge)
@@ -228,34 +228,6 @@ function generateRegionnaireTableEntry(table, data) {
228228
}
229229
}
230230

231-
// function generate_regionnaire_table_entry(challenge, table, data) {
232-
// var shortname = challenge['shortname']
233-
234-
// var challenge_tbody_header = get_tbody_header(challenge)
235-
// var challenge_tbody_detail = get_tbody_content(challenge)
236-
237-
// // Create the header row and add it to the tbody that exists to hold
238-
// // the title row
239-
// var main_row = get_challenge_header_row(challenge, data)
240-
// challenge_tbody_header.append(main_row)
241-
242-
// // Create a row to hold a map
243-
// var regionnaire_map_id = 'regionnaire_map'
244-
// var map_row = $("<tr/>").append($('<td colspan="4"><div id="'+regionnaire_map_id+'" style="height:400px; width:400"></div></td>'))
245-
// challenge_tbody_detail.append(map_row)
246-
// var map_row = $("<tr/>").append($('<td colspan="4" align="center">Click the flags, pie-charts, and events in the map above for more info.<br/>Click on the countries and regions below to expand the data.</td>'))
247-
// challenge_tbody_detail.append(map_row)
248-
249-
// // draw_regionnaire_data_table(challenge_tbody_detail, challenge)
250-
// drawRegionnaireDataTable(challenge_tbody_detail, data)
251-
252-
// // table.append(challenge_tbody_header)
253-
// // table.append(challenge_tbody_detail)
254-
255-
// // create_regionnaire_map(regionnaire_map_id, data, challenge)
256-
257-
// }
258-
259231
function drawRegionnaireMap(divId, data) {
260232

261233
// Get a summary of the completion data
@@ -802,255 +774,22 @@ function drawRegionnaireDataTable(table, data) {
802774
var regionnaire_country_class = "regionnaire-country-"+countryId
803775
var regionnaire_parent_region_class_country = "regionnaire-parent-region-id-"+countryId
804776

805-
// This really needs an explanatory paragraph
806-
// Create a function to attach to the onClick event for the country row.
807-
// This will attempt to expand or hide the row, according to whether it is
808-
// currently marked as hidden or not.
809-
var expand_country=function() {
810-
var parent_tr = $(this).closest("tr")
811-
if (parent_tr.hasClass("regionnaire-expanded")) {
812-
// We need to collapse this section - and everything inside it
813-
parent_tr.siblings('.'+regionnaire_country_class).each(function() {
814-
$(this).hide()
815-
// As we have collapsed everything, mark any sub elements as not expanded
816-
$(this).removeClass("regionnaire-expanded")
817-
})
818-
parent_tr.removeClass("regionnaire-expanded")
819-
} else {
820-
// We need to expand this section, but only the top level things
821-
// Only make visible those rows which have our country as the parent ID
822-
var sibling_query = "."+regionnaire_parent_region_class_country
823-
parent_tr.siblings(sibling_query).each(function() {
824-
$(this).show()
825-
})
826-
parent_tr.addClass("regionnaire-expanded")
827-
}
828-
}
829-
830777
// We fade out the regionnaire flag if it hasn't been visited, with
831778
// get_regionnaire_flag's second argumemt being a true/false value of whether
832779
// you have been. By stating whether the completion percentage is above zero
833780
// we can calculate this on the fly
834781
row.append($("<td/>").append(get_regionnaire_flag(countryName, countryCompletionPercentage > 0)).append($("<a/>").attr("name", countryName)))
835-
row.append($("<td/>").append($("<b/>").text(countryName).click(expand_country).css('cursor', 'pointer')))
782+
row.append($("<td/>").append($("<b/>").text(countryName)))
836783
row.append($("<td/>"))
837784
row.append($("<td/>").text(countryCompletionFractionString))
838785
table.append(row)
839786

840-
// // Add the events for the country
841-
// country_region.child_events.forEach(function(event_name) {
842-
// var completed_event = country_region.child_events_completed[event_name]
843-
844-
// var event_row = $("<tr/>", {class: regionnaire_country_class })
845-
// event_row.addClass(regionnaire_parent_region_class_country)
846-
// event_row.append($("<td/>"))
847-
// event_row.append($("<td/>").text(event_name))
848-
// if (completed_event !== undefined) {
849-
// event_row.append($("<td/>").text(completed_event.date))
850-
// } else {
851-
// event_row.append($("<td/>"))
852-
// }
853-
// event_row.append($("<td/>"))
854-
// // Start the event row hidden
855-
// event_row.hide()
856-
// table.append(event_row)
857-
// })
858-
859787
}
860788

861789
})
862790

863791
}
864792

865-
// function iterate_regionnaire_data(table, region, level, region_group) {
866-
//
867-
// if (level === undefined) {
868-
// level = 0
869-
// }
870-
//
871-
// initially_hidden = false
872-
// if (level > 1) {
873-
// initially_hidden = true
874-
// }
875-
//
876-
// // Use the region ID in the class name, because the human readable names
877-
// // are full of spaces, non-latin characters, and all sorts.
878-
// var region_class_name = "regionnaire-class-"+region["id"]
879-
// var region_event_class_name = region_class_name+"-event"
880-
// var region_incomplete_event_class_name = region_class_name+"-event-incomplete"
881-
// var region_complete_event_class_name = region_class_name+"-event-complete"
882-
//
883-
// var hide_show_message = "parkruns I haven't done"
884-
//
885-
// if (region["child_events_total"] == 0) {
886-
// return
887-
// }
888-
//
889-
// var row = $('<tr/>')
890-
// var twisty = $('<td/>').attr("id", region_class_name+"-twisty")
891-
// row.append(twisty)
892-
// if (level == 1) {
893-
// // if (region["child_regions"].length > 0) {
894-
// if (region["child_events_completed_count"] == 0) {
895-
// twisty.append(get_regionnaire_flag(region["name"], false))
896-
// // hide_region_sub_rows = true
897-
// } else {
898-
// twisty.append(get_regionnaire_flag(region["name"], true))
899-
// row.addClass("region_visible")
900-
// }
901-
// // }
902-
// // Set the geo region to the top level one (not world)
903-
// // e.g. UK, Australia, Denmark
904-
// region_group = region_class_name
905-
// }
906-
//
907-
// var region_start_visible = region_group+"-level-"+level+"-visible"
908-
// var region_start_hidden = region_group+"-level-"+level+"-hidden"
909-
//
910-
// console.log(region_start_visible + "/" + region_start_hidden)
911-
//
912-
// // console.log("Hide subregions for "+region["name"]+"? - "+hide_region_sub_rows)
913-
//
914-
// var clickable_country = $('<span/>')
915-
// country_text = region["name"]
916-
// // If the level is 0, 'World', then that is as special case and there are no
917-
// // subparts that need indenting.
918-
// // If the level is 1, i.e. a country, then there is nothing to join, and it is
919-
// // just like 'World'
920-
// // If the level is 2+, like 'UK > South East', then we need one '> ', which
921-
// // we get by doing our join below.
922-
// if (level > 1) {
923-
// var prefix = Array(level).join("> ")
924-
// country_text = prefix + region["name"]
925-
// }
926-
// clickable_country.append($('<b></b>').text(country_text))
927-
// if (region["child_regions"].length > 0) {
928-
// clickable_country.click(function(){
929-
//
930-
// // Find the parent tr element
931-
// var parent_tr = $(this).closest("tr")
932-
// if (parent_tr.hasClass("region_visible")) {
933-
// // Collapse it
934-
// $("."+region_group+"-level-"+(level+1)+"-visible").hide();
935-
// $("."+region_group+"-level-"+(level+1)+"-hidden").hide();
936-
//
937-
// // var twisty = $("#"+region_group+"-twisty")
938-
// // twisty.empty()
939-
// // twisty.append($('<b></b>').text("+"))
940-
// // Remove the class that says it is visible
941-
// parent_tr.removeClass("region_visible")
942-
// } else {
943-
// var class_name_to_make_visible = region_group+"-level-"+(level+1)+"-visible"
944-
// console.log("Making things visible with level="+(level+1)+" for "+class_name_to_make_visible)
945-
// // Then show the things the next level down that we intend to show
946-
// $("."+class_name_to_make_visible).show();
947-
//
948-
// // var twisty = $("#"+region_group+"-twisty")
949-
// // twisty.empty()
950-
// // twisty.append($('<b></b>').text("-"))
951-
//
952-
// parent_tr.addClass("region_visible")
953-
// }
954-
//
955-
// })
956-
// clickable_country.click(function() {
957-
// clicky();
958-
// })
959-
// clickable_country.css('cursor', 'pointer')
960-
// }
961-
// row.append($('<td/>').append(clickable_country))
962-
//
963-
// // We may remove this column if it is no longer useful
964-
// row.append($('<td></td>'))
965-
//
966-
// var completion_string = region["child_events_completed_count"]+"/"+region["child_events_total"]
967-
// row.append($('<td></td>').text(completion_string))
968-
// row.addClass(region_event_class_name)
969-
// row.addClass(region_group)
970-
// row.addClass(region_start_visible)
971-
// if (initially_hidden) {
972-
// row.hide()
973-
// }
974-
// table.append(row)
975-
//
976-
// // Print out those events that have been completed
977-
// region["child_events"].forEach(function (child_event) {
978-
// if (child_event in region["child_events_completed"]) {
979-
// var row = $('<tr></tr>')
980-
// row.addClass(region_complete_event_class_name)
981-
// row.append($('<td></td>').text(""))
982-
// row.append($('<td></td>'))
983-
// row.append($('<td></td>').text(child_event))
984-
// row.append($('<td></td>').text(region["child_events_completed"][child_event]["date"]))
985-
// row.addClass(region_group)
986-
// row.addClass(region_start_visible)
987-
// if (initially_hidden) {
988-
// row.hide()
989-
// }
990-
// table.append(row)
991-
// }
992-
// })
993-
// // Print the info of the ones that you are missing (if any)
994-
// if (region["complete"] == false) {
995-
// // Add a link to display the missing events (with them being normally
996-
// // hidden so as not to overwhelm the page)
997-
// // But only if there are sub-events
998-
// if (region.child_events.length > 0) {
999-
// var show_more_row = $('<tr/>')
1000-
// show_more_row.append($('<td/>'))
1001-
// show_more_row.append($('<td/>').append($('<span/>').click(function(){
1002-
// $("."+region_incomplete_event_class_name).show();
1003-
// // Change the visibility of the buttons for this section
1004-
// $("."+region_incomplete_event_class_name+"-show").hide();
1005-
// $("."+region_incomplete_event_class_name+"-hide").show();
1006-
// }).text('show '+hide_show_message+" ...")).attr('colspan', 3))
1007-
// show_more_row.addClass(region_incomplete_event_class_name+"-show")
1008-
// show_more_row.addClass(region_group)
1009-
// show_more_row.addClass(region_start_visible)
1010-
// if (initially_hidden) {
1011-
// show_more_row.hide()
1012-
// }
1013-
// table.append(show_more_row)
1014-
// }
1015-
//
1016-
// // Create rows for all the unattended events, default to hidden
1017-
// region["child_events"].forEach(function (child_event) {
1018-
// if (!(child_event in region["child_events_completed"])) {
1019-
// var row = $('<tr></tr>')
1020-
// row.addClass(region_incomplete_event_class_name)
1021-
// row.append($('<td></td>'))
1022-
// row.append($('<td></td>'))
1023-
// row.append($('<td></td>').text(child_event))
1024-
// row.addClass(region_group)
1025-
// row.addClass(region_start_hidden)
1026-
// // Hide the row by default
1027-
// row.hide()
1028-
// table.append(row)
1029-
// }
1030-
// })
1031-
//
1032-
// var hide_more_row = $('<tr/>')
1033-
// hide_more_row.append($('<td/>'))
1034-
// hide_more_row.append($('<td/>').append($('<span/>').click(function(){
1035-
// $("."+region_incomplete_event_class_name).hide();
1036-
// // Change the visibility of the buttons for this section
1037-
// $("."+region_incomplete_event_class_name+"-show").show();
1038-
// $("."+region_incomplete_event_class_name+"-hide").hide();
1039-
// }).text('hide '+hide_show_message)).attr('colspan', 3))
1040-
// hide_more_row.addClass(region_incomplete_event_class_name+"-hide")
1041-
// hide_more_row.addClass(region_group)
1042-
// hide_more_row.addClass(region_start_hidden)
1043-
// // Hide by default
1044-
// hide_more_row.hide()
1045-
// table.append(hide_more_row)
1046-
// }
1047-
//
1048-
// region["child_regions"].forEach(function (child_region) {
1049-
// iterate_regionnaire_data(table, child_region, level+1, region_group)
1050-
// })
1051-
//
1052-
// }
1053-
1054793
function generate_standard_table_entry(challenge, table, data) {
1055794

1056795
var challenge_tbody_header = get_tbody_header(challenge)

website/_data/badges.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ runner:
5858
name: Groundhog Day
5959
description: Finish with the same time at the same parkrun location on two consecutive parkruns.
6060

61-
- shortname: regionnaire
62-
name: Regionnaire
63-
description: Run all the parkrun locations in a geographical region.
61+
# - shortname: regionnaire
62+
# name: Regionnaire
63+
# description: Run all the parkrun locations in a geographical region.
6464

6565
- shortname: all-weather-runner
6666
name: All Weather Runner

website/_posts/2019-11-19-the-demise-of-geo-xml.markdown renamed to website/_posts/2019-11-19-where-did-my-flags-go.markdown

File renamed without changes.

0 commit comments

Comments
 (0)