添加新接口

This commit is contained in:
tangshuangpku@hotmail.com 2016-06-07 19:13:01 +08:00
parent 3aee39b634
commit 1c81544d44
2 changed files with 71 additions and 8 deletions

View File

@ -68,8 +68,8 @@
<td>{{ notify['status'] }}</td>
<td>
<a class="btn btn-xs btn-success" data-toggle="modal" data-target="#detailModal_{{ notify['id'] }}"><i class="fa fa-plus"></i> details</a>&nbsp;
<a class="btn btn-xs btn-info"><i class="fa fa-pencil"></i> edit</a>&nbsp;
<a class="btn btn-xs btn-danger"><i class="fa fa-times"></i> delete</a>
<a class="btn btn-xs btn-info" data-toggle="modal" data-target="#editModal_{{ notify['id'] }}"><i class="fa fa-pencil"></i> edit</a>&nbsp;
<a class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal_{{ notify['id'] }}"><i class="fa fa-times"></i> delete</a>
</td>
<!-- Modal Dialog -->
<div class="modal inmodal" id="detailModal_{{ notify['id'] }}" role="dialog" aria-hidden="true">
@ -85,12 +85,10 @@
<small class="font-bold">Show the details of the notification</small>
</div>
<div class="modal-body">
<h4>Title</h4>
<ul class="nav nav-list"> <li class="divider"></li> </ul>
<h4><i class="fa fa-star"></i> Title</h4>
<p>{{ notify['title'] }}</p>
<br>
<h4>Content</h4>
<ul class="nav nav-list"> <li class="divider"></li> </ul>
<h4><i class="fa fa-star"></i> Content</h4>
<p>{{ notify['content'] }}</p>
</div>
<div class="modal-footer">
@ -99,6 +97,71 @@
</div>
</div>
</div>
<div class="modal inmodal" id="editModal_{{ notify['id'] }}" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<i class="fa fa-envelope modal-icon"></i>
<h4 class="modal-title">Edit Notification</h4>
<small class="font-bold">Edit the details of the notification</small>
</div>
<div class="modal-body">
<form id="notificationForm" action="/notification/modify/" method="post">
<div class="form-group">
<label class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title" id="title">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Content</label>
<div class="col-sm-10">
<textarea class="form-control" name="content" id="title"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Groups</label>
<div class="checkbox col-sm-10">
<label style="display: none"><input type="checkbox" checked name="groups" value="none" style="display: none"></label>
<label><input type="checkbox" name="groups" value="all">all&nbsp;&nbsp;</label>
{% for group_name in groups %}
<label><input type="checkbox" name="groups" value="{{ group_name }}">{{ group_name }}&nbsp;&nbsp;</label>
{% endfor %}
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal inmodal" id="deleteModal_{{ notify['id'] }}" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Delete Notification </h4>
<small class="font-bold">Delete this notification</small>
</div>
<div class="modal-body">
<strong class="text-center">Are you sure to do this?</strong>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Delete</button>
<button type="button" class="btn btn-white" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</tr>
{% endfor %}
</tbody>

View File

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