@ddj-v2/shop 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ {% import "components/paginator.html" as paginator with context %}
2
+ {% import "components/nothing.html" as nothing with context %}
3
+ {% extends "coin_base.html" %}
4
+ {% block coin_content %}
5
+ <div class="section">
6
+ <div class="section__header">
7
+ <h1 class="section__title">{{ _('coin_record') }}</h1>
8
+ </div>
9
+ <div class="section__body no-padding">
10
+ {% if not bills.length %}
11
+ {{ nothing.render('沒有兌換紀錄!') }}
12
+ {% else %}
13
+ <table class="data-table">
14
+ <colgroup>
15
+ <col class="col--time" style="width:6rem">
16
+ <col class="col--uid" style="width:12rem">
17
+ <col class="col--uid" style="width:12rem">
18
+ <col class="col--amount" style="width:4rem">
19
+ <col class="col--text">
20
+ </colgroup>
21
+ <thead>
22
+ <tr>
23
+ <th>{{ _('Time') }}</th>
24
+ <th>{{ _('發放者') }}</th>
25
+ <th>{{ _('接收者') }}</th>
26
+ <th>{{ _('數額') }}</th>
27
+ <th>{{ _('原因') }}</th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ {%- for bill in bills -%}
32
+ <tr data-uid="{{ udoc.uid }}">
33
+ <td>{{ datetimeSpan(bill._id)|safe }}</td>
34
+ <td>
35
+ <a href="{{ url('coin_record',query={uid:bill.rootId}) }}">
36
+ {{ user.render_inline(udict[bill.rootId],avatar=false,badge=false,inline=false) }}
37
+ </a>
38
+ </td>
39
+ <td>
40
+ <a href="{{ url('coin_record',query={uid:bill.userId}) }}">
41
+ {{ user.render_inline(udict[bill.userId],avatar=false,badge=false,inline=false) }}
42
+ </a>
43
+ </td>
44
+ <td>{{ bill.amount }}</td>
45
+ <td>{{ bill.text }}</td>
46
+ </tr>
47
+ {%- endfor -%}
48
+ </tbody>
49
+ </table>
50
+ {{ paginator.render(page, upcount,add_qs=('uid=' + uid)) }}
51
+ {% endif %}
52
+ </div>
53
+ </div>
54
+ {% endblock %}
@@ -0,0 +1,62 @@
1
+ {% import "components/nothing.html" as nothing with context %}
2
+ {% import "components/paginator.html" as paginator with context %}
3
+ {% extends "coin_base.html" %}
4
+ {% block coin_content %}
5
+ <div class="section">
6
+ <div class="section__header">
7
+ <h1 class="section__title">{{ _('所有有過硬幣的學員') }}</h1>
8
+ </div>
9
+ <div class="section__body no-padding">
10
+ <table class="data-table">
11
+ <colgroup>
12
+ <col class="col--uid" style="width:5rem">
13
+ <col class="col--user">
14
+ <col class="col--groups" style="width:8rem">
15
+ <col class="col--coin_all" style="width:8rem">
16
+ <col class="col--coin_now" style="width:8rem">
17
+ <col class="col--actions" style="width:8rem">
18
+ </colgroup>
19
+ <thead>
20
+ <tr>
21
+ <th>{{ _('User ID') }}</th>
22
+ <th>{{ _('Username') }}</th>
23
+ <th>
24
+ <form method="get" class="inline">
25
+ <select name="groupName" class="compact select" onchange="this.form.submit()">
26
+ <option value="">{{ _('所有小組') }}</option>
27
+ {% for group in groups %}
28
+ <option value="{{ group.name }}" {% if groupName == group.name %}selected{% endif %}>
29
+ {{ group.name }} ({{ group.uids.length }} {{ _('users') }})
30
+ </option>
31
+ {% endfor %}
32
+ </select>
33
+ </form>
34
+ </th>
35
+ <th>{{ _('累計獲得硬幣') }}</th>
36
+ <th>{{ _('目前剩餘硬幣') }}</th>
37
+ <th>{{ _('Actions') }}</th>
38
+ </tr>
39
+ </thead>
40
+ <tbody>
41
+ {%- for udoc in udocs -%}
42
+ <tr>
43
+ <td>{{ udoc._id }}</td>
44
+ <td>{{ user.render_inline(udoc) }}</td>
45
+ <td>
46
+ {%- for group in groups -%}
47
+ {%- if udoc._id in group.uids -%}
48
+ {{ group.name }}{{ ' ' }}
49
+ {%- endif -%}
50
+ {%- endfor -%}
51
+ </td>
52
+ <td>{{ udoc.coin_all | default(0) }}</td>
53
+ <td>{{ udoc.coin_now }}</td>
54
+ <td><a href="{{ url('coin_bill',query={uid:udoc._id}) }}" class="typo-a contest-tag">{{ _('查看明細') }}</a></td>
55
+ </tr>
56
+ {%- endfor -%}
57
+ </tbody>
58
+ </table>
59
+ {{ paginator.render(page, upcount,add_qs=('groupName=' + groupName if groupName else '')) }}
60
+ </div>
61
+ </div>
62
+ {% endblock %}
@@ -0,0 +1,31 @@
1
+ {% extends "domain_base.html" %}
2
+ {% block domain_content %}
3
+ <div class="section">
4
+ <div class="section__header">
5
+ <h1 class="section__title">{{ _('domain_coin_setting') }}</h1>
6
+ </div>
7
+ <div class="section__body">
8
+ <form method="POST">
9
+ {{ form.form_checkbox({
10
+ label: '自動發放硬幣',
11
+ name: 'coin_enabled',
12
+ help_text: '為此網域啟用首次 AC 硬幣發放功能',
13
+ value: coin_enabled
14
+ }) }}
15
+ {{ form.form_text({
16
+ label: '每題硬幣數量',
17
+ name: 'coin_amount',
18
+ help_text: '每題首次 AC 可獲得的硬幣數量',
19
+ value: coin_amount,
20
+ type: 'number'
21
+ }) }}
22
+ <button class="rounded primary button" type="submit">
23
+ {{ _('Save All Changes') }}
24
+ </button>
25
+ <button type="button" class="rounded button" onclick="window.history.go(-1)">
26
+ {{ _('Cancel') }}
27
+ </button>
28
+ </form>
29
+ </div>
30
+ </div>
31
+ {% endblock %}
@@ -0,0 +1,50 @@
1
+ {% extends "coin_base.html" %}
2
+ {% block coin_content %}
3
+ <div class="section">
4
+ <div class="section__header">
5
+ <h1 class="section__title">{{ _('goods_add') }}</h1>
6
+ </div>
7
+ <div class="section__body">
8
+ <form method="post">
9
+ {{ form.form_text({
10
+ label:'物件 ID(可重複)',
11
+ name:'objectId',
12
+ placeholder:'例如:problem-1001'
13
+ }) }}
14
+ {{ form.form_text({
15
+ label:'商品名稱',
16
+ name:'name',
17
+ autofocus:true,
18
+ required:true
19
+ }) }}
20
+ {{ form.form_textarea({
21
+ columns:null,
22
+ label:'商品描述(Markdown)',
23
+ name:'description',
24
+ placeholder:'輸入商品描述,支援 Markdown 語法'
25
+ }) }}
26
+ {{ form.form_text({
27
+ label:'商品價格',
28
+ name:'price',
29
+ required:true
30
+ }) }}
31
+ {{ form.form_text({
32
+ label:'商品數量',
33
+ name:'num',
34
+ placeholder:'輸入 -1 表示無限供應',
35
+ required:true
36
+ }) }}
37
+ <div class="row">
38
+ <div class="columns">
39
+ <button type="submit" class="rounded primary button">
40
+ {{ _('Add') }}
41
+ </button>
42
+ <button type="button" class="rounded button" onclick="window.history.go(-1)">
43
+ {{ _('Cancel') }}
44
+ </button>
45
+ </div>
46
+ </div>
47
+ </form>
48
+ </div>
49
+ </div>
50
+ {% endblock %}
@@ -0,0 +1,57 @@
1
+ {% extends "coin_base.html" %}
2
+ {% block coin_content %}
3
+ <div class="section">
4
+ <div class="section__header">
5
+ <h1 class="section__title">{{ _('goods_edit') }}</h1>
6
+ </div>
7
+ <div class="section__body">
8
+ <form method="post">
9
+ {{ form.form_text({
10
+ label:'物件 ID(可重複)',
11
+ name:'objectId',
12
+ value:goods.objectId|default('')
13
+ }) }}
14
+ {{ form.form_text({
15
+ label:'商品名稱',
16
+ name:'name',
17
+ value:goods.name|default(''),
18
+ autofocus:true,
19
+ required:true
20
+ }) }}
21
+ {{ form.form_textarea({
22
+ columns:null,
23
+ label:'商品描述(Markdown)',
24
+ name:'description',
25
+ value:goods.description|default(''),
26
+ placeholder:'輸入商品描述,支援 Markdown 語法'
27
+ }) }}
28
+ {{ form.form_text({
29
+ label:'商品價格',
30
+ name:'price',
31
+ value:goods.price|default(''),
32
+ required:true
33
+ }) }}
34
+ {{ form.form_text({
35
+ label:'商品數量',
36
+ name:'num',
37
+ value:goods.num|default(''),
38
+ placeholder:'輸入 -1 表示無限供應',
39
+ required:true
40
+ }) }}
41
+ <div class="row">
42
+ <div class="columns">
43
+ <button name="operation" value="update" type="submit" class="rounded primary button">
44
+ {{ _('Update') }}
45
+ </button>
46
+ <button name="operation" value="delete" type="submit" class="rounded button">
47
+ {{ _('Delete') }}
48
+ </button>
49
+ <button type="button" class="rounded button" onclick="window.history.go(-1)">
50
+ {{ _('Cancel') }}
51
+ </button>
52
+ </div>
53
+ </div>
54
+ </form>
55
+ </div>
56
+ </div>
57
+ {% endblock %}
@@ -0,0 +1,79 @@
1
+ {% extends "coin_base.html" %}
2
+ {% import "components/paginator.html" as paginator with context %}
3
+ {% import "components/nothing.html" as nothing with context %}
4
+ {% block coin_content %}
5
+ <div class="section">
6
+ <div class="section__header">
7
+ <h1 class="section__title">{{ _('goods_manage')}}</h1>
8
+ <div class="section__tools">
9
+ <a class="primary rounded button" href="{{ url('goods_add') }}">{{ _('goods_add') }}</a>
10
+ </div>
11
+ </div>
12
+ <div class="section__body">
13
+ <form method="get" class="row">
14
+ <div class="medium-5 columns">
15
+ {{ form.form_text({
16
+ label:'搜尋關鍵字',
17
+ name:'keyword',
18
+ value:keyword|default(''),
19
+ placeholder:'商品名 / 物件ID / 描述'
20
+ }) }}
21
+ </div>
22
+ <div class="medium-3 columns">
23
+ <label>{{ _('庫存篩選') }}</label>
24
+ <select name="stock">
25
+ <option value="all" {% if stock == 'all' %}selected{% endif %}>全部</option>
26
+ <option value="in" {% if stock == 'in' %}selected{% endif %}>有庫存</option>
27
+ <option value="out" {% if stock == 'out' %}selected{% endif %}>已售罄</option>
28
+ <option value="infinite" {% if stock == 'infinite' %}selected{% endif %}>無限供應</option>
29
+ </select>
30
+ </div>
31
+ <div class="medium-4 columns">
32
+ <button type="submit" class="rounded primary button">{{ _('搜尋') }}</button>
33
+ <a href="{{ url('goods_manage') }}" class="rounded button">{{ _('清除') }}</a>
34
+ </div>
35
+ </form>
36
+ </div>
37
+ <div class="section__body no-padding">
38
+ {% if not ddocs.length %}
39
+ {{ nothing.render('抱歉,目前沒有商品。') }}
40
+ {% else %}
41
+ <div class="section__table-container">
42
+ <table class="data-table section__table-heade">
43
+ <colgroup>
44
+ <col class="col--id" style="width:5rem">
45
+ <col class="col--id" style="width:10rem">
46
+ <col class="col--name">
47
+ <col class="col--price">
48
+ <col class="col--num">
49
+ <col class="col--actions">
50
+ </colgroup>
51
+ <thead>
52
+ <tr>
53
+ <th>{{ _('商品 ID') }}</th>
54
+ <th>{{ _('物件ID') }}</th>
55
+ <th>{{ _('商品名稱') }}</th>
56
+ <th>{{ _('商品價格') }}</th>
57
+ <th>{{ _('商品數量') }}</th>
58
+ <th>{{ _('Action') }}</th>
59
+ </tr>
60
+ </thead>
61
+ <tbody>
62
+ {%- for ddoc in ddocs -%}
63
+ <tr>
64
+ <td>{{ ddoc._id }}</td>
65
+ <td>{{ ddoc.objectId|default('-') }}</td>
66
+ <td>{{ _(ddoc.name) }}</td>
67
+ <td>{{ ddoc.price }}</td>
68
+ <td>{% if ddoc.num < 0 %}無限{% else %}{{ ddoc.num }}{% endif %}</td>
69
+ <td><a href="{{ url('goods_edit', id=ddoc._id) }}" class="typo-a contest-tag">{{ _('Edit') }}</a></td>
70
+ </tr>
71
+ {%- endfor -%}
72
+ </tbody>
73
+ </table>
74
+ {{ paginator.render(page, dpcount) }}
75
+ </div>
76
+ {% endif %}
77
+ </div>
78
+ </div>
79
+ {% endblock%}
@@ -0,0 +1,22 @@
1
+ {% extends "coin_base.html" %}
2
+ {% import "components/nothing.html" as nothing with context %}
3
+ {% block coin_content %}
4
+ <div class="section">
5
+ <div class="section__header">
6
+ <h1 class="section__title">{{ _('shop_manage_entries') }}</h1>
7
+ </div>
8
+ <div class="section__body">
9
+ {% if not manageEntries or not manageEntries.length %}
10
+ {{ nothing.render('暫無可用擴充入口。') }}
11
+ {% else %}
12
+ <div class="typo">
13
+ <ul>
14
+ {% for entry in manageEntries %}
15
+ <li><a href="{{ entry.href }}">{{ _(entry.title) }}</a></li>
16
+ {% endfor %}
17
+ </ul>
18
+ </div>
19
+ {% endif %}
20
+ </div>
21
+ </div>
22
+ {% endblock %}
@@ -0,0 +1,42 @@
1
+ {% extends "layout/immersive.html" %}
2
+ {% block content %}
3
+ <div class="row"><div class="columns">
4
+ <div class="immersive--content immersive--center">
5
+ <h1>{{ _('uname_change') }}</h1>
6
+ <div class="row"><div class="columns">
7
+ <label class="inverse material textbox">
8
+ {{ _('Username') }}
9
+ <input name="Uname" type="text" value="{{ uidOrName }}" readonly>
10
+ </label>
11
+ </div></div>
12
+ <form method="POST">
13
+ <div class="row"><div class="columns">
14
+ <label class="inverse material textbox">
15
+ {{ _('Current Password') }}
16
+ <input name="password" type="password" autofocus>
17
+ </label>
18
+ </div></div>
19
+ <div class="row"><div class="columns">
20
+ <label class="inverse material textbox">
21
+ {{ _('新使用者名稱') }}
22
+ <input name="newUname" type="text" autocomplete="username webauthn">
23
+ </label>
24
+ </div></div>
25
+ <br/>
26
+ <div class="row"><div class="columns">
27
+ <div class="text-center">
28
+ {% if handler.user.olduname %}
29
+ <button name="operation" value="bycoin" type="submit" class="inverse expanded rounded primary button">
30
+ {{ _('修改使用者名稱( {0} 硬幣)').format(coinCost) }}
31
+ </button>
32
+ {% else %}
33
+ <button name="operation" value="free" type="submit" class="inverse expanded rounded primary button">
34
+ {{ _('修改使用者名稱(首次免費)') }}
35
+ </button>
36
+ {% endif %}
37
+ </div>
38
+ </div></div>
39
+ </form>
40
+ </div>
41
+ </div></div>
42
+ {% endblock %}