Permalink
Browse files

Ship with some standard templates

  • Loading branch information...
1 parent ffed61b commit 8c2a172f163211fe00421babadbd55726b11bf7b @paltman paltman committed Jul 2, 2012
@@ -0,0 +1,23 @@
+{% extends "formly/design/survey_edit_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+
+<header class="jumbotron subhead" id="overview">
+ <h1>Modify Choice</h1>
+ <p class="lead">Configure the choice.</p>
+</header>
+
+<form action="{% url formly_dt_choice_update pk=choice.pk %}" method="post">
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">Save</button>
+ <a class="btn" href="{{ choice.field.page.get_absolute_url }}">Cancel</a>
+ </div>
+</form>
+
+{% endblock %}
@@ -0,0 +1,24 @@
+{% extends "site_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+
+<header class="jumbotron subhead" id="overview">
+ <h1>Delete Field</h1>
+ <p class="lead">Please confirm the deletion of this field.</p>
+</header>
+
+<form action="{% url formly_dt_field_delete pk=field.pk %}" method="post">
+ <legend>{{ field }}</legend>
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-danger">Delete</button>
+ <a class="btn" href="{{ field.page.get_absolute_url }}">Cancel</a>
+ </div>
+</form>
+
+{% endblock %}
@@ -0,0 +1,75 @@
+{% extends "formly/design/survey_edit_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+
+<header class="jumbotron subhead" id="overview">
+ <h1>Modify Field</h1>
+ <p class="lead">Configure the field.</p>
+</header>
+
+<form action="{% url formly_dt_field_update pk=field.pk %}" method="post" class="well">
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <input type="hidden" name="action" value="field_update" />
+ <button type="submit" class="btn btn-primary">Save</button>
+ <a class="btn" href="{{ field.page.get_absolute_url }}">Cancel</a>
+ <a class="btn btn-danger" href="{% url formly_dt_field_delete pk=field.pk %}">Delete</a>
+ </div>
+</form>
+
+{% if field.needs_choices %}
+ <h3>Choices</h3>
+
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th>Label</th>
+ <th>Next Page</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for choice in field.choices.all %}
+ <tr>
+ <td>
+ <a href="{% url formly_dt_choice_update pk=choice.pk %}">
+ {{ choice.label }}
+ </a>
+ </td>
+ <td>{{ choice.target|default:"" }}</td>
+ <td>
+ <a class="btn btn-danger btn-mini" href="{% url formly_dt_choice_delete pk=choice.pk %}">Delete</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+
+ <a class="btn btn-success btn-mini" data-toggle="modal" href="#new-choice">
+ <i class="icon-plus icon-white"></i> Add Choice
+ </a>
+
+ <div class="modal hide" id="new-choice">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal">x</button>
+ <h3>Add Field</h3>
+ </div>
+ <form action="{% url formly_dt_field_update pk=field.pk %}" method="post">
+ {% csrf_token %}
+ <div class="modal-body">
+ {{ field_choice_form|as_bootstrap }}
+ </div>
+ <div class="modal-footer">
+ <input type="hidden" name="action" value="choice_add" />
+ <button type="submit" class="btn btn-primary">Save</button>
+ </div>
+ </form>
+ </div>
+{% endif %}
+
+{% endblock %}
@@ -0,0 +1,18 @@
+{% extends "site_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+
+<h2>Confirm Delete of Choice</h2>
+
+{{ fieldchoice }}
+
+<form action="{% url formly_dt_choice_delete pk=fieldchoice.pk %}" method="post">
+ {% csrf_token %}
+ {{ form|as_bootstrap }}
+ <button type="submit" class="btn btn-danger">Delete</button>
+ <a class="btn" href="{{ fieldchoice.field.get_absolute_url }}">Cancel</a>
+</form>
+
+{% endblock %}
@@ -0,0 +1,24 @@
+{% extends "site_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+
+<header class="jumbotron subhead" id="overview">
+ <h1>Delete Page</h1>
+ <p class="lead">Please confirm the deletion of this page.</p>
+</header>
+
+<form action="{% url formly_dt_page_delete pk=page.pk %}" method="post">
+ <legend>{{ page }}</legend>
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-danger">Delete</button>
+ <a class="btn" href="{{ page.get_absolute_url }}">Cancel</a>
+ </div>
+</form>
+
+{% endblock %}
@@ -0,0 +1,82 @@
+{% extends "formly/design/survey_edit_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+ <header class="jumbotron subhead" id="overview">
+ <h1>Modify Page</h1>
+ <p class="lead">Edit the details for this page.</p>
+ </header>
+
+<form action="{% url formly_dt_page_update pk=page.pk %}" method="post" class="well">
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <input type="hidden" name="action" value="page_update" />
+ <button type="submit" class="btn btn-primary">Save</button>
+ <a class="btn" href="{{ page.survey.get_absolute_url }}">Cancel</a>
+ <a class="btn btn-danger" href="{% url formly_dt_page_delete pk=page.pk %}">Delete</a>
+ </div>
+</form>
+
+<h3>Fields</h3>
+
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>Label</th>
+ <th>Type</th>
+ <th>Help</th>
+ <th>Required</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for field in page.fields.all %}
+ <tr>
+ <td>
+ <a href="{% url formly_dt_field_update pk=field.pk %}">
+ {{ field.label }}
+ </a>
+ </td>
+ <td>
+ {{ field.get_field_type_display }}
+ {% if field.choices.exists %}
+ {% for choice in field.choices.all %}
+ <span class="label label-inverse">{{ choice }}</span>
+ {% endfor %}
+ {% endif %}
+ </td>
+ <td>{{ field.help_text }}</td>
+ <td>{{ field.required }}</td>
+ <td>
+ <a class="btn btn-danger btn-mini" href="{% url formly_dt_field_delete pk=field.pk %}">Delete</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+
+<a class="btn btn-success btn-mini" data-toggle="modal" href="#new-field" ><i class="icon-plus icon-white"></i> Add Field</a>
+
+<div class="modal hide" id="new-field">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal">×</button>
+ <h3>Add Field</h3>
+ </div>
+ <form action="{% url formly_dt_page_update pk=page.pk %}" method="post">
+ {% csrf_token %}
+ <input type="hidden" name="action" value="field_add" />
+ <div class="modal-body">
+ {{ field_form|as_bootstrap }}
+ </div>
+ <div class="modal-footer">
+ <button type="submit" class="btn btn-primary">Save</button>
+ <a href="#" class="btn" data-dismiss="modal">Close</a>
+ </div>
+ </form>
+</div>
+
+{% endblock %}
@@ -0,0 +1,22 @@
+{% extends "site_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block body %}
+ <header class="jumbotron subhead" id="overview">
+ <h1>Delete Survey</h1>
+ <p class="lead">Please confirm the deletion of this survey.</p>
+ </header>
+
+ <form action="{% url formly_dt_survey_delete pk=survey.pk %}" method="post">
+ <legeng>{{ survey }}</legend>
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-danger">Delete</button>
+ <a class="btn" href="{{ survey.get_absolute_url }}">Cancel</a>
+ </div>
+ </form>
+{% endblock %}
@@ -0,0 +1,38 @@
+{% extends "site_base.html" %}
+
+{% block head_title %}{{ survey }}{% endblock %}
+
+{% block body %}
+ <ul class="breadcrumb">
+ <li>
+ <a href="{% url formly_dt_survey_list %}">Surveys</a> <span class="divider">/</span>
+ </li>
+ <li class="active">{{ survey.name }}</li>
+ </ul>
+
+ <header class="jumbotron subhead" id="overview">
+ <h1 class="survey-name-edit">{{ survey.name }}</h1>
+ <p class="lead">Created at {{ survey.created }} and on {{ survey.updated }} it was updated. This survey has {{ survey.pages.count }} page{{ survey.pages.count|pluralize }}.</p>
+ {% if survey.published %}<p class="lead">published {{ survey.published }}</p>{% endif %}
+ </header>
+
+ <a class="btn" href="{{ survey.first_page.get_absolute_url }}">Edit</a>
+ <a class="btn btn-danger" href="{% url formly_dt_survey_delete pk=survey.pk %}">Delete</a>
+{% endblock %}
+
+
+{% block extra_body %}
+ <script type="text/javascript" src="http://www.appelsiini.net/download/jquery.jeditable.mini.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $(".survey-name-edit").editable("{% url formly_dt_survey_change_name pk=survey.pk %}", {
+ name: "name",
+ indicator: "Saving...",
+ tooltip: "Click to edit...",
+ callback : function(value, settings) {
+ $(this).text($.parseJSON(value).name);
+ }
+ });
+ });
+ </script>
+{% endblock %}
@@ -0,0 +1,14 @@
+{% extends "subnav_base.html" %}
+
+{% block subnav %}
+ <h3>{{ page.survey }}</h3>
+ <ul class="nav nav-list">
+ {% for p in page.survey.pages.all %}
+ <li{% if p == page %} class="active"{% endif %}><a href="{{ p.get_absolute_url }}">{{ p.label }}</a></li>
+ {% endfor %}
+ </ul>
+ <form action="{% url formly_dt_page_create pk=page.survey.pk %}" method="post" style="margin-top: 1em;">
+ {% csrf_token %}
+ <button type="submit" class="btn btn-mini btn-success"><i class="icon-plus icon-white"></i> Add Page</button>
+ </form>
+{% endblock %}
@@ -0,0 +1,18 @@
+{% extends "site_base.html" %}
+
+{% load bootstrap_tags %}
+
+{% block head_title %}Create Survey{% endblock %}
+
+{% block body %}
+ <form action="{% url formly_dt_survey_create %}" method="post">
+ <legend>Create a new survey</legend>
+ {% csrf_token %}
+ <fieldset>
+ {{ form|as_bootstrap }}
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">Create</button>
+ </div>
+ </form>
+{% endblock %}
Oops, something went wrong.

0 comments on commit 8c2a172

Please sign in to comment.