more refactoring of breeds for clariy and uniformity

This commit is contained in:
0ceanSlim 2024-02-02 10:37:07 -05:00
parent 991f726fa1
commit 0c73c2b88c
4 changed files with 16 additions and 6 deletions

5
app.py
View File

@ -121,8 +121,9 @@ def monster_stats(monster_name):
# Add this route for fetching breeding combinations # Add this route for fetching breeding combinations
@app.route("/get_breeding_combinations") @app.route("/breeds")
def get_breeding_combinations(): def get_breeding_combinations():
selected_monster = request.args.get("monster") selected_monster = request.args.get("monster")
if not selected_monster: if not selected_monster:
return jsonify({"error": "Invalid input"}) return jsonify({"error": "Invalid input"})
@ -136,7 +137,7 @@ def get_breeding_combinations():
base_combinations, mate_combinations = get_breeding_info(breed_id) base_combinations, mate_combinations = get_breeding_info(breed_id)
return render_template( return render_template(
"breeding.html", "breeds.html",
selected_monster={ selected_monster={
"name": selected_monster, "name": selected_monster,
"base_combinations": base_combinations, "base_combinations": base_combinations,

View File

@ -1,6 +1,8 @@
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const familyDropdown = document.getElementById("familyDropdown"); const familyDropdown = document.getElementById("familyDropdown");
const monsterDropdown = document.getElementById("monsterDropdown"); const monsterDropdown = document.getElementById("monsterDropdown");
//const parent = document.getElementById("parent")
// Implementing Family Icon Grid in place of family dropdown // Implementing Family Icon Grid in place of family dropdown
//const familyGrid = document.getElementById("familyGrid") //const familyGrid = document.getElementById("familyGrid")
@ -27,8 +29,14 @@ document.addEventListener("DOMContentLoaded", function () {
}); });
// Listener for a click on the one of the family icons // Listener for a click on the one of the family icons
//familyGrid.addEventListener("on click", function() { //familyGrid.addEventListener("click", function() {
// updateMonsterGrid(); // Need a function for this too... // updateMonsterGrid(); // Need a function for this too...
//}); //});
// Listener for a click on a breeding parent
//parent.addEventListener("click", function() {
// updateMonstersDropdown();
// updateIFrames();
//});
}); });

View File

@ -13,7 +13,7 @@ function updateIframes() {
// Update breedingIframe src based on the selected monster // Update breedingIframe src based on the selected monster
const breedingIframeSrc = selectedMonster const breedingIframeSrc = selectedMonster
? `/get_breeding_combinations?monster=${selectedMonster}` ? `/breeds?monster=${selectedMonster}`
: "about:blank"; : "about:blank";
breedingIframe.src = breedingIframeSrc; breedingIframe.src = breedingIframeSrc;

View File

@ -17,7 +17,7 @@
<h3 class="text-lg font-bold">Base</h3> <h3 class="text-lg font-bold">Base</h3>
<ul> <ul>
{% for combination in selected_monster.base_combinations %} {% for combination in selected_monster.base_combinations %}
<li class="text-center cursor-pointer hover:text-red-700 w-fit"> <li id="parent" class="text-center cursor-pointer hover:text-red-700 w-fit">
<!-- Add a class to make the monster name clickable --> <!-- Add a class to make the monster name clickable -->
<span class="monster-name" data-name="{{ combination }}" <span class="monster-name" data-name="{{ combination }}"
>{{ combination }}</span >{{ combination }}</span
@ -30,7 +30,7 @@
<h3 class="text-lg font-bold">Mates</h3> <h3 class="text-lg font-bold">Mates</h3>
<ul> <ul>
{% for combination in selected_monster.mate_combinations %} {% for combination in selected_monster.mate_combinations %}
<li class="cursor-pointer hover:text-red-700 w-fit"> <li id="parent" class="cursor-pointer hover:text-red-700 w-fit">
<!-- Add a class to make the monster name clickable --> <!-- Add a class to make the monster name clickable -->
<span class="monster-name" data-name="{{ combination }}" <span class="monster-name" data-name="{{ combination }}"
>{{ combination }}</span >{{ combination }}</span
@ -42,5 +42,6 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
</body> </body>
</html> </html>