添加新接口

This commit is contained in:
tangshuangpku@hotmail.com 2016-06-07 00:01:02 +08:00
parent 1bf6534c6d
commit e5f2202104
3 changed files with 34 additions and 1 deletions

View File

@ -45,6 +45,8 @@ class NotificationMgr:
'id': notify.id,
'title': notify.title,
'content': notify.content,
'create_date': notify.create_date,
'status': notify.status,
'groups': [group.group_name for group in groups]
})
return {'success': 'true', 'data': notify_infos}

View File

@ -34,9 +34,40 @@
<div class="box-body">
<p>test rendering...</p>
{% for title in notification_titles %}
<p>{{ title }}</p>
{% endfor %}
<div class="table table-responsive">
<table id="notificationTable" class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Content</th>
<th>Groups</th>
<th>Create Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for notify in notifications %}
<tr>
<td>{{ notify['id'] }}</td>
<td>{{ notify['title'] }}</td>
<td>{{ notify['content'] }}</td>
<td>
{% for group_name in notify['groups'] %}{{ group_name }}&nbsp;{% endfor %}
</td>
<td>{{ notify['create_date'] }}</td>
<td>{{ notify['status'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -11,7 +11,7 @@ class NotificationView(normalView):
result = dockletRequest.post('/notification/list/')
notifications = result['data']
notification_titles = [notify['title'] for notify in notifications]
return cls.render(cls.template_path, notification_titles=notification_titles)
return cls.render(cls.template_path, notifications=notifications, notification_titles=notification_titles)
class CreateNotificationView(normalView):