|
20 | 20 | $wa = $this->document->getWebAssetManager(); |
21 | 21 | $wa->useStyle('com_ccpbiosim.site') |
22 | 22 | ->useScript('com_ccpbiosim.site'); |
| 23 | +$json = "https://ccpbiosim.github.io/assets.json"; |
| 24 | +$data = json_decode(file_get_contents($json), true); |
| 25 | +$data_sorted = array("scientific" => array("catname" => "Scientific Software"), |
| 26 | + "data-tools" => array("catname" => "Data Tools")); |
| 27 | +foreach ($data["software"] as $application => $applicationdata) { |
| 28 | + $data_sorted[$applicationdata["category"]]["software"][$application] = $applicationdata; |
| 29 | +} |
23 | 30 | ?> |
24 | 31 | <?php if ($this->params->get('show_page_heading')) : ?> |
25 | 32 | <div class="page-header"> |
26 | | - <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> |
| 33 | + <h1><?php echo $this->escape($this->params->get('page_heading')); ?></h1> |
27 | 34 | </div> |
28 | 35 | <?php endif; ?> |
29 | | -<p>code will go here.</p> |
30 | | -<p></br></p> |
| 36 | +<p>Our software packages that are actively maintained by our core CoSeC support team:</p> |
| 37 | +<div class="container mt-5"> |
| 38 | + <div class="software-category-bar text-center"> |
| 39 | + <button class="btn btn-outline-primary software-category-btn active" data-category="all">All</button> |
| 40 | + <?php foreach ($data_sorted as $category => $categorydata) : ?> |
| 41 | + <button class="btn btn-outline-primary software-category-btn" data-category="<? echo $category; ?>"><?php echo $categorydata["catname"]; ?></button> |
| 42 | + <? endforeach ?> |
| 43 | + </div> |
| 44 | + <div class="row g-4"> |
| 45 | + <?php foreach ($data_sorted as $category => $categorydata) : ?> |
| 46 | + <?php foreach ($categorydata["software"] as $app => $appdata) : ?> |
| 47 | + <div class="col-md-4 product" |
| 48 | + data-category="<?php echo $category; ?>" |
| 49 | + data-name="<?php echo $appdata["name"]; ?>" |
| 50 | + data-logo="/images/logos/<?php echo $appdata["image"]; ?>" |
| 51 | + data-summary="<?php echo $appdata["shortdesc"]; ?>" |
| 52 | + data-description="<?php echo $appdata["longdesc"]; ?>" |
| 53 | + data-pip="pip install <?php echo $app; ?>" |
| 54 | + data-conda="conda install -c CCPBioSim <?php echo $app; ?>" |
| 55 | + data-docs="<?php echo $appdata["docs"]; ?>" |
| 56 | + data-source="<?php echo $appdata["github"]; ?>" |
| 57 | + data-authors="Authors: <?php echo $appdata["authors"]; ?>"> |
| 58 | + <div class="card software-card h-100" |
| 59 | + data-bs-toggle="modal" |
| 60 | + data-bs-target="#modal"> |
| 61 | + <div class="card-body"> |
| 62 | + <div class="software-logo-box"><img src="/images/logos/<?php echo $appdata["image"]; ?>"></div> |
| 63 | + <h5><?php echo $appdata["name"]; ?></h5> |
| 64 | + <p><?php echo $appdata["shortdesc"]; ?></p> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + <? endforeach ?> |
| 69 | + <? endforeach ?> |
| 70 | + </div> |
| 71 | +</div> |
| 72 | +<div class="modal fade" id="modal" tabindex="-1" aria-labelledby="modalLabel" aria-hidden="true"> |
| 73 | + <div class="modal-dialog modal-lg modal-dialog-centered"> |
| 74 | + <div class="modal-content"> |
| 75 | + <div class="modal-header"> |
| 76 | + <h5 class="modal-title" id="modalTitle">Software Package Name</h5> |
| 77 | + <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |
| 78 | + </div> |
| 79 | + <div class="modal-body"> |
| 80 | + <div class="container"> |
| 81 | + <div class="row"> |
| 82 | + <div class="col-3"> |
| 83 | + <img src="" id="modalLogo" class="img-fluid mb-3 software-modal-logo" alt="Software Logo"> |
| 84 | + </div> |
| 85 | + <div class="col"> |
| 86 | + <p id="modalSummary" class="fw-bold modalsoftware-summarytext"></p> |
| 87 | + <p id="modalAuthors" class="fw-bold modalsoftware-authors"></p> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + </div> |
| 91 | + <p id="modalDescription"></p> |
| 92 | + <p>Install by Pip</p> |
| 93 | + <code id="modalPip"></code> |
| 94 | + <p style="padding-top: 10px;">Install by Conda</p> |
| 95 | + <code id="modalConda"></code> |
| 96 | + </div> |
| 97 | + <div class="modal-footer"> |
| 98 | + <button class="btn btn-secondary" data-bs-dismiss="modal">Close</button> |
| 99 | + <a href="#" id="modalSource" target="_blank" class="btn btn-primary">Source Code</a> |
| 100 | + <a href="#" id="modalDocs" target="_blank" class="btn btn-success">Documentation</a> |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + </div> |
| 104 | +</div> |
| 105 | + |
| 106 | +<script src="/media/vendor/bootstrap/js/modal.min.js?5.3.8" type="module"></script> |
| 107 | + |
| 108 | +<script> |
| 109 | +const products = document.querySelectorAll(".product"); |
| 110 | +const modalTitle = document.getElementById("modalTitle"); |
| 111 | +const modalSummary = document.getElementById("modalSummary"); |
| 112 | +const modalDescription = document.getElementById("modalDescription"); |
| 113 | +const modalLogo = document.getElementById("modalLogo"); |
| 114 | +const modalPip = document.getElementById("modalPip"); |
| 115 | +const modalConda = document.getElementById("modalConda"); |
| 116 | +const modalSource = document.getElementById("modalSource"); |
| 117 | +const modalDocs = document.getElementById("modalDocs"); |
| 118 | +const modalAuthors = document.getElementById("modalAuthors"); |
| 119 | + |
| 120 | +products.forEach(product => { |
| 121 | + product.addEventListener("click", () => { |
| 122 | + modalTitle.innerText = product.dataset.name; |
| 123 | + modalSummary.innerText = product.dataset.summary; |
| 124 | + modalDescription.innerText = product.dataset.description; |
| 125 | + modalLogo.src = product.dataset.logo; |
| 126 | + modalPip.innerText = product.dataset.pip; |
| 127 | + modalConda.innerText = product.dataset.conda; |
| 128 | + modalAuthors.innerText = product.dataset.authors; |
| 129 | + modalSource.href = product.dataset.source; |
| 130 | + modalDocs.href = product.dataset.docs; |
| 131 | + }); |
| 132 | +}); |
31 | 133 |
|
| 134 | +const categoryButtons = document.querySelectorAll(".software-category-btn"); |
| 135 | +let activeCategory = "all"; |
| 136 | +categoryButtons.forEach(btn => { |
| 137 | + btn.addEventListener("click", () => { |
| 138 | + categoryButtons.forEach(b=>b.classList.remove("active")); |
| 139 | + btn.classList.add("active"); |
| 140 | + activeCategory = btn.dataset.category; |
| 141 | + filterProducts(); |
| 142 | + }); |
| 143 | +}); |
32 | 144 |
|
| 145 | +function filterProducts(){ |
| 146 | + products.forEach(product=>{ |
| 147 | + const name = product.dataset.name.toLowerCase(); |
| 148 | + const category = product.dataset.category; |
| 149 | + let show = true; |
| 150 | + if(activeCategory!="all" && category!=activeCategory) show=false; |
| 151 | + product.style.display = show ? "block" : "none"; |
| 152 | + }); |
| 153 | +} |
| 154 | +</script> |
0 commit comments