diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-07 18:06:40 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-07 18:06:40 +0200 |
| commit | 2589f1e270b4cc2cc8bb83ffd0d770feaedffc72 (patch) | |
| tree | 5ae72e456f4a43edd89c9aae893c70e25a9df6ab /templates/index.html | |
| parent | 18925d9c437e0fd64020d979597708fdc56aa3d2 (diff) | |
| download | jokevote-2589f1e270b4cc2cc8bb83ffd0d770feaedffc72.tar.gz jokevote-2589f1e270b4cc2cc8bb83ffd0d770feaedffc72.zip | |
allow editing
Diffstat (limited to 'templates/index.html')
| -rw-r--r-- | templates/index.html | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/templates/index.html b/templates/index.html index 1394f53..e49514a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -76,17 +76,31 @@ <span class="right red-text">{{ joke.reports }}</span> </button> </form> + </div> + <div class="joke flow-text col s8 m10 {% if joke.reports>0 %}grey-text{% endif %}" style="line-height: 1.5"> + {% if joke.mine %} + <form action="/edit" method="post"> + <input type="hidden" name="id" value="{{ joke.id }}"> + <input type="hidden" name="redirpage" value="{{ currentpage }}"> + <button type="button" class="btn-floating right blue noteditor" onclick="openEditor(this)"><i class="material-icons">edit</i></button> + <div class="input-field hide editor"> + <label for="text">Spruch bearbeiten</label> + <textarea class="materialize-textarea" name="text">{{ joke.text }}</textarea> + <button type="submit" class="btn-floating right blue"><i class="material-icons">done</i></button> + </div> + </form> + {% endif %} + <div class="textfield noteditor"> + {{ joke.html|safe }} + </div> {% if joke.mine %} <form action="/delete" method="post"> <input type="hidden" name="id" value="{{ joke.id }}"> <input type="hidden" name="redirpage" value="{{ currentpage }}"> - <button class="deletebtn btn-flat" type="submit"><i class="material-icons">delete</i></button> + <button class="btn-floating right red noteditor" type="submit"><i class="material-icons">delete</i></button> </form> {% endif %} </div> - <div class="flow-text col s8 m10 {% if joke.reports>0 %}grey-text{% endif %}" style="line-height: 1.5"> - {{ joke.text|safe }} - </div> </li> {% endfor %} </ul> @@ -119,6 +133,11 @@ $(document).ready(function() { $('#main').smoothState({prefetch: true}); }); + function openEditor(me) { + var joke = $(me).closest('.joke'); + $('.editor', joke).removeClass('hide'); + $('.noteditor', joke).addClass('hide'); + } </script> </body> </html> |
