Added list view & more stuff

This commit is contained in:
David Taylor
2015-08-08 16:52:15 +03:00
committed by Tom Price
parent 153dacbf22
commit 0e42999d3e
6 changed files with 105 additions and 3 deletions

View File

@@ -6,9 +6,17 @@
{% block title %}An event checklist{% endblock %}
{% block content %}
<div ng-controller="FormController">
<form name="theForm" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(theForm)">
<div class="col-sm-12">
<h2>"{{object.schema.schema_type.name}}" for "<a href="{% url 'event_detail' object.event.pk %}">N{{object.event.pk|stringformat:"05d"}} | {{object.event.name}}</a>"</h2>
<a href="{% url 'form_list' object.event.pk %}" class="btn btn-default" title="Rig Forms"><span class="glyphicon glyphicon-chevron-left"></span> <span class="hidden-xs">Other forms for N{{object.event.pk|stringformat:"05d"}}</span></a>
<hr/>
</div>
<div ng-controller="FormController" class="col-sm-12">
<form name="theForm" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(theForm)">
</form>
</div>
@@ -29,6 +37,9 @@
<script type="text/javascript" src="{% static "js/angular-schema-form/ObjectPath.js"%}"></script>
<script type="text/javascript" src="{% static "js/angular-schema-form/schema-form.min.js"%}"></script>
<script type="text/javascript" src="{% static "js/angular-schema-form/bootstrap-decorator.min.js"%}"></script>
<link rel="stylesheet" type="text/css" href="{% static "js/angular-schema-form/bootstrap.vertical-tabs.min.css"%}"/>
<script>
$(document).ready(function () {
@@ -37,6 +48,13 @@
$scope.schema = {{ object.schema.schema }};
$scope.form = {{ object.schema.layout }};
{% comment %}
//This is useful for development, allowing the schema & layout to reside in the file system (you need to make the relevant files in the templates directory). Commented out for production
$scope.schema = {% include "rigForms/schema.js" %};
$scope.form = {% include "rigForms/layout.js" %};
{% endcomment %}
$scope.model = {{ object.data }};
{% endautoescape %}

View File

@@ -0,0 +1,51 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
{% load widget_tweaks %}
{% load static %}
{% block title %}List of Forms{% endblock %}
{% block content %}
<div class="col-sm-12">
<h2>Forms for "<a href="{% url 'event_detail' event.pk %}">N{{event.pk|stringformat:"05d"}} | {{event.name}}</a>"</h2>
</div>
<div class="col-sm-12 text-right">
<div class="btn-group btn-page">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-plus"></span> Add Form <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for type in formTypes %}
<li><a href="{% url 'create_form' event_pk=event.pk type_pk=type.pk %}">{{type.name}}</a></li>
{% endfor %}
</ul>
</div>
</div>
<div class="col-sm-12">
<table class="table table-responsive table-hover">
<thead>
<tr>
<th>#</th>
<th>Form Type</th>
<th>Last Edited</th>
<th></th>
</tr>
</thead>
<tbody>
{% for object in object_list %}
<tr>
<td>{{ object.pk }}</td>
<td>{{ object.schema.schema_type.name }}</td>
<td>{{ object.last_edited_by }} at {{ object.last_edited_at }}</td>
<td class="text-right">
<a href="{% url 'update_form' object.pk %}" class="btn btn-default">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}