diff options
author | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-09-29 01:58:04 +0200 |
---|---|---|
committer | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-09-29 01:58:04 +0200 |
commit | 3f7c6fdee0b1f906d0d89bfa5573b94977905a24 (patch) | |
tree | a113a99fc4d0c81e8b00293c0015b5f87d1baefa /templates/settings.html | |
parent | 6bb79f5a4a93c18024bdd7448c93f0babc1bc574 (diff) | |
download | web-3f7c6fdee0b1f906d0d89bfa5573b94977905a24.tar.gz web-3f7c6fdee0b1f906d0d89bfa5573b94977905a24.tar.bz2 web-3f7c6fdee0b1f906d0d89bfa5573b94977905a24.zip |
added some javascript code to handle visiblity of service forms
Diffstat (limited to 'templates/settings.html')
-rw-r--r-- | templates/settings.html | 77 |
1 files changed, 60 insertions, 17 deletions
diff --git a/templates/settings.html b/templates/settings.html index 8bf3d7e..241ea00 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -1,5 +1,5 @@ {%- extends 'base.html' %} -{%- from '_macros.html' import render_field, render_csrf %} +{%- from '_macros.html' import render_field, render_csrf, render_submit %} {%- set title = 'Einstellungen' %} {%- block content %} <form action="{{ url_for('settings') }}" method="post" class="form-horizontal"> @@ -8,25 +8,68 @@ {{ render_field(form.password) }} {{ render_field(form.password_confirm) }} {{ render_csrf(form) }} - <div class="form-actions"><input type="submit" value="Speichern" name="submit_main" /></div> + {{ render_submit(value='Speichern',name='submit_main') }} <h2>Dienste verwalten</h2> + <p> + Du kannst für jeden Dienst ein eigenes Passwort setzen: + </p> + {%- for service in services %} - <h3> - {{ service.name }} - <small> - {%- if service.changed %} - <span class="active">aktiv</span> - <a href="{{ url_for('settings',delete_service_password=service.name)}}">löschen</a> - {%- else %} - <span class="inactive">inaktiv</span> - {%- endif %} - </small> - </h3> - <p>Neues Passwort setzen:</p> - {{ render_field(form.get_servicepassword(service.id)) }} - {{ render_field(form.get_servicepasswordconfirm(service.id)) }} - <input type="submit" value="Speichern" name="submit_main" /> + <div class="service"> + <h3> + {{ service.name }} + </h3> + + <ul> + {%- if service.changed %} + <li class="active">aktiv</li> + <li> + <a href="{{ url_for('settings',delete_service_password=service.name)}}">löschen</a> + </li> + {%- else %} + <li class="inactive">inaktiv</li> + {%- endif %} + </ul> + + <div class="form-service"> + <p>Neues Passwort setzen:</p> + {{ render_field(form.get_servicepassword(service.id)) }} + {{ render_field(form.get_servicepasswordconfirm(service.id)) }} + {{ render_submit(value='Speichern',name='submit_main') }} + </div> + </div> {%- endfor %} </form> {%- endblock %} + + +{% block javascript %} + $(document).ready(function() { + + $('.service').each(function() { + var header = $(this).find('h3'); + var list = $(this).find('ul'); + var content = $(this).find('.form-service'); + var elem = $('<a class="service-edit" href="">bearbeiten</a>') + + elem.click(function() { + content.toggle(); + + return false; + }); + + console.log(list.find('a')) + if(list.find('a').length > 0) { + list.find('a').parent().prepend(elem); + } else { + var li = $('<li></li>'); + li.append(elem); + list.append(li); + } + + content.hide(); + }); + + }); +{% endblock %} |