Permalink
Browse files

support for django-form-designer

  • Loading branch information...
1 parent db4854b commit 3ad34e0212445c38bd4bebc7d5379fd01ff9e767 @evildmp committed Mar 7, 2013
@@ -211,3 +211,10 @@ ul li.arkestra a {
height:1px;
overflow:hidden;
}
+
+/* forms */
+
+form.arkestra-form input,
+form.arkestra-form textarea {width: 100%;}
+form.arkestra-form .errors {color: red;}
+form.arkestra-form label {font-weight: bold;}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>{{ form_definition.title}}</title>
+ <style type="text/css">
+
+ .error, .errorlist li {
+ color: red;
+ }
+
+ .success {
+ color: green;
+ }
+
+ td, th {
+ border: 1px gray solid;
+ vertical-align: top;
+ }
+
+ label {
+ color: gray;
+ }
+
+ p label {
+ display: inline-block;
+ min-width: 5em;
+ }
+
+ .required label {
+ font-weight: bold;
+ }
+
+ .required label:after {
+ content: "*";
+ }
+
+ </style>
+</head>
+<body>
+ <!-- example base template, replace with your own -->
+ {% block content %}
+ {% endblock %}
+</body>
+</html>
@@ -0,0 +1,2 @@
+{% load friendly %}{% for item in data %}<strong>{% if item.label %}{{ item.label }}{% else %}{{ item.name }}{% endif %}</strong>: {{ item.value|friendly }}<br />
+{% endfor %}
@@ -0,0 +1,21 @@
+{% extends "html/formdefinition/base.html" %}
+{% block content %}
+{% if form_definition.title %}<h2>{{ form_definition.title }}</h2>{% endif %}
+{% if form_definition.body %}<p>{{ form_definition.body|linebreaksbr }}</p>{% endif %}
+{% if messages %}
+<ul class="messages">
+{% for message in messages %}
+<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% include form_template %}
+
+
+<script type="text/javascript">
+ var inputs = document.getElementsByTagName('input');
+ if (inputs.length) {
+ inputs[0].focus();
+ }
+</script>
+{% endblock %}
@@ -0,0 +1,37 @@
+{% load friendly %}
+<form class="arkestra-form" name="{{ form_definition.name }}" action="{{ form_definition.action }}" method="{{ form_definition.method }}" enctype="multipart/form-data">
+ {% if messages %}
+ <h{{ IN_BODY_HEADING_LEVEL }}>Response</h{{ IN_BODY_HEADING_LEVEL }}>
+ {{ messages.success }}
+ {% for message in messages %}
+ <p><strong>{{message}}</strong></p>
+ {%endfor %}
+ {% endif %}
+ {% for entry in logs %}
+ <h{{ IN_BODY_HEADING_LEVEL }}>Your submission</h{{ IN_BODY_HEADING_LEVEL }}>
+ {% for field in entry.data %}
+ <p>
+ <label for="">{{ field.label }}</label>
+ {{ field.value|friendly }}
+ </p>
+ {% endfor %}
+ {% endfor %}
+
+ {% for field in form %}
+ {% if not field.is_hidden %}
+ {{ field.errors }}
+ <p class="field {% if field.errors %}errors{% endif %}{% if field.field.required %}{% if field.errors %} {% endif %}required{% endif %}">
+ <label for="{{ field.auto_id }}">{{ field.label }} {{field.field.required|yesno:"(required),"}}</label>
+ {{ field }}
+ </p>
+ {% endif %}
+ {% endfor %}
+
+ <p class="buttons">
+ {% include "html/formdefinition/forms/includes/submit.html" %}
+ </p>
+ {% for field in form.hidden_fields %}
+ {{ field }}
+ {% endfor %}
+ {% csrf_token %}
+</form>
@@ -0,0 +1,2 @@
+{% load i18n %}
+<input type="submit" value="{% if form_definition.submit_label %}{{ form_definition.submit_label }}{% else %}{% trans "Submit" %}{% endif %}" />

0 comments on commit 3ad34e0

Please sign in to comment.