Listing and editing cards.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="well">
|
||||
<h2>Add a Card</h2>
|
||||
<form action="{{ url_for('add_card') }}" method=post class=add-card>
|
||||
<form action="{{ url_for('add_card') }}" method=post>
|
||||
<div class="form-group">
|
||||
<label for="general" class="toggleButton btn btn-default btn-lg">General
|
||||
<input type="radio" name="type" value="1" id="general"/>
|
||||
@@ -36,7 +36,10 @@
|
||||
|
||||
{% for card in cards %}
|
||||
<div>
|
||||
<h3>{{ card.front }}</h3>
|
||||
<h3>
|
||||
<a href="{{ url_for('edit', card_id=card.id) }}" class="btn btn-xs btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
|
||||
{{ card.front }}
|
||||
</h3>
|
||||
{% if card.type == 1 %}
|
||||
{{ card.back|replace("\n", "<br />") }}
|
||||
{% else %}
|
||||
|
||||
40
templates/edit.html
Normal file
40
templates/edit.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<div class="well">
|
||||
<h2>Edit Card #{{ card.id }}</h2>
|
||||
<form action="{{ url_for('edit_card') }}" method=post>
|
||||
<div class="form-group">
|
||||
<label for="general" class="btn btn-default btn-lg">General
|
||||
<input type="radio" name="type" value="1"
|
||||
id="general" {{ "checked" if (card.type == 1) else "" }} />
|
||||
</label>
|
||||
<label for="code" class="btn btn-default btn-lg">Code
|
||||
<input type="radio" name="type" value="2" id="code" {{ "checked" if (card.type == 2) else "" }} />
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="front">Front of Card</label>
|
||||
<input type="text" name="front" class="form-control" value="{{ card.front|e }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="back">Back of Card</label>
|
||||
<textarea name="back"
|
||||
class="form-control"
|
||||
id="back"
|
||||
placeholder="back of card"
|
||||
rows="12">{{ card.back|e }}</textarea>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="known"
|
||||
value="1" {{ "checked" if (card.known == 1) else "" }} /> Known
|
||||
</label>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="card_id" value="{{ card.id|e }}" />
|
||||
<button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -6,6 +6,7 @@
|
||||
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}" />
|
||||
<!-- I know this doesn't belong in head, but I have script in a template that needs to have jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
|
||||
<script src="https://use.fontawesome.com/8cea844162.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
Reference in New Issue
Block a user