This commit is contained in:
life
2014-05-07 13:06:24 +08:00
parent fac05a7b6c
commit 476ade10e7
1085 changed files with 259628 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<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">&times;</button>
<h4 class="modal-title" id="modalTitle">分享 <b>{{.title}}</b></h4>
</div>
{{$noteOrNotebookId := .noteOrNotebookId}}
<div class="modal-body">
<button class="btn btn-default" id="addShareNotebookBtn">添加分享</button>
<div id="shareMsg" class="alert alert-danger" style="display: none; margin: 5px 0 0 0;"></div>
<table class="table table-hover" id="shareNotebookTable">
<thead>
<tr>
<th>#</th>
<th>好友邮箱</th>
<th>权限</th>
<th>删除分享</th>
</tr>
</thead>
<tbody>
<tr id="tr1">
<td>#</td>
<td>
<input id="friendsEmail" type="text" class="form-control" style="width: 200px" placeholder="好友邮箱">
</td>
<td>
<label for="readPerm1"><input type="radio" name="perm1" checked="checked" value="0" id="readPerm1"> 只读</label>
<label for="writePerm1"><input type="radio" name="perm1" value="1" id="writePerm1"> 可编辑</label>
</td>
<td>
<button class="btn btn-success" onclick="addShareNoteOrNotebook(1)">分享</button>
<button class="btn btn-warning" onclick="deleteShareNoteOrNotebook(1)">删除</button>
</td>
</tr>
{{range $i, $v := .noteOrNotebookShareUserInfos}}
{{$toUserId := $v.ToUserId.Hex}}
<tr>
<td>{{add $i}}</td>
<td>{{$v.Email}}</td>
<td>
{{if eq $v.Perm 0}}
<a href="#" noteOrNotebookId="{{$noteOrNotebookId}}" perm="{{$v.Perm}}" toUserId="{{$toUserId}}" title="点击改变权限" class="btn btn-default change-perm">只读</a>
{{else}}
<a href="#" noteOrNotebookId="{{$noteOrNotebookId}}" perm="{{$v.Perm}}" toUserId="{{$toUserId}}" title="点击改变权限" class="btn btn-default change-perm">可编辑</a>
{{end}}
</td>
<td>
<a href="#" noteOrNotebookId="{{$noteOrNotebookId}}" toUserId="{{$toUserId}}" class="btn btn-warning delete-share">删除</a>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script>
Share.dialogIsNote = {{.isNote}};
Share.dialogNoteOrNotebookId = '{{.noteOrNotebookId}}';
$(function() {
setTimeout(function() {
$("#tr1 #friendsEmail").focus();
}, 500);
});
</script>

View File

@@ -0,0 +1,84 @@
<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">&times;</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>