Skip to content

Commit c0c2cb0

Browse files
committed
Fixed: Download buttons on movement detail.
Button is no longer erased by cart-button script. Movements that are locked in the cart now have a redish background, rather than a light blue. Fixes #212
1 parent f0360c4 commit c0c2cb0

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

elvis/static/js/elvis-scripts/cartButtonScript.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,14 @@ function build_item_dict($forms)
135135

136136
function str_to_bool(str)
137137
{
138-
if (str.toLowerCase() === "true")
138+
if (str === "true")
139139
{
140140
return true
141141
}
142-
else if (str.toLowerCase() === "init")
142+
143+
else if (str === "piece")
143144
{
144-
return "init"
145+
return "piece"
145146
}
146147
return false
147148
}
@@ -168,9 +169,9 @@ function draw_badge(data, element)
168169
$elem.children(":button").remove();
169170
var new_button = "", new_action = "";
170171

171-
if (data['in_cart'] === "Piece")
172+
if (data['in_cart'] === "piece")
172173
{
173-
new_button = '<button type="button" class="btn btn-mini btn-info disabled cart-badge" data-container="body" data-toggle="tooltip" data-placement="top" title="In cart under piece."><span class="glyphicon glyphicon-lock"> </span> </button>'
174+
new_button = '<button type="button" class="btn btn-mini btn-danger disabled cart-badge" data-container="body" data-toggle="tooltip" data-placement="top" title="In cart under piece."><span class="glyphicon glyphicon-lock"> </span> </button>'
174175
new_action = "add"
175176
}
176177
else if (data['in_cart'] === true)

elvis/templates/base/download-badge.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
{% endif %}
1414

1515
{% elif in_cart == "piece" %}
16-
<input type="hidden" name="in_cart" value="true" />
16+
<input type="hidden" name="in_cart" value="piece" />
1717
<input type="hidden" name="action" value="remove" />
1818
{% if button_type|default_if_none:"badge" == "badge" %}
19-
<button type="button" class="btn btn-mini btn-info cart-badge disabled" data-container="body" data-toggle="tooltip" data-placement="top" title="" data-original-title="Locked in by Piece."><span class="glyphicon glyphicon-lock"> </span> </button>
19+
<button type="button" class="btn btn-mini btn-danger cart-badge disabled" data-container="body" data-toggle="tooltip" data-placement="top" title="" data-original-title="Locked in by Piece."><span class="glyphicon glyphicon-lock"> </span> </button>
2020
{% else %}
21-
<button type="button" class="btn btn-info disabled">Locked in by Piece.</button>
21+
<button type="button" class="btn btn-danger disabled cart-button">Locked in by Piece.</button>
2222
{% endif %}
2323

2424
{% elif not in_cart|default_if_none:True %}

elvis/views/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _check_in_cart(self, cart, items):
9090
if item['item_type'] == "elvis_movement":
9191
mov = try_get(item['id'], Movement)
9292
if mov.parent_cart_id in cart:
93-
back = "Piece"
93+
back = "piece"
9494
else:
9595
back = item in cart
9696
else:

0 commit comments

Comments
 (0)