Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display map variant information #205

Merged
merged 2 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/assets/js/maps-redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,27 @@ function populateDownloadModal(id) {
node.appendChild(includeEl.cloneNode(true));
});
});
}
};

document.querySelectorAll('[data-populate="variants"]').forEach(node => {
node.innerHTML = "";
document.getElementById('mr-map-variants').classList.add('d-none');
});
if (map.variants) {
document.getElementById('mr-map-variants').classList.remove('d-none');
map.variants.forEach(variant => {
var variantEl = document.createElement('li');
variantEl.innerHTML = variant.override_name ? variant.name : map.name + ": " + variant.name;

document.querySelectorAll('[data-populate="variants"]').forEach(node => {
node.appendChild(variantEl.cloneNode(true));
});
});

const variantInfo = `The following variant of ${map.name} is bundled with this map:`;
const variantInfoPlural = `The following variants of ${map.name} are bundled with this map:`;
populateElementContent("variant-info", map.variants.length > 1 ? variantInfoPlural : variantInfo);
};

document.querySelectorAll('[data-populate="license-name"]').forEach(node => {
node.innerHTML = license.name;
Expand Down
3 changes: 2 additions & 1 deletion src/data/maps/pgm.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"tags": [
"christmas",
"halloween",
"tournament"
"tournament",
"variants"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ <h6>XML Includes</h6>
<p>This map has external XML dependencies that must be included on your PGM server in order to be loaded.</p>
<div data-populate="includes" class="mr-includes"></div>
</div>
<div class="col-12 col-lg-6 px-0 pr-lg-3 mt-1" id="mr-map-variants">
<h6>Map Variants</h6>
<p data-populate="variant-info"></p>
<ul data-populate="variants" class="mr-variants" style="font-size:1rem"></ul>
</div>
</div>
<div class="modal-inner-card mr-license row mb-3">
<div class="col-12 col-lg-6 px-0 pr-lg-3 pb-3 pb-lg-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<img {{#unless disableLazy}}data-{{/unless}}src="{{source.image_url}}" class="mr-header-image lazy" {{#if disableLazy}}onerror="this.src='/assets/img/404.png'"{{/if}}/>
<div class="mr-header-banner">
<div class="mr-header-title">
{{#if variants}}
<i class="fa fa-layer-group mr-header-variants text-warning" data-toggle="tooltip" title="This map includes {{length variants}} variant{{#gt (length variants) 1}}s{{/gt}}"></i>
{{/if}}
{{name}}
<span class="mr-header-title-suffix">{{#if version}}v{{version}}{{/if}}</span>
</div>
Expand Down
Loading