Add a begining of API and CSS+JS (static files folder)

This commit is contained in:
Skia 2016-01-08 17:11:38 +01:00
parent f5b07887a5
commit 771056d6e4
8 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1 @@
console.log('Guy');

View File

@ -0,0 +1,3 @@
body {
background: #EEE;
}

View File

@ -0,0 +1,4 @@
{% load renderer %}
{{ text|markdown }}

View File

@ -1,8 +1,12 @@
{% load staticfiles %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<link rel="stylesheet" href="style.css" /> {% block head %}
<title>{% block title %}Bienvenue sur le Sith de l'AE!{% endblock %}</title> <title>{% block title %}Bienvenue sur le Sith de l'AE!{% endblock %}</title>
<link rel="stylesheet" href="{% static 'core/style.css' %}">
<script src="{% static 'core/script.js' %}"></script>
{% endblock %}
</head> </head>
<body> <body>

View File

@ -1,10 +1,15 @@
{% extends "core/page.html" %} {% extends "core/page.html" %}
{% block head %}
{{ block.super }}
{% endblock %}
{% block page %} {% block page %}
<h2>Edit page</h2> <h2>Edit page</h2>
<form action="{% url 'core:page_edit' page_name=page.get_full_name %}" method="post"> <form action="{% url 'core:page_edit' page_name=page.get_full_name %}" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
{# TODO: NOW THAT WE HAVE JAVASCRIPT, MAKE A PREVISUALISATION BUTTON USING api/markdown?text=guyguyguy #}
<p><input type="submit" value="Save!" /></p> <p><input type="submit" value="Save!" /></p>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -34,5 +34,8 @@ urlpatterns = [
url(r'^page/(?P<page_name>[a-z0-9/\-_]*)/hist$', PageHistView.as_view(), name='page_hist'), url(r'^page/(?P<page_name>[a-z0-9/\-_]*)/hist$', PageHistView.as_view(), name='page_hist'),
url(r'^page/(?P<page_name>[a-z0-9/\-_]*)/rev/(?P<rev>[0-9]+)/', PageRevView.as_view(), name='page_rev'), url(r'^page/(?P<page_name>[a-z0-9/\-_]*)/rev/(?P<rev>[0-9]+)/', PageRevView.as_view(), name='page_rev'),
url(r'^page/(?P<page_name>[a-z0-9/\-_]*)/$', PageView.as_view(), name='page'), url(r'^page/(?P<page_name>[a-z0-9/\-_]*)/$', PageView.as_view(), name='page'),
# API
url(r'^api/markdown$', render_markdown, name='api_markdown'),
] ]

View File

@ -62,4 +62,5 @@ from .user import *
from .page import * from .page import *
from .site import * from .site import *
from .group import * from .group import *
from .api import *

4
core/views/api.py Normal file
View File

@ -0,0 +1,4 @@
from django.shortcuts import render
def render_markdown(request):
return render(request, 'core/api/markdown.html', context={'text': request.GET['text']})