]> git.datanom.net - pwp.git/blame - app/templates/user.html
Half way through migration away from sqlalchemy
[pwp.git] / app / templates / user.html
CommitLineData
e5424f29
MR
1{% extends "base.html" %}
2
3{% block title %}
4{{ title }}
5{% endblock %}
6
7{% block scripts %}
8{{ super() }}
9<script>
10var deleteUrl;
11var label;
12
13$(document).on('click', '.open-DeleteDialog', function () {
14 deleteUrl = $(this).data('id').split('#');
15 if (deleteUrl[0] == 'portfolio') {
16 label = '<label class="alert-danger">Deleting a portfolio will remove all albums in portfolio<br/>and photos in the album as well. It cannot be undone!!</label>';
17 } else if (deleteUrl[0] == 'album') {
18 label = '<label class="alert-danger">Deleting an album will remove all photos in the album as well.<br/>It cannot be undone!!</label>';
19 } else {
20 label = '';
21 }
22 $('#deleteLabel').html('<span style="font-size:1.5em" class="glyphicon glyphicon-warning-sign"></span> delete ' + deleteUrl[0])
23 $('#delFormLabel').html(label)
24 deleteUrl = '/' + deleteUrl.join('/')
25});
26$(document).on('click', '#submitDelete', function () {
27 $.ajax({
28 url: deleteUrl,
29 data: $('#delForm').serialize(),
30 type: 'DELETE',
31 success: function(data){
32 var response = '<p><label>Response: ' + data + '</label></p><button class="btn btn-primary" id="deleteResponse" type="button">Ok </button>';
33 $("#delForm").replaceWith(response)
34 },
35 error: function(error) {
36 console.log(error);
37 }
38 });
39 return false;
40});
41$(document).on('click', '#deleteResponse', function () {
42 $('#deleteDialog').modal('toggle')
43 location.reload();
44});
45</script>
46{% endblock %}
47
48{% block content %}
49 {% include 'menu.html' %}
50 {% include 'flash.html' %}
51 <div class="modal fade" id="deleteDialog" tabindex="-1" role="dialog" aria-labelledby="deleteLabel" aria-hidden="true">
52 <div class="modal-dialog">
53 <div class="modal-content">
54 <div class="modal-header">
55 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
56 <h4 class="modal-title" id="deleteLabel"/>
57 </div>
58 <div class="modal-body">
59 <div class="container">
60 <form id="delForm" method="DELETE" action="#">
61 {{ deleteform.hidden_tag() }}
62 <span id="delFormLabel"></span><br/>
63 <button class="btn btn-primary" id="submitDelete" type="button">Delete </button>
64 </form>
65 </div>
66 </div>
67 </div>
68 </div>
69 </div>
70 <div class="container">
71 <div class="row well well-sm">
72 <h4 class="form-signin-heading center">User Information</h4>
73 <div class="col-xs-4 col-sm-6 col-md-6">
74 <form class="form-signin" method="POST" action="/user/{{user.username}}">
75 <!--<h3 class="form-signin-heading center">User Information</h3>-->
76 {{ form.hidden_tag() }}
77 {{ wtf.form_field(form.name, value=user.name) }}
78 {{ wtf.form_field(form.email, value=user.email) }}
79 {{ wtf.form_field(form.username, value=user.username) }}
80 {{ wtf.form_field(form.update, class="btn btn-lg btn-primary btn-block") }}
81 </form>
82 </div>
83 <div class="col-xs-4 col-sm-6 col-md-6">
84 <form class="form-signin" method="POST" action="/user/{{user.username}}">
85 {{ pwform.hidden_tag() }}
86 {{ wtf.form_field(pwform.passwordcur, placeholder="Current password") }}
87 {{ wtf.form_field(pwform.password, placeholder="New Password") }}
88 {{ wtf.form_field(pwform.passwordchk, placeholder="Password check") }}
89 {{ wtf.form_field(pwform.pwchange, class="btn btn-lg btn-primary btn-block") }}
90 </form>
91 </div>
92 </div>
93 <div class="row well well-sm">
94 <h4 class="form-signin-heading center">Your Portfolios and Albums</h4>
95 <table class="table table-hover table-responsive">
96 <thead class="thead-inverse">
97 <tr>
98 <th>Type</th>
99 <th>Name</th>
100 <th>Visible</th>
101 <th>Public</th>
102 <th>User count</th>
103 <th></th>
104 </tr>
105 </thead>
106 <tbody>
107 {% for p in private %}
108 <tr>
109 <td>Portfolio</td>
110 <td>{{p['portfolio']['name']}}</td>
111 <td>{{p['portfolio']['visible']}}</td>
112 <td>{{p['portfolio']['public']}}</td>
fc01a3eb 113 <td>{{p['portfolio']['usercount']}}</td>
e5424f29
MR
114 <td>
115 <div class="btn-group">
116 <a role="button" class="btn btn-info btn-xs" href="{{ url_for('portfolio', id=p['portfolio']['id']) }}">
117 Edit <span class="glyphicon glyphicon-edit"></span>
118 </a>
119 <a role="button" data-id="portfolio#{{p['portfolio']['id']}}" class="btn btn-danger btn-xs open-DeleteDialog" data-toggle="modal" data-target="#deleteDialog" href="#">
120 Delete <span class="glyphicon glyphicon-remove"></span>
121 </a>
122 </div>
123 </td>
124 </tr>
125 {% for a in p['albums'] %}
126 <tr>
127 <td>Album</td>
128 <td>{{p['portfolio']['name']}} <span class="glyphicon glyphicon-arrow-right"></span> {{a.name}}</td>
129 <td>{{a.visible}}</td>
130 <td>{{a.public}}</td>
fc01a3eb 131 <td>{{a.usercount}}</td>
e5424f29
MR
132 <td>
133 <div class="btn-group">
134 <a role="button" class="btn btn-info btn-xs" href="{{ url_for('album', id=a.id) }}">
135 Edit <span class="glyphicon glyphicon-edit"></span>
136 </a>
137 <a role="button" data-id="album#{{a.id}}" class="btn btn-danger btn-xs open-DeleteDialog" data-toggle="modal" data-target="#deleteDialog" href="#">
138 Delete <span class="glyphicon glyphicon-remove"></span>
139 </a
140 </div>
141 </td>
142 </tr>
143 {% endfor %}
144 {% endfor %}
145 </tbody>
146 </table>
147 </div>
148 <div class="row well well-sm">
149 <h4 class="form-signin-heading center">Albums by other users</h4>
150 <table class="table table-hover table-responsive">
151 <thead class="thead-inverse">
152 <tr>
153 <th>Name</th>
154 <th>Portfolio</th>
155 <th>Owner</th>
156 <th>Permission</th>
157 </tr>
158 </thead>
159 <tbody>
160 {% for a in albums %}
161 <tr>
162 <td>{{a['album'].name}}</td><td>{{a['album'].portfolio.name}}</td>
163 <td>{{a['album'].portfolio.owner.name}}</td><td>{{a['acl'].name}}</td>
164 </tr>
165 {% endfor %}
166 </tbody>
167 </table>
168 </div>
169 </div> <!-- /container -->
170{% endblock %}
This page took 0.052567 seconds and 5 git commands to generate.