Commit bec1a5e0 authored by gijs's avatar gijs
Browse files

Should fix #14, but by moving it into a setting to allow for different behaviour per installation.

parent a699ee87
......@@ -16,7 +16,7 @@
{% endfor %}
{% for pad in tree.pads %}
<li>
<a data-uid="{{ pad.display_slug }}" href="{% url 'pad-read' mode='r' slug=pad.display_slug %}" class="pad-link">
<a data-uid="{{ pad.display_slug }}" href="{% url 'pad' mode=PAD_OPEN_MODE slug=pad.display_slug %}" class="pad-link">
{{ pad.display_slug|stripPath:folderPath|dewikify }}
{% if pad.is_public %}(public){% endif %}
</a>
......
......@@ -35,8 +35,10 @@ urlpatterns = [
re_path(r'^public/(?P<pk>\d+)/$', views.padPublic, name='pad-public'),
re_path(r'^private/(?P<pk>\d+)/$', views.padPrivate, name='pad-private'),
re_path(r'(?P<mode>[r|s|p])/(?P<slug>[^/]+)$', views.pad_read, name='pad-read'),
re_path(r'(?P<mode>[r|s|p])/(?P<slug>[^/]+)$', views.pad_read, name='pad'),
re_path(r'(?P<mode>[w])/(?P<slug>[^/]+)$', views.pad, name='pad'),
#re_path(r'r/(?P<slug>[^/]+)$', views.pad, name='pad-read'),
#re_path(r's/(?P<slug>[^/]+)$', views.pad, name='pad-slide'),
#re_path(r'p/(?P<slug>[^/]+)$', views.pad, name='pad-print'),
re_path(r'w/(?P<slug>[^/]+)$', views.pad, name='pad-write'),
re_path(r'w/(?P<slug>[^/]+)$', views.pad, name='pad-write')
]
......@@ -348,7 +348,7 @@ def padPrivate(request, pk):
con
)
def pad(request, pk=None, slug=None):
def pad(request, pk=None, slug=None, mode=None):
if slug:
pad = get_object_or_404(Pad, display_slug=slug)
else:
......@@ -713,7 +713,14 @@ def manage(request, path=[]):
folders.sort(key=str.lower)
return render(request, "manage-tree.html", {'tree': tree, 'folderPath': path, 'crumbs': crumbs, 'folders': folders, 'folderPathString': '/'.join(path) if path else None })
return render(request, "manage-tree.html", {
'tree': tree,
'folderPath': path,
'crumbs': crumbs,
'folders': folders,
'folderPathString': '/'.join(path) if path else None,
'PAD_OPEN_MODE': settings.TREE_PAD_OPEN_MODE
})
def all(request):
if request.user.is_authenticated:
......
......@@ -128,7 +128,6 @@ USE_TZ = True
STATIC_URL = '/static/'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
......@@ -157,3 +156,5 @@ except NameError:
pass
API_LOCAL_URL = None
TREE_PAD_OPEN_MODE = 'w'
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment