Difference between revisions of "Widget:RAPID-Transclude"

From Open Energy Information

(add function to change overview pages on tech/jur/topic pages)
(add hydro project type filter functions)
Line 252: Line 252:
 
               var roadmapSection = roadmap.split("-")[0];
 
               var roadmapSection = roadmap.split("-")[0];
 
               $('#narrativeDescription h2').each(function(i) {
 
               $('#narrativeDescription h2').each(function(i) {
 +
                //set hydro data attribute (if applicable)
 +
                if($(this).find('span.mw-headline span[data-hydro-section]')){
 +
                  thisHydro = $(this).find('span.mw-headline span').data('hydro-section');
 +
                  $(this).attr('data-hydro-section', thisHydro);
 +
                }
 +
                //apply bootstrap collapse
 
                 $(this).addClass('collapse');
 
                 $(this).addClass('collapse');
 
                 $(this).attr('data-target', 'narrative'+(i+1));
 
                 $(this).attr('data-target', 'narrative'+(i+1));
Line 269: Line 275:
 
                     $('.'+target+'').toggle();
 
                     $('.'+target+'').toggle();
 
                 }
 
                 }
 +
              });
 +
 +
              //build hydropower filters
 +
              defineHydroFilters();
 +
              $('span.hydro-filter').click(function(){
 +
                $('span.hydro-filter').removeClass('active');
 +
                $(this).addClass('active');
 +
                applyHydroFilter();
 
               });
 
               });
  

Revision as of 23:48, 28 June 2019

This template performs an ajax request for RAPID Tech/Jurisdiction/Topic pages, based on their related Roadmap Overview page. It is called by [[:Template:RAPID-Overview(Tech-Jurisdiction-Topic). See RAPID/Geothermal/California/Land Use as an example.

The template "[transcludes]" information from the right column, the overview and the narrative from pages like RAPID/Roadmap/3 and imports it to the page using the above template (such as RAPID/Geothermal/California/Land Use). It also removes any links/buttons that are not related to the current page's jurisdiction.