使用url()来构建url

This commit is contained in:
masnn committed 2020-06-12 13:37:19 +08:00
1 parent 0efac48bde
commit 86f67a0ec3
61 files changed
+262 -275

No files matched your search

+7 -7
View File
@@ -4,8 +4,8 @@
{% block content %}
<script>
var Context = {
getProblemUrlWithCategory: "/p/category/{category}",
getProblemUrlWithoutCategory: "/p",
getProblemUrlWithCategory: "{{ url('problem_category', category='{category}') }}",
getProblemUrlWithoutCategory: "{{ url('problem_main') }}",
currentCategory: "{{category}}"
};
</script>
@@ -27,13 +27,13 @@
{% for category, sub_categories in model.builtin.CATEGORIES %}
<li class="group-list__item">
<h2 class="section__title">
<a href="/p/category/{{ category|urlencode }}">{{ category }}</a>
<a href="{{ url('problem_category', category=category) }}">{{ category }}</a>
</h2>
{% if sub_categories | length > 0 %}
<ol class="chip-list">
{% for sub_category in sub_categories %}
<li class="chip-list__item">
<a class="typo-a" href="/p/category/{{ category|urlencode + ',' + sub_category|urlencode }}">{{ sub_category }}</a>
<a class="typo-a" href="{{ url('problem_category', category=(category + ',' + sub_category)) }}">{{ sub_category }}</a>
</li>
{% endfor %}
</ol>
@@ -50,7 +50,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Search') }}</h1>
</div>
<form method="get" action="/problem/search">
<form method="get" action="{{ url('problem_search') }}">
<div class="section__body">
<label>
<input name="q" type="text" class="textbox" value="" placeholder="1001">
@@ -66,12 +66,12 @@
</div>
<ol class="menu">
<li class="menu__item">
<a href="/problem/create" class="menu__link">
<a href="{{ url('problem_create') }}" class="menu__link">
<span class="icon icon-add"></span>
{{ _('Create Problem') }}</a>
</li>
<li class="menu__item">
<a href="/problem/import" class="menu__link">
<a href="{{ url('problem_import') }}" class="menu__link">
<span class="icon icon-copy"></span>
{{ _('Import Problem') }}</a>
</li>