Procedural node add and edit forms
This commit is contained in:
@@ -2,28 +2,25 @@
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-9">
|
||||
<h2>Add Node type</h2>
|
||||
<h2>Add {{ node_type }}</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<form method="POST" action="{{url_for('nodes.add')}}">
|
||||
{{ form.hidden_tag() }}
|
||||
<div class="form-group">
|
||||
{{ form.name.label }}
|
||||
{{ form.name(size=20, class='form-control') }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ form.description.label }}
|
||||
{{ form.description(size=20, class='form-control') }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ form.url.label }}
|
||||
{{ form.url(size=20, class='form-control') }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ form.is_extended.label }}
|
||||
{{ form.is_extended(class='form-control') }}
|
||||
</div>
|
||||
<input class="btn btn-default" type="submit" value="Add Node Type">
|
||||
<form method="POST" action="{{url_for('nodes.add', node_type=node_type)}}">
|
||||
{% for field in form %}
|
||||
{% if field.name == 'csrf_token' %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
{% if field.type == "HiddenField" %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<div class="form-group">
|
||||
{{ field.label }}
|
||||
{{ field(class='form-control') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<input class="btn btn-default" type="submit" value="Create {{ node_type.name }}">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
28
attract/application/templates/nodes/edit.html
Normal file
28
attract/application/templates/nodes/edit.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-9">
|
||||
<h2>Edit {{ node.node_type.name }}</h2>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<form method="POST" action="{{url_for('nodes.edit', node_id=node.id)}}">
|
||||
{% for field in form %}
|
||||
{% if field.name == 'csrf_token' %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
{% if field.type == "HiddenField" %}
|
||||
{{ field }}
|
||||
{% else %}
|
||||
<div class="form-group">
|
||||
{{ field.label }}
|
||||
{{ field(class='form-control') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<input class="btn btn-default" type="submit" value="Edit {{ node.node_type.name }}">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@@ -1,51 +0,0 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-9">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="shots">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Node Name</th>
|
||||
<th>Url</th>
|
||||
<th>Description</th>
|
||||
<th width="8%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for node_type in node_types %}
|
||||
<tr id="row_{{node_type.id}}">
|
||||
<td>{{node_type.name}}</td>
|
||||
<td>{{node_type.url}}</td>
|
||||
<td>
|
||||
{% if node_type.description %}
|
||||
{{node_type.description|truncate(25)}}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-xs" href="#"><i class="glyphicon glyphicon-edit"></i> Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Node Name</th>
|
||||
<th>Url</th>
|
||||
<th>Description</th>
|
||||
<th width="8%"></th>
|
||||
</tr>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<a href="{{url_for('nodes.add')}}" class="btn btn-default">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user