diff --git a/src/static/riot/competitions/public-list.tag b/src/static/riot/competitions/public-list.tag index cc9a535bd..2eb854a08 100644 --- a/src/static/riot/competitions/public-list.tag +++ b/src/static/riot/competitions/public-list.tag @@ -1,6 +1,6 @@

Public Benchmarks and Competitions

-
+
{ current_page } of {Math.ceil(competitions.count/competitions.page_size)} @@ -61,32 +61,35 @@ } self.update_competitions_list = function (num) { - self.current_page = num - $('#loading').show() - $('.pagination-nav').hide() - if (self.competitions_cache[self.current_page]){ - self.competitions = self.competitions_cache[self.current_page] - history.pushState("", document.title, "?page="+self.current_page) - $('.pagination-nav > button').prop('disabled', false) - self.update() + self.current_page = num; + $('#loading').show(); // Show the loading indicator + $('.pagination-nav').hide(); // Hide pagination navigation + + // Function to handle successful data retrieval + function handleSuccess(response) { + self.competitions = response; + self.competitions_cache[self.current_page.toString()] = response; + $('#loading').hide(); // Hide the loading indicator + $('.pagination-nav').show(); // Show pagination navigation + history.pushState("", document.title, "?page=" + self.current_page); + $('.pagination-nav > button').prop('disabled', false); + self.update(); + } + // Check if data is in cache + if (self.competitions_cache[self.current_page]) { + handleSuccess(self.competitions_cache[self.current_page]); } else { - return CODALAB.api.get_public_competitions({"page":self.current_page}) + // Fetch data using AJAX call + return CODALAB.api.get_public_competitions({"page": self.current_page}) .fail(function (response) { - $('#loading').hide() - $('.pagination-nav').show() - toastr.error("Could not load competition list") - }) - .done(function (response){ - self.competitions = response - self.competitions_cache[self.current_page.toString()] = response - $('#loading').hide() - $('.pagination-nav').show() - history.pushState("", document.title, "?page="+self.current_page) - $('.pagination-nav > button').prop('disabled', false) - self.update() + $('#loading').hide(); // Hide the loading indicator + $('.pagination-nav').show(); // Show pagination navigation + toastr.error("Could not load competition list"); }) + .done(handleSuccess); } - } + }; + self.get_array_length = function (arr) { if(arr === undefined){ diff --git a/src/static/riot/competitions/tile/front_page_competitions.tag b/src/static/riot/competitions/tile/front_page_competitions.tag index a24f83823..1543d13d3 100644 --- a/src/static/riot/competitions/tile/front_page_competitions.tag +++ b/src/static/riot/competitions/tile/front_page_competitions.tag @@ -2,7 +2,7 @@
- Popular Benchmarks + Popular Benchmarks
+ Show more
- Featured Benchmarks + Featured Benchmarks
+ Show more
@@ -58,6 +60,26 @@ margin: 3em 1.5em; } + .show-more { + display: block; + width: fit-content; + margin: 20px auto; + padding: 10px 20px; + background-color: #4a6778; + color: white; + text-align: center; + border-radius: 5px; + font-size: 1.1em; + text-decoration: none; + transition: background-color 0.3s, transform 0.3s; + } + + .show-more:hover { + background-color: #467799; + transform: scale(1.05); + text-decoration: none; + } + .sub-header-link { line-height: 0.25em; }