Skip to content

Commit

Permalink
Add link to keys shop
Browse files Browse the repository at this point in the history
  • Loading branch information
abhigyanghosh30 committed Aug 30, 2023
1 parent 36aca65 commit 0e076aa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { currencyFormatter } from "advantage/react/utils";
const CredKeyShop = () => {
const CUEExamKey = {
id: "cue-activation-key",
longId: "lAMGrt4buzUR0-faJqg-Ot6dgNLn7ubIpWiyDgOrsDCg",
longId: "lAEPoNKYCFgZGmddQXplCtcnf5wMpYUXloGygjPK3y0E",
name: "CUE Activation Key",
price: { value: 4900, currency: "USD" },
productID: "cue-activation-key",
Expand Down
24 changes: 15 additions & 9 deletions templates/credentials/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ <h1>Canonical Credentials</h1>
Find the shortest path to your passion. Develop and certify your skills
on the world's most popular Linux OS.
</p>
{% if can_purchase %}
<p>
<a href="/credentials/shop"
><button class="p-button--positive">Get your exam now!</button></a
>
</p>
{% else %}
<p>
{% if user_purchasing %}
<a href="/credentials/shop">
<button class="p-button--positive">Get your exam now!</button>
</a>
{% endif %} {% if enterprise_purchasing %}
<a href="/credentials/shop/keys">
<button class="p-button is-dark">Buy exam attempts</button>
</a>
{% endif %} {% if not user_purchasing and not enterprise_purchasing %}
<i>
Sign-ups for the CUE.01: Linux beta are now closed. Please check back
for future announcements and beta opportunities.
</i>
{% endif %}
</p>
{% endif %}
</div>
</div>
</section>
Expand Down Expand Up @@ -136,10 +138,14 @@ <h3 class="p-heading--5 u-no-margin--bottom">
>Syllabus&nbsp;›</a
>
</div>
{% if can_purchase %}
{% if user_purchasing %}
<div class="col-2">
<a href="/credentials/shop">Take now&nbsp;›</a>
</div>
{% endif %} {% if enterprise_purchasing %}
<div class="col-2">
<a href="/credentials/shop/keys">Buy exam attempts&nbsp;›</a>
</div>
{% endif %}
</div>
</div>
Expand Down
14 changes: 10 additions & 4 deletions webapp/shop/cred/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ def cred_home(ua_contracts_api, **_):
available_products = ua_contracts_api.get_product_listings(
"canonical-cube"
).get("productListings")
user_purchasing = False
enterprise_purchasing = False
for product in available_products:
if product.get("name") == "CUE Linux Essentials":
return flask.render_template(
"credentials/index.html", can_purchase=True
)
return flask.render_template("credentials/index.html", can_purchase=False)
user_purchasing = True
if product.get("name") == "CUE Activation Key":
enterprise_purchasing = True
return flask.render_template(
"credentials/index.html",
user_purchasing=user_purchasing,
enterprise_purchasing=enterprise_purchasing,
)


@shop_decorator(area="cred", permission="user_or_guest", response="html")
Expand Down

0 comments on commit 0e076aa

Please sign in to comment.