Skip to content

Commit

Permalink
Merge pull request bitcoin-dot-org#1716 from kuzzmi/fix-platform-os-u…
Browse files Browse the repository at this point in the history
…rl-master

Fixes an issue with URLs like /web/web/
  • Loading branch information
wbnns authored Jul 31, 2017
2 parents b33eaa0 + 444d4cf commit 671f868
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions _includes/layout/base/wallets-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
{% assign os = page.os['name'] %}
{% if wallet.compat contains platform and wallet.compat contains os %}
<div class="wallet-list-item" data-walletlevel="{{ wallet.level }}">
{% if platform == os %}
<a class="wallet-list-item-link"
href="/{{ page.lang}}/wallets/{{ platform }}/{{ wallet.id }}/">
{% else %}
<a class="wallet-list-item-link"
href="/{{ page.lang}}/wallets/{{ platform }}/{{ os }}/{{ wallet.id }}/">
{% endif %}
<img src="/img/wallet/{{ wallet.id }}.png" alt="{{ wallet.title }}" />
{{ wallet.titleshort }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion _includes/layout/base/wallets-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{% endif %}
<li class="{{ platformClass }}">
{% if platformName == 'hardware' or platformName == 'web' %}
{% assign platformHref = "/" | append: page.lang | append: "/wallets/" | append: platformName | append: "/" | append: platformName | append: "/" %}
{% assign platformHref = "/" | append: page.lang | append: "/wallets/" | append: platformName | append: "/" %}
<a href="{{ platformHref }}">{% translate walletcat{{platformName}} choose-your-wallet %}</a>
{% else %}
<a>{% translate walletcat{{platformName}} choose-your-wallet %}</a>
Expand Down
5 changes: 5 additions & 0 deletions _layouts/wallet-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ <h1>
{% if page.id contains os.name %}
{% assign btnClass = btnClass | append: " active" %}
{% endif %}
{% if platform.name == os.name %}
<a class="{{ btnClass }}"
href="/{{ page.lang }}/wallets/{{platform.name}}/{{page.wallet.id}}/">
{% else %}
<a class="{{ btnClass }}"
href="/{{ page.lang }}/wallets/{{platform.name}}/{{os.name}}/{{page.wallet.id}}/">
{% endif %}
<img src="/img/os/{{ os.name }}.png"
alt="{% translate platform{{os.name}} choose-your-wallet %}{% translate walletcat{{os.name}} choose-your-wallet %}"
title="{% translate platform{{os.name}} choose-your-wallet %}" />
Expand Down
12 changes: 10 additions & 2 deletions _plugins/wallets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def generate(site)
data = YAML.load_file(file)
platform = data['platform']
os = data['os']
dir = File.join(platform['name'], os['name'])
if platform['name'] == os['name']
dir = File.join(platform['name'])
else
dir = File.join(platform['name'], os['name'])
end

platformTitle = locs[lang]['choose-your-wallet']['walletcat' + platform['name']]
osTitle = locs[lang]['choose-your-wallet']['platform' + os['name']]
Expand All @@ -103,7 +107,11 @@ def generate(site)

# This allows generation only of valid wallet pages
if platform['name']
dir = File.join(platform['name'], os['name'], wallet['id'])
if platform['name'] == os['name']
dir = File.join(platform['name'], wallet['id'])
else
dir = File.join(platform['name'], os['name'], wallet['id'])
end

platformTitle = locs[lang]['choose-your-wallet']['walletcat' + platform['name']]
osTitle = locs[lang]['choose-your-wallet']['platform' + os['name']]
Expand Down

0 comments on commit 671f868

Please sign in to comment.