84 lines
2.6 KiB
HTML
84 lines
2.6 KiB
HTML
![]() |
<div class="modal-dialog modal-sm">
|
||
|
<div class="modal-content">
|
||
|
|
||
|
<div class="modal-header">
|
||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
|
<h4 class="modal-title" id="modalTitle">{{.note.Title}} 的分享状态</h4>
|
||
|
</div>
|
||
|
{{$noteId := .note.NoteId.Hex}}
|
||
|
|
||
|
<div class="modal-body">
|
||
|
{{if .noteShareUserInfos }}
|
||
|
<table class="table table-hover">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>#</th>
|
||
|
<th>Email</th>
|
||
|
<th>权限</th>
|
||
|
<th>删除分享</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
{{range $i, $v := .noteShareUserInfos}}
|
||
|
{{$toUserId := $v.ToUserId.Hex}}
|
||
|
<tr>
|
||
|
<td>{{add $i}}</td>
|
||
|
<td>{{$v.Email}}</td>
|
||
|
<td>
|
||
|
{{if eq $v.Perm 0}}
|
||
|
<a href="#" noteId="{{$noteId}}" perm="{{$v.Perm}}" toUserId="{{$toUserId}}" title="点击改变权限" class="btn btn-default change-perm">只读</a>
|
||
|
{{else}}
|
||
|
<a href="#" noteId="{{$noteId}}" perm="{{$v.Perm}}" toUserId="{{$toUserId}}" title="点击改变权限" class="btn btn-default change-perm">可编辑</a>
|
||
|
{{end}}
|
||
|
</td>
|
||
|
<td>
|
||
|
<a href="#" noteId="{{$noteId}}" toUserId="{{$toUserId}}" class="btn btn-warning delete-share">删除</a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
{{end}}
|
||
|
</tbody>
|
||
|
</table>
|
||
|
{{else}}
|
||
|
无分享信息
|
||
|
{{end}}
|
||
|
</div>
|
||
|
|
||
|
<div class="modal-footer">
|
||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||
|
</div>
|
||
|
|
||
|
</div><!-- /.modal-content -->
|
||
|
</div><!-- /.modal-dialog -->
|
||
|
<script>
|
||
|
$(function() {
|
||
|
$(".change-perm").click(function() {
|
||
|
var self = this;
|
||
|
var perm = $(this).attr("perm");
|
||
|
var noteId = $(this).attr("noteId");
|
||
|
var toUserId = $(this).attr("toUserId");
|
||
|
var toHtml = "可编辑";
|
||
|
var toPerm = "1";
|
||
|
if(perm == "1") {
|
||
|
toHtml = "只读";
|
||
|
toPerm = "0";
|
||
|
}
|
||
|
ajaxGet("/share/UpdateShareNotePerm", {noteId: noteId, perm: toPerm, toUserId: toUserId}, function(ret) {
|
||
|
if(ret) {
|
||
|
$(self).html(toHtml);
|
||
|
$(self).attr("perm", toPerm);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$(".delete-share").click(function() {
|
||
|
var self = this;
|
||
|
var noteId = $(this).attr("noteId");
|
||
|
var toUserId = $(this).attr("toUserId");
|
||
|
ajaxGet("/share/DeleteShareNote", {noteId: noteId, toUserId: toUserId}, function(ret) {
|
||
|
if(ret) {
|
||
|
$(self).parent().parent().remove();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
</script>
|