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 Full URL in Results and Make it Clickable #252

Merged
merged 5 commits into from
Feb 11, 2024
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
13 changes: 12 additions & 1 deletion assets/js/components/SiteAnalysisResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class SiteAnalysisResult {
this._setDomContent(pageResultData, "data-int", "data-int-attr");

// specific components updates
this._updateUrl(pageResultData.url)
this._updateNoteChart(pageResultData.grade);
this._updateFootprintResultsFromSelect();
this._updatetResultRangeSliders(pageResultData);
Expand Down Expand Up @@ -197,7 +198,7 @@ class SiteAnalysisResult {
let formatedValue;
// Format date
formatedValue = this._getValidDateString(elementValue);
formatedValue = formatedValue ? formatedValue : getUrlHostName(elementValue);
formatedValue = formatedValue ? formatedValue : elementValue;
bgatellier marked this conversation as resolved.
Show resolved Hide resolved
return formatedValue ? formatedValue : elementValue;
}

Expand Down Expand Up @@ -260,5 +261,15 @@ class SiteAnalysisResult {
const sliderEls = document.querySelectorAll(".js-rlr");
sliderEls.forEach((sliderEl) => new ResultRangeSlider({ sliderEl, data }));
}

/**
* Update the href and title attribute of the element that contains the analyzed URL
* @param {string} url
*/
_updateUrl(url) {
const urlElement = this.el.querySelector(".result-url")

urlElement.setAttribute("value", url)
}
}
export default SiteAnalysisResult;
4 changes: 3 additions & 1 deletion content/en/result/_#first_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ widget="result-intro"
Calculated on {{< result-date >}}

<h1 class="h2 font-weight:semi-bold">
Results for {{< result-url >}}
Analysis results
</h1>

{{< result-url >}}
4 changes: 3 additions & 1 deletion content/fr/result/_#first_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ widget="result-intro"
Calculé le {{< result-date >}}

<h1 class="h2 font-weight:semi-bold">
Résultat pour {{< result-url >}}
Résultats de l’analyse
</h1>

{{< result-url >}}
2 changes: 1 addition & 1 deletion layouts/partials/components/result-url.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<span class="result-url" data-int="url"></span>
<input class="result-url" disabled data-int="url">
1 change: 1 addition & 0 deletions layouts/partials/widgets/result-intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
>{{ partial "svg/inline-svg-use" "icon-arrow-left" }}&nbsp;{{ i18n `Back` }}</a
>
</div>

<div class="display:flex justify-content:end text-align:end">
<a href="/" class="button-default js-button-retest"
><span class="icon-square-wrapper bg-darkish" aria-label="{{ i18n `ReTest` }}"
Expand Down
Loading