diff options
Diffstat (limited to 'templates/card')
-rw-r--r-- | templates/card/card.twig | 16 | ||||
-rw-r--r-- | templates/card/card_add.twig | 29 | ||||
-rw-r--r-- | templates/card/card_display.twig | 25 | ||||
-rw-r--r-- | templates/card/card_edit.twig | 26 | ||||
-rw-r--r-- | templates/card/card_list.twig | 38 |
5 files changed, 134 insertions, 0 deletions
diff --git a/templates/card/card.twig b/templates/card/card.twig new file mode 100644 index 0000000..9a91bfa --- /dev/null +++ b/templates/card/card.twig @@ -0,0 +1,16 @@ +{% extends 'base.twig' %} + +{% block subtitle %} + Cards +{% endblock %} +{% block main %} + <div style="align-content: center; text-align: center"> + <button onclick="location.href='/card/list'">List</button> + <button onclick="location.href='/card/add'">Add</button> + <h3>{% block pagetitle %}{% endblock %}</h3> + </div> + + <div style="align-content: center;"> + {% block pagecontent %}{% endblock %} + </div> +{% endblock %} diff --git a/templates/card/card_add.twig b/templates/card/card_add.twig new file mode 100644 index 0000000..ef01632 --- /dev/null +++ b/templates/card/card_add.twig @@ -0,0 +1,29 @@ +{% extends 'card/card.twig' %} + +{% block pagetitle %} + Add Card +{% endblock %} +{% block pagecontent %} + <form action="/card/add" method="post" enctype="multipart/form-data"> + {% for key, field in fields %} + <p> + <label>{{ key }}</label><br> + <input type="text" name="{{ field }}"> + </p> + {% endfor %} + + <!-- + {% for meta in card.meta %} + <p> + <label>{{ meta.key }}</label><br> + <input type="text" name="{{ meta.key }}" value="{{ meta.value }}" disabled> + </p> + {% endfor %} + --> + + <h4>Artworks</h4> + <input type="file" name="images[]" multiple> + + <input type="submit" value="Add"> + </form> +{% endblock %} diff --git a/templates/card/card_display.twig b/templates/card/card_display.twig new file mode 100644 index 0000000..27d5bea --- /dev/null +++ b/templates/card/card_display.twig @@ -0,0 +1,25 @@ +{% extends 'card/card.twig' %} + +{% block pagetitle %} + Show Card +{% endblock %} +{% block pagecontent %} + {% for meta in card.meta %} + <p> + <label>{{ meta.key }}</label><br> + <input type="text" name="{{ meta.key }}" value="{{ meta.value }}" disabled> + </p> + {% endfor %} + + <button onclick="location.href='/card/{{ card.id }}/edit'">Edit</button> + + <h4>Artworks</h4> + {% for artwork in card.artworks %} + <p> + <img style='max-width: 100%; max-height:300px;' src='{{ artwork.path }}'> + <button>Up</button> + <button>Down</button> + <button onclick="location.href='/artwork/{{ artwork.id }}'">Show</button> + </p> + {% endfor %} +{% endblock %} diff --git a/templates/card/card_edit.twig b/templates/card/card_edit.twig new file mode 100644 index 0000000..a7f9aa7 --- /dev/null +++ b/templates/card/card_edit.twig @@ -0,0 +1,26 @@ +{% extends 'card/card.twig' %} + +{% block pagetitle %} + Edit Card +{% endblock %} +{% block pagecontent %} + <form action="/card/{{ card.id }}/edit" method="post" enctype="multipart/form-data"> + {% for meta in card.meta %} + <p> + <label>{{ meta.key }}</label><br> + <input type="text" name="{{ meta.key }}" value="{{ meta.value }}"> + </p> + {% endfor %} + + <input type="submit" value="Save"> + </form> + + <h4>Artworks</h4> + {% for artwork in card.artworks %} + <p> + <img style='max-width: 100%; max-height:300px;' src='{{ artwork.path }}'> + <button onclick="location.href='/artwork/{{ artwork.id }}/edit'">Edit</button> + <button onclick="location.href='/artwork/{{ artwork.id }}'">Delete</button> + </p> + {% endfor %} +{% endblock %} diff --git a/templates/card/card_list.twig b/templates/card/card_list.twig new file mode 100644 index 0000000..1714fc8 --- /dev/null +++ b/templates/card/card_list.twig @@ -0,0 +1,38 @@ +{% extends 'card/card.twig' %} + +{% block pagetitle %} +List +{% endblock %} +{% block pagecontent %} + <table> + <thead> + <tr> + <th>ID</th> + {% for meta in cards[0].getAllMeta() %} + <th>{{ meta.key }}</th> + {% endfor %} + <th>Votes</th> + <th></th> + </tr> + </thead> + <tbody> + {% for card in cards %} + <tr> + <td>{{ card.id }}</td> + {% for meta in card.getAllMeta() %} + <td>{{ meta.value }}</td> + {% endfor %} + <td> + {{ card.getVotesTotal() }} + <button>Up</button> + <button>Down</button> + </td> + <td> + <button onclick="location.href='/card/{{ card.id }}'">Card</button> + <button onclick="location.href='/card/{{ card.id }}/artworks'">Artworks</button> + </td> + </tr> + {% endfor %} + </tbody> + </table> +{% endblock %} |