Skip to content

Commit 980ca00

Browse files
committed
add option and refactor steam importer part in users/data.html
1 parent aaf8937 commit 980ca00

File tree

1 file changed

+135
-62
lines changed

1 file changed

+135
-62
lines changed

users/templates/users/data.html

Lines changed: 135 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -216,85 +216,158 @@
216216
<article>
217217
<details>
218218
<summary>{% trans 'Import from Steam Wishlist / Library (owned games only)' %}</summary>
219+
<!-- For disabling form entries -->
220+
<script src="{{ cdn_url }}/npm/[email protected]/dist/cdn.min.js" defer></script>
219221
<form action="{% url 'users:import_steam' %}" method="post">
220222
{% csrf_token %}
221-
<div>
222-
{% trans 'Steam API Key' %}
223-
<br>
224-
<small>
223+
<!-- Steam API Key Section -->
224+
<div class="form-section">
225+
<b>{% trans 'Steam API Key' %}</b>
226+
<small class="form-hint">
225227
<a href="https://steamcommunity.com/dev/apikey"
226228
target="_blank"
227229
rel="noopener noreferrer">{% trans 'Get it here' %}</a>
228230
</small>
229-
<input type="str"
231+
<input type="text"
230232
name="steam_apikey"
231-
value=""
232233
placeholder="1A23B456C7890D9AS9D734BI3IB12943"
233234
required>
234-
{% trans 'Steam User ID' %}
235-
<br>
236-
<small>
237-
{% trans 'Find as \'Steam ID: ...\' in ' %} <a href="https://store.steampowered.com/account/"
238-
target="_blank"
239-
rel="noopener noreferrer">{% trans 'Account Details' %}</a>
235+
</div>
236+
<!-- Steam User ID Section -->
237+
<div class="form-section">
238+
<b>{% trans 'Steam User ID' %}</b>
239+
<small class="form-hint">
240+
{% trans 'Find as "Steam ID: ..." in ' %}
241+
<a href="https://store.steampowered.com/account/"
242+
target="_blank"
243+
rel="noopener noreferrer">{% trans 'Account Details' %}</a>
240244
</small>
241-
<input type="str"
242-
name="steam_id"
243-
value=""
244-
placeholder="0123456789101112"
245-
required>
245+
<input type="text" name="steam_id" placeholder="0123456789101112" required>
246246
</div>
247-
<p>
248-
{% trans 'To import...' %}:
249-
<br>
250-
<label for="id_import_wishlist">
247+
<hr>
248+
<!-- Source Filter -->
249+
<div class="form-section" x-data="{ fetch_owned: true }">
250+
<b>{% trans 'Sources to import from' %}</b>
251+
<label class="checkbox-group">
251252
<input type="checkbox"
252253
name="fetch_wishlist"
253-
value="True"
254-
required=""
255-
id="id_import_wishlist"
256-
checked>
257-
{% trans 'Wishlist' %}
258-
</label>
259-
<label for="id_import_owned">
260-
<input type="checkbox"
261-
name="fetch_owned"
262-
value="True"
263-
required=""
264-
id="id_import_owned">
265-
{% trans 'Owned games in library' %}
266-
</label>
267-
</p>
268-
<p>
269-
{% trans 'Visibility' %}:
270-
<br>
271-
<label for="id_visibility_0">
272-
<input type="radio"
273-
name="visibility"
274-
value="0"
275-
required=""
276-
id="id_visibility_0"
254+
x-model="fetch_wishlist"
277255
checked>
278-
{% trans 'Public' %}
256+
{% trans 'Fetch wishlist' %}
279257
</label>
280-
<label for="id_visibility_1">
281-
<input type="radio"
282-
name="visibility"
283-
value="1"
284-
required=""
285-
id="id_visibility_1">
286-
{% trans 'Followers Only' %}
258+
<label class="checkbox-group">
259+
<input type="checkbox" name="fetch_owned" x-model="fetch_owned" checked>
260+
{% trans 'Fetch owned games' %}
261+
<div style="margin-left: 1.5rem;">
262+
<label x-bind:aria-disabled="!fetch_owned.toString()">
263+
<input type="radio"
264+
name="owned_filter"
265+
value="all_free"
266+
x-bind:disabled="!fetch_owned">
267+
{% trans 'Fetch all free games' %}
268+
</label>
269+
<label x-bind:aria-disabled="!fetch_owned.toString()">
270+
<input type="radio"
271+
name="owned_filter"
272+
value="played_free"
273+
checked
274+
x-bind:disabled="!fetch_owned">
275+
{% trans 'Fetch played free games' %}
276+
</label>
277+
<label x-bind:aria-disabled="!fetch_owned.toString()">
278+
<input type="radio"
279+
name="owned_filter"
280+
value="no_free"
281+
x-bind:disabled="!fetch_owned">
282+
{% trans 'Fetch no free games' %}
283+
</label>
284+
</div>
287285
</label>
288-
<label for="id_visibility_2">
289-
<input type="radio"
290-
name="visibility"
291-
value="2"
292-
required=""
293-
id="id_visibility_2">
294-
{% trans 'Mentioned Only' %}
286+
</div>
287+
<!-- Status Filter -->
288+
<div class="form-section">
289+
<b>{% trans 'Import games with these estimated status' %}</b>
290+
<div class="checkbox-group grid">
291+
<label>
292+
<input type="checkbox" name="import_playing" checked>
293+
{% trans 'Playing' %}
294+
</label>
295+
<label>
296+
<input type="checkbox" name="import_played" checked>
297+
{% trans 'Played' %}
298+
</label>
299+
<label>
300+
<input type="checkbox" name="import_wishlist" checked>
301+
{% trans 'To play' %}
302+
</label>
303+
<label>
304+
<input type="checkbox" name="import_dropped" checked>
305+
{% trans 'Dropped' %}
306+
</label>
307+
</div>
308+
</div>
309+
<!-- Ignored Games -->
310+
<div class="form-section">
311+
<b>{% trans 'Ignored Games' %}</b>
312+
<small>{% trans 'input comma-separated Steam AppIDs' %}</small>
313+
<input type="text" name="ignored_appids" placeholder="12345,67890,54321">
314+
</div>
315+
<hr>
316+
<!-- Reverse Override -->
317+
<div class="form-section">
318+
<b>{% trans 'Override' %}</b>
319+
<label class="checkbox-group">
320+
<input type="checkbox" role="switch" name="allow_reverse_override">
321+
{% trans 'Allow reverse override of status (e.g. playing -> want to, or played -> playing)' %}
295322
</label>
296-
</p>
297-
<input type="submit" value="{% trans 'Import' %}" />
323+
</div>
324+
<hr>
325+
<!-- Mark Date -->
326+
<div class="form-section">
327+
<b>{% trans 'Mark Date' %}</b>
328+
<div class="radio-group" x-data="{mark_date: 'steam_timestamp'}">
329+
<label>
330+
<input type="radio"
331+
name="mark_date"
332+
x-model="mark_date"
333+
value="current_time">
334+
{% trans 'Current time (not recommended)' %}
335+
</label>
336+
<label>
337+
<input type="radio"
338+
name="mark_date"
339+
x-model="mark_date"
340+
value="steam_timestamp"
341+
checked>
342+
{% trans 'Using timestamp from Steam' %}
343+
<select name="timezone" x-bind:disabled="mark_date !== 'steam_timestamp'">
344+
<option>UTC</option>
345+
<option>EST</option>
346+
<option>PST</option>
347+
</select>
348+
</label>
349+
</div>
350+
</div>
351+
<hr>
352+
<!-- Visibility -->
353+
<div class="form-section">
354+
<b>{% trans 'Visibility' %}</b>
355+
<div class="radio-group">
356+
<label>
357+
<input type="radio" name="visibility" value="0" checked>
358+
{% trans 'Public' %}
359+
</label>
360+
<label>
361+
<input type="radio" name="visibility" value="1">
362+
{% trans 'Followers Only' %}
363+
</label>
364+
<label>
365+
<input type="radio" name="visibility" value="2">
366+
{% trans 'Mentioned Only' %}
367+
</label>
368+
</div>
369+
</div>
370+
<button type="submit" class="submit-button">{% trans 'Import' %}</button>
298371
</form>
299372
</details>
300373
</article>

0 commit comments

Comments
 (0)