Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
don't show Open or Install on grid mini app tiles (bug 1052831)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngokevin committed Aug 13, 2014
1 parent 6d32fa3 commit babf059
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/templates/_macros/feed_item.html
Expand Up @@ -5,7 +5,9 @@
{% from '_macros/stars.html' import stars %}


{% macro mini_tile(app) %}
{% macro mini_tile(app, price_only) %}
{# price_only_btns -- only show price as the label, don't show "Installed"/"Open". #}

<li class="app mini-app">
<a href="{{ url('app', [app.slug])|urlparams(src='feed') }}" class="app-link c">
{{ deferred_icon(app.icons[64], app.name|translate(app)) }}
Expand All @@ -20,8 +22,9 @@ <h2 class="app-name elliflow">{{ app.name|translate(app) }}</h2>
{% endif %}
</div>
</div>
{{ market_button(app, data_attrs={'manifest_url': app.manifest_url,
'slug': app.slug}) if app.slug }}
{{ market_button(app,
data_attrs={'manifest_url': app.manifest_url, 'slug': app.slug},
price_only=price_only) if app.slug }}
</a>
</li>
{% endmacro %}
Expand Down Expand Up @@ -79,7 +82,7 @@ <h1 class="feed-tile-header" data-brand-color="{{ color }}">
<ul class="app-list">
{% for app in brand.apps %}
{% if landing or loop.index0 < feed.MAX_BRAND_APPS %}
{{ mini_tile(app) }}
{{ mini_tile(app, price_only=not landing and brand.layout == 'grid') }}
{% endif %}
{% endfor %}
</ul>
Expand Down Expand Up @@ -147,7 +150,7 @@ <h1 class="feed-tile-header">{{ coll.name|translate(coll)|safe }}</h1>
<ul class="app-list">
{% for app in coll.apps %}
{% if landing or loop.index0 < feed.MAX_BRAND_APPS %}
{{ mini_tile(app) }}
{{ mini_tile(app, price_only=not landing) }}
{% endif %}
{% endfor %}
</ul>
Expand Down Expand Up @@ -192,7 +195,7 @@ <h1 class="name">{{ shelf.name|translate(shelf)|safe }}</h1>
<h1 class="feed-tile-header grouped">{{ group.name }}</h1>
<ul class="app-list">
{% for app in group.apps %}
{{ mini_tile(app) }}
{{ mini_tile(app, price_only=not landing) }}
{% endfor %}
</ul>
</section>
Expand Down
8 changes: 5 additions & 3 deletions src/templates/_macros/market_button.html
@@ -1,4 +1,6 @@
{% macro market_button(app, data_attrs) %}
{% macro market_button(app, data_attrs, price_only) %}
{# price_only -- used for Feed where we only want to show the price label. #}

{% set installed = has_installed(app.manifest_url) %}

{% if app.payment_required and not app.price %}
Expand All @@ -13,9 +15,9 @@
{{ 'paid' if app.payment_required }} {{ 'incompatible' if app_incompat(app) }}"
{{ data_attrs|make_data_attrs }}
{{ 'disabled' if app_incompat(app) }}>
{% if installed %}
{% if installed and not price_only %}
{{ _('Open') }}
{% elif user.has_installed(app.id) or user.has_purchased(app.id) %}
{% elif not price_only and user.has_installed(app.id) or user.has_purchased(app.id) %}
{{ _('Install') }}
{% else %}
{{ price }}
Expand Down

1 comment on commit babf059

@cvan
Copy link
Contributor

@cvan cvan commented on babf059 Aug 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like something that should have a test (or may regress an existing test)

Please sign in to comment.