Skip to content

Commit 676eba9

Browse files
committed
update UI OTA template with late copy changes based on device
for #19448
1 parent 8277a80 commit 676eba9

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

frontend/templates/enroll-ota.html

+36-19
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,15 @@
116116
<img src="{{.URLPrefix}}/assets/images/fleet-logo.svg" />
117117
</header>
118118
<section id="main-content">
119-
<h1>Enroll your device to Fleet</h1>
119+
<h1>
120+
Enroll your
121+
<span data-attribute="dynamic-device-type">iPhone or iPad</span> to
122+
Fleet
123+
</h1>
120124
<p class="page-description">
121-
Follow the instructions below to download and install the Fleet profile
122-
on your device.
125+
On your
126+
<span data-attribute="dynamic-device-type">iPhone or iPad</span>, follow
127+
the instructions below to download and install the Fleet profile.
123128
</p>
124129
<ol>
125130
<li>
@@ -159,22 +164,34 @@ <h1>Enroll your device to Fleet</h1>
159164
</ol>
160165
</section>
161166
<script>
162-
const os = navigator.userAgent.includes("iPhone") ? "ios" : "iPadOS";
163-
164-
const profileDownloadedImg = document.querySelector(
165-
".profile-downloaded-img"
166-
);
167-
const installProfileImg = document.querySelector(".install-profile-img");
168-
169-
// setting image src based on OS
170-
profileDownloadedImg.setAttribute(
171-
"src",
172-
`{{.URLPrefix}}/assets/images/${os}-profile-downloaded.png`
173-
);
174-
installProfileImg.setAttribute(
175-
"src",
176-
`{{.URLPrefix}}/assets/images/${os}-install-profile.png`
177-
);
167+
document.addEventListener("DOMContentLoaded", function () {
168+
const userAgent = navigator.userAgent;
169+
const isIPhone = /iPhone/.test(userAgent);
170+
const isIPad = /iPad/.test(userAgent);
171+
172+
// update text content for device type
173+
let deviceType = "iPhone or iPad"; // Default value
174+
175+
if (isIPhone) {
176+
deviceType = "iPhone";
177+
} else if (isIPad) {
178+
deviceType = "iPad";
179+
}
180+
document
181+
.querySelectorAll('[data-attribute="dynamic-device-type"]')
182+
.forEach((el) => {
183+
el.textContent = deviceType;
184+
});
185+
186+
// update image src based on OS
187+
const osImagePrefix = isIPhone ? "ios" : "iPadOS";
188+
document.querySelector(
189+
".profile-downloaded-img"
190+
).src = `{{.URLPrefix}}/assets/images/${osImagePrefix}-profile-downloaded.png`;
191+
document.querySelector(
192+
".install-profile-img"
193+
).src = `{{.URLPrefix}}/assets/images/${osImagePrefix}-install-profile.png`;
194+
});
178195
</script>
179196
</body>
180197
</html>

0 commit comments

Comments
 (0)