Skip to content

Commit

Permalink
hide installButtons if minVersionJeedom is not compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Sekiro-kost committed Jan 14, 2025
1 parent 3f5de45 commit 9ab6cd6
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions core/repo/market.display.repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
echo ' <a class="btn btn-default bt_installFromMarket" data-version="' . $branch . '" data-market_logicalId="' . $market->getLogicalId() . '" data-market_id="' . $market->getId() . '" ><i class="fas fa-plus-circle"></i> {{Installer}} ' . $branch . '</a>';
}
}
echo '<div class="alert alert-warning" id="warningVersion" style="display:none;">{{Votre version actuelle du core ne permet pas d\'installer ce plugin}}</div>';
} else if ($market->getPrivate() == 1) {
echo '<div class="alert alert-info">{{Ce plugin est pour le moment privé. Vous devez attendre qu\'il devienne public ou avoir un code pour y accéder}}</div>';
} else {
Expand All @@ -95,15 +96,15 @@
<a class="btn btn-default" href='<?php echo config::byKey('market::address'); ?>/index.php?v=d&p=profils' target="_blank"><i class="fa fa-eur"></i> {{Code promo}}</a>
<?php
if ($market->getCertification() !== 'Premium') {
echo '<a class="btn btn-default" target="_blank" href="' . config::byKey('market::address') . '/index.php?v=d&p=market_display&id=' . $market->getId() . '"><i class="fa fa-shopping-cart"></i> {{Acheter}}</a>';
echo '<a class="btn btn-default buyButtons" target="_blank" href="' . config::byKey('market::address') . '/index.php?v=d&p=market_display&id=' . $market->getId() . '"><i class="fa fa-shopping-cart"></i> {{Acheter}}</a>';
} else {
echo '<a class="btn btn-default" target="_blank" href="mailto:supportpro@jeedom.com"><i class="fa fa-envelope"></i> {{Nous Contacter}}</a>';
}
} else {
echo '<a class="btn btn-default" target="_blank" href="' . config::byKey('market::address') . '/index.php?v=d&p=market_display&id=' . $market->getId() . '"><i class="fa fa-shopping-cart"></i> {{Acheter}}</a>';
echo '<a class="btn btn-default buyButtons" target="_blank" href="' . config::byKey('market::address') . '/index.php?v=d&p=market_display&id=' . $market->getId() . '"><i class="fa fa-shopping-cart"></i> {{Acheter}}</a>';
}
} else {
echo '<a class="btn btn-default" target="_blank" href="' . config::byKey('market::address') . '/index.php?v=d&p=market_display&id=' . $market->getId() . '"><i class="fa fa-shopping-cart"></i> {{Acheter}}</a>';
echo '<a class="btn btn-default buyButtons" target="_blank" href="' . config::byKey('market::address') . '/index.php?v=d&p=market_display&id=' . $market->getId() . '"><i class="fa fa-shopping-cart"></i> {{Acheter}}</a>';
}
}
if (is_object($update)) {
Expand Down Expand Up @@ -277,6 +278,28 @@
<script>
(function() { // Self Isolation!


jeedom.version({
success: function(version) {
if (market_display_info.parameters.minJeedomVersion >= version) {
var installButtons = document.querySelectorAll('.bt_installFromMarket');
installButtons.forEach(function(installButton) {
installButton.style.display = 'none';
});
var buyButtons = document.querySelectorAll('.buyButtons');
buyButtons.forEach(function(buyButton) {
buyButton.style.display = 'none';
});

var warningDiv = document.getElementById('warningVersion');
if (warningDiv) {
warningDiv.style.display = 'block';
}
}
}
});


//Slide screenshot:
if (document.querySelector(".slide")) {
document.getElementById("slide-arrow-next")?.addEventListener("click", (event) => {
Expand Down

0 comments on commit 9ab6cd6

Please sign in to comment.