(refs #12) Modified to use the helper of the attachment.

This commit is contained in:
shimamoto
2014-04-29 04:21:48 +09:00
parent bdd0af21a9
commit 93bf0a9a47
3 changed files with 13 additions and 23 deletions

View File

@@ -6,19 +6,18 @@
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">Write</a></li>
<li><a href="#tab2" data-toggle="tab" id="preview">Preview</a></li>
@*
<li class="pull-right">
<a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">Markdown Syntax Guide</a>
</li>
*@
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<span id="error-content" class="error"></span>
<div id="clickable">
@textarea = {
<textarea id="content" name="content"@if(style.nonEmpty){ style="@style"} placeholder="@placeholder">@content</textarea>
<span class="muted">Attach images by dragging &amp; dropping, or selecting them.</span>
</div>
}
@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">
@@ -45,18 +44,5 @@ $(function(){
prettyPrint();
});
});
@if(!enableWikiLink){
$("div#clickable").dropzone({
url: '@path/upload/image/@repository.owner/@repository.name',
maxFilesize: 10,
previewTemplate: "<div class=\"dz-preview\">\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress>Uploading your images...</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
success: function(file, id) {
var images = '\n![' + file.name.split('.')[0] + '](@url(repository)/_attached/' + id + ')';
$('#content').val($('#content').val() + images);
file.previewElement.remove();
}
});
}
});
</script>

View File

@@ -1,7 +1,9 @@
@(content: String, commentId: Int, owner: String, repository: String)(implicit context: app.Context)
@import context._
<span id="error-edit-content-@commentId" class="error"></span>
@helper.html.attached(owner, repository){
<textarea style="width: 680px; height: 100px;" id="edit-content-@commentId">@content</textarea>
}
<div>
<input type="button" id="update-comment-@commentId" class="btn btn-small" value="Update Comment"/>
<input type="button" id="cancel-comment-@commentId" class="btn btn-small btn-danger pull-right" value="Cancel"/>

View File

@@ -2,7 +2,9 @@
@import context._
<span id="error-edit-title" class="error"></span>
<input type="text" style="width: 680px;" id="edit-title" value="@title"/>
@helper.html.attached(owner, repository){
<textarea style="width: 680px; height: 100px; max-height: 300px;" id="edit-content">@content.getOrElse("")</textarea>
}
<div>
<input type="button" id="update" class="btn btn-small" value="Update Issue"/>
<input type="button" id="cancel" class="btn btn-small btn-danger pull-right" value="Cancel"/>