new editor index
This commit is contained in:
parent
7ba7affcfc
commit
678ed82391
5 changed files with 20 additions and 35 deletions
|
@ -1,19 +1,19 @@
|
|||
{% load static %}
|
||||
{% load compress %}
|
||||
{% load i18n %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>c3nav Map Editor</title>
|
||||
<title>{% trans 'c3nav map editor' %}</title>
|
||||
{% compress css %}
|
||||
<link href="{% static 'bootstrap/css/bootstrap.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'leaflet/leaflet.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'editor/css/editor.css' %}" rel="stylesheet">
|
||||
{% endcompress %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-static-top navbar-default">
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
{% load bootstrap3 %}
|
||||
{% load i18n %}
|
||||
{% include 'editor/fragment_sections.html' %}
|
||||
|
||||
<a class="btn btn-default btn-sm pull-right" accesskey="n" href="{% url 'editor.sections' %}">{% trans 'Edit sections' %}</a>
|
||||
<h3>{{ section.title }}</h3>
|
||||
<h3>{% trans 'Sections' %}</h3>
|
||||
<div class="list-group">
|
||||
{% for s in sections %}
|
||||
<a href="{% url 'editor.index' section=s.id %}" class="list-group-item">
|
||||
<a href="{% url 'editor.section' section=s.id %}" class="list-group-item">
|
||||
{{ s.title }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
|
|
@ -2,13 +2,9 @@
|
|||
{% load i18n %}
|
||||
{% include 'editor/fragment_sections.html' %}
|
||||
|
||||
<a class="btn btn-default btn-sm pull-right" accesskey="n" href="">{% trans 'Add section' %}</a>
|
||||
<h3>{% trans 'Sections' %}</h3>
|
||||
<div class="list-group">
|
||||
{% for s in sections %}
|
||||
<a href="{% url 'editor.index' section=s.id %}" class="list-group-item{% if s == section %} active{% endif %}">
|
||||
{{ s.title }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a class="btn btn-default btn-sm pull-right" accesskey="n" href="{% url 'editor.section.edit' section=section.id %}">{% trans 'Edit Section' %}</a>
|
||||
<h3>{{ section.title }}</h3>
|
||||
<p>
|
||||
<a href="{% url 'editor.index' %}">« {% trans 'Back to overview' %}</a>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from c3nav.editor.views import edit_mapitem, list_mapitems, list_mapitemtypes, main_index, sections_list
|
||||
from c3nav.editor.views import edit_mapitem, list_mapitems, list_mapitemtypes, main_index, section_detail
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', main_index, name='editor.index'),
|
||||
url(r'^sections/$', sections_list, name='editor.sections'),
|
||||
url(r'^sections/(?P<section>[0-9]+)/$', main_index, name='editor.index'),
|
||||
url(r'^sections/(?P<section>[0-9]+)/$', section_detail, name='editor.section'),
|
||||
url(r'^sections/(?P<section>[0-9]+)/edit$', section_detail, name='editor.section.edit'),
|
||||
url(r'^mapitemtypes/(?P<level>[^/]+)/$', list_mapitemtypes, name='editor.mapitemtypes'),
|
||||
url(r'^mapitems/(?P<mapitem_type>[^/]+)/list/$', list_mapitems, name='editor.mapitems'),
|
||||
url(r'^mapitems/(?P<mapitem_type>[^/]+)/list/(?P<sectionl>[0-9]+)/$', list_mapitems, name='editor.mapitems.level'),
|
||||
|
|
|
@ -22,29 +22,20 @@ def sidebar_view(func):
|
|||
|
||||
@sidebar_view
|
||||
def main_index(request, section=None):
|
||||
if section is None:
|
||||
first_section = Section.objects.first()
|
||||
if first_section:
|
||||
return render(request, 'editor/redirect.html', {
|
||||
'target': reverse('editor.index', kwargs={'section': first_section.id})
|
||||
})
|
||||
else:
|
||||
return render(request, 'editor/redirect.html', {
|
||||
'target': reverse('editor.sections')
|
||||
})
|
||||
else:
|
||||
section = get_object_or_404(Section, pk=section)
|
||||
|
||||
return render(request, 'editor/index.html', {
|
||||
'sections': Section.objects.all(),
|
||||
'section': section,
|
||||
'section_url': 'editor.index',
|
||||
})
|
||||
|
||||
|
||||
@sidebar_view
|
||||
def sections_list(request):
|
||||
return render(request, 'editor/sections.html', {})
|
||||
def section_detail(request, section):
|
||||
section = get_object_or_404(Section, pk=section)
|
||||
|
||||
return render(request, 'editor/section.html', {
|
||||
'sections': Section.objects.all(),
|
||||
'section': section,
|
||||
'section_url': 'editor.section',
|
||||
})
|
||||
|
||||
|
||||
def list_mapitemtypes(request, section):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue