mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-14 01:15:50 +01:00
50 lines
1.8 KiB
HTML
50 lines
1.8 KiB
HTML
@(repository: service.RepositoryService.RepositoryInfo, content: String, enableWikiLink: Boolean, enableRefsLink: Boolean, enableTaskList: Boolean, hasWritePermission: Boolean,
|
|
style: String = "", placeholder: String = "Leave a comment", elastic: Boolean = false)(implicit context: app.Context)
|
|
@import context._
|
|
@import view.helpers._
|
|
<div class="tabbable">
|
|
<ul class="nav nav-tabs" style="height: 37px;">
|
|
<li class="active"><a href="#tab1" data-toggle="tab">Write</a></li>
|
|
<li><a href="#tab2" data-toggle="tab" id="preview">Preview</a></li>
|
|
</ul>
|
|
<div class="tab-content">
|
|
<div class="tab-pane active" id="tab1">
|
|
<span id="error-content" class="error"></span>
|
|
@textarea = {
|
|
<textarea id="content" name="content"@if(style.nonEmpty){ style="@style"} placeholder="@placeholder">@content</textarea>
|
|
}
|
|
@if(enableWikiLink){
|
|
@textarea
|
|
} else {
|
|
@helper.html.attached(repository.owner, repository.name)(textarea)
|
|
}
|
|
</div>
|
|
<div class="tab-pane" id="tab2">
|
|
<div class="markdown-body" id="preview-area">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<link href="@assets/vendors/google-code-prettify/prettify.css" type="text/css" rel="stylesheet"/>
|
|
<script src="@assets/vendors/google-code-prettify/prettify.js"></script>
|
|
<script>
|
|
$(function(){
|
|
@if(elastic){
|
|
$('#content').elastic();
|
|
}
|
|
|
|
$('#preview').click(function(){
|
|
$(this).closest('#preview-area').html('<img src="@assets/common/images/indicator.gif"> Previewing...');
|
|
$.post('@url(repository)/_preview', {
|
|
content : $('#content').val(),
|
|
enableWikiLink : @enableWikiLink,
|
|
enableRefsLink : @enableRefsLink,
|
|
enableTaskList : @enableTaskList
|
|
}, function(data){
|
|
$('#preview-area').html(data);
|
|
prettyPrint();
|
|
});
|
|
});
|
|
});
|
|
</script>
|