下载文档 · JavaCodeMood/BookStack@a640266 · GitHub
Skip to content

Commit a640266

Browse files
committed
下载文档
1 parent 1817df1 commit a640266

3 files changed

Lines changed: 21 additions & 12 deletions

File tree

controllers/BookController.go

Lines changed: 5 additions & 5 deletions

views/book/index.html

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,16 @@
133133
</ul>
134134
</div>
135135
<!-- Split button -->
136-
<div class="btn-group">
136+
<div class="btn-group btn-group-download">
137137
<button type="button" class="btn btn-default"><i class="fa fa-cloud-download"></i> 导出项目</button>
138138
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
139139
<span class="caret"></span>
140140
<span class="sr-only">Toggle Dropdown</span>
141141
</button>
142142
<ul class="dropdown-menu">
143-
<li><a href="#">导出 PDF</a></li>
144-
<li><a href="#">导出 MOBI</a></li>
145-
<li><a href="#">导出 EPUB</a></li>
146-
{{/*<li><a href="#">导出 MD</a></li>*/}}
143+
<li><a :href="'{{urlfor "DocumentController.Export" ":key" ""}}' + item.identify+'?output=pdf'">导出 PDF</a></li>
144+
<li><a :href="'{{urlfor "DocumentController.Export" ":key" ""}}' + item.identify+'?output=mobi'">导出 MOBI</a></li>
145+
<li><a :href="'{{urlfor "DocumentController.Export" ":key" ""}}' + item.identify+'?output=epub'">导出 EPUB</a></li>
147146
</ul>
148147
</div>
149148
</div>
@@ -306,7 +305,17 @@ <h4 class="modal-title" id="myModalLabel">添加项目</h4>
306305
}
307306
});
308307

309-
308+
$(".btn-group-download a").click(function (e) {
309+
e.preventDefault();
310+
var href=$(this).attr("href");
311+
$.get(href,function (res) {
312+
if(res.errcode==1){
313+
alertTips("error",res.message,3000);
314+
}else{
315+
location.href=res.data.url;
316+
}
317+
});
318+
});
310319

311320
});
312321
</script>

views/widgets/pull.html

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)