Changeset 34913


Ignore:
Timestamp:
2021-02-23T00:19:47+13:00 (3 years ago)
Author:
davidb
Message:

When viewing the votes a country received, the entries in the table are now hyperlinked to the 'From-Country' doc in the DL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js

    r34911 r34913  
    4040    VotesJSON.sort();
    4141
     42    var library_name = gs.xsltParams["library_name"];
     43    //var site_name = gs.xsltParams["site_name"];
     44    var coll_name = gs.cgiParams["c"];
     45   
     46    //var collect_http_path = gs.collectionMetadata["httpPath"];
     47    var collect_doc_prefix_url = library_name + "/collection/" + coll_name + "/document/";
     48
    4249    for (var i=0; i<num_cells; i++) {
    4350        var trans_i = transpose_i(i,num_cols, num_rows);
     
    5158        var from_country  = VotesJSON[trans_i];
    5259        var from_country_points = gs.documentMetadata[from_country];
     60        var year = gs.documentMetadata["Year"];
    5361       
    5462        if (typeof from_country_points !== 'undefined') {
    55             var pp_from_country = from_country.replace(/-(T|J)$/,"");
     63            var from_country_base = from_country.replace(/-(T|J)$/,"");
     64            var pp_from_country = from_country_base; // in future look to spacing back in for countries like United Kingdom
     65
     66            var hyphen_vote_type = from_country.match(/-(?:T|J)$/);
     67            var from_country_id = "FromCountry-"+from_country_base + year + hyphen_vote_type;
     68            var href_from_country = collect_doc_prefix_url + from_country_id;
     69       
     70            var $a_from_country = $('<a>').attr("href",href_from_country).append(pp_from_country);
    5671           
    57             $from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":");
     72            $from_country_name = $('<div>').attr("class","voting voting-country").append($a_from_country).append(":")
     73            //$from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":");
    5874            $from_country_points = $('<div>').attr("class","voting voting-points").append(from_country_points);         
    5975        }
Note: See TracChangeset for help on using the changeset viewer.