
Unify markdown editor form
@a4f434045c8324c8eeeeaf1ecccfbca1a594d0f7
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
... | ... | @@ -2895,8 +2895,8 @@ |
2895 | 2895 |
overflow-x:auto; |
2896 | 2896 |
margin:0px; |
2897 | 2897 |
vertical-align : middle; |
2898 |
- border:3px solid #ddd; |
|
2899 |
- padding:10px; |
|
2898 |
+ border:2px solid #ccc; |
|
2899 |
+ padding:4px 6px; |
|
2900 | 2900 |
.border-radius(0 0 3px 3px); |
2901 | 2901 |
|
2902 | 2902 |
} |
... | ... | @@ -3776,7 +3776,6 @@ |
3776 | 3776 |
.write-comment-box { |
3777 | 3777 |
font-family:@base-font-family; |
3778 | 3778 |
padding:5px; |
3779 |
- background-color: #f5f5f5; |
|
3780 | 3779 |
} |
3781 | 3780 |
|
3782 | 3781 |
/** view **/ |
... | ... | @@ -5034,7 +5033,6 @@ |
5034 | 5033 |
form { margin:0;} |
5035 | 5034 |
|
5036 | 5035 |
.write-comment-box { |
5037 |
- background-color: #f5f5f5; |
|
5038 | 5036 |
padding:15px 0 15px 50px; |
5039 | 5037 |
margin:0; |
5040 | 5038 |
|
... | ... | @@ -5180,7 +5178,7 @@ |
5180 | 5178 |
|
5181 | 5179 |
.review-form { |
5182 | 5180 |
position:absolute; display: none; |
5183 |
- z-index:99; top:0px; left:0px; right:0px; |
|
5181 |
+ z-index:1000; top:0px; left:0px; right:0px; |
|
5184 | 5182 |
padding: 15px 15px 10px; |
5185 | 5183 |
background: #fff; |
5186 | 5184 |
border:1px solid #ccc; |
--- app/assets/stylesheets/less/_yobiUI.less
+++ app/assets/stylesheets/less/_yobiUI.less
... | ... | @@ -461,6 +461,11 @@ |
461 | 461 |
font-weight:bold; |
462 | 462 |
} |
463 | 463 |
} |
464 |
+ |
|
465 |
+ &.small { |
|
466 |
+ height:29px; |
|
467 |
+ li a { padding:4px 15px; } |
|
468 |
+ } |
|
464 | 469 |
} |
465 | 470 |
|
466 | 471 |
/** alert **/ |
... | ... | @@ -547,7 +552,7 @@ |
547 | 552 |
|
548 | 553 |
.yobiSpinner { |
549 | 554 |
display: none; |
550 |
- position: fixed; z-index: 999; |
|
555 |
+ position: fixed; z-index: 99999; |
|
551 | 556 |
top: 0; bottom: 0; left: 0; right: 0; |
552 | 557 |
|
553 | 558 |
.spinContainer { |
--- app/utils/TemplateHelper.scala
+++ app/utils/TemplateHelper.scala
... | ... | @@ -44,6 +44,14 @@ |
44 | 44 |
baseUrl + prefix + query.dropRight(1) |
45 | 45 |
} |
46 | 46 |
|
47 |
+ def buildAttrString(attrMap: java.util.Map[String, String]): String = { |
|
48 |
+ var attr = "" |
|
49 |
+ attrMap.map { |
|
50 |
+ v => attr += v._1 + "=" + v._2 + " " |
|
51 |
+ } |
|
52 |
+ attr.dropRight(1) |
|
53 |
+ } |
|
54 |
+ |
|
47 | 55 |
def agoString(duration: org.joda.time.Duration) = { |
48 | 56 |
if (duration != null){ |
49 | 57 |
val sec = duration.getMillis / DateTimeConstants.MILLIS_PER_SECOND |
--- app/views/board/create.scala.html
+++ app/views/board/create.scala.html
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
@(title:String, form:Form[Posting], project:Project, isAllowedToNotice:Boolean) |
2 | 2 |
|
3 |
+@import scala.collection.Map |
|
3 | 4 |
@import utils.TemplateHelper._ |
4 | 5 |
@import models.enumeration._ |
5 | 6 |
@implicitField = @{ helper.FieldConstructor(simpleForm) } |
... | ... | @@ -28,18 +29,7 @@ |
28 | 29 |
</dd> |
29 | 30 |
|
30 | 31 |
<dd style="position: relative;"> |
31 |
- <div id="mode-select"> |
|
32 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
33 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
34 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
35 |
- <label for="preview-mode">Preview</label> |
|
36 |
- </div> |
|
37 |
- <a href="#" class="go-zen"><i class="s s--zen" >Edit in Zen Mode</i></a> |
|
38 |
- @help.markdown() |
|
39 |
- <div class="textarea-box"> |
|
40 |
- <textarea id="body" name="body" class="zen-mode content" markdown="true" tabindex="2" data-label="@Messages("post.error.emptyBody")"></textarea> |
|
41 |
- </div> |
|
42 |
- |
|
32 |
+ @common.editor("body", "", Map("tabindex"->"2")) |
|
43 | 33 |
</dd> |
44 | 34 |
|
45 | 35 |
@if(isAllowedToNotice){ |
--- app/views/board/edit.scala.html
+++ app/views/board/edit.scala.html
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
@(title:String, form:Form[Posting], posting:Posting, number:Long, project:Project, isAllowedToNotice:Boolean) |
2 | 2 |
|
3 |
+@import scala.collection.Map |
|
3 | 4 |
@import utils.TemplateHelper._ |
4 | 5 |
@import models.enumeration.ResourceType |
5 | 6 |
@implicitField = @{ helper.FieldConstructor(simpleForm) } |
... | ... | @@ -28,17 +29,7 @@ |
28 | 29 |
</dd> |
29 | 30 |
|
30 | 31 |
<dd style="position: relative;"> |
31 |
- <div id="mode-select"> |
|
32 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
33 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
34 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
35 |
- <label for="preview-mode">Preview</label> |
|
36 |
- </div> |
|
37 |
- <a href="#" class="go-zen" ><i class="s s--zen">Edit in Zen Mode</i></a> |
|
38 |
- @help.markdown() |
|
39 |
- <div class="textarea-box"> |
|
40 |
- <textarea id="body" name="body" class="zen-mode content" markdown="true" tabindex="2" data-label="@Messages("post.error.emptyBody")">@posting.body</textarea> |
|
41 |
- </div> |
|
32 |
+ @common.editor("body", posting.body, Map("tabindex"->"2")) |
|
42 | 33 |
</dd> |
43 | 34 |
|
44 | 35 |
@if(isAllowedToNotice){ |
+++ app/views/board/partial_comments.scala.html
... | ... | @@ -0,0 +1,71 @@ |
1 | +@** | |
2 | +/** | |
3 | +* Yobi, Project Hosting SW | |
4 | +* | |
5 | +* Copyright 2013 NAVER Corp. | |
6 | +* http://yobi.io | |
7 | +* | |
8 | +* Licensed under the Apache License, Version 2.0 (the "License"); | |
9 | +* you may not use this file except in compliance with the License. | |
10 | +* You may obtain a copy of the License at | |
11 | +* | |
12 | +* http://www.apache.org/licenses/LICENSE-2.0 | |
13 | +* | |
14 | +* Unless required by applicable law or agreed to in writing, software | |
15 | +* distributed under the License is distributed on an "AS IS" BASIS, | |
16 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
17 | +* See the License for the specific language governing permissions and | |
18 | +* limitations under the License. | |
19 | +*/ | |
20 | +**@ | |
21 | + | |
22 | +@(project:Project, post:Posting) | |
23 | + | |
24 | +@import utils.TemplateHelper._ | |
25 | +@import utils.AccessControl._ | |
26 | +@import utils.JodaDateUtil | |
27 | + | |
28 | +@isAuthorComment(commentId: String) = @{ | |
29 | + if(commentId == UserApp.currentUser().loginId) {"author"} | |
30 | +} | |
31 | + | |
32 | + | |
33 | +<div class="comment-header"><i class="yobicon-comments"></i> <strong>@Messages("common.comment")</strong> <strong class="num">@post.comments.size</strong></div> | |
34 | +<hr class="nm" /> | |
35 | + | |
36 | +<ul class="comments"> | |
37 | +@for(comment <-post.comments){ | |
38 | + <li class="comment @isAuthorComment(comment.authorLoginId)" id="comment-@comment.id"> | |
39 | + <div class="comment-avatar"> | |
40 | + <a href="@routes.UserApp.userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> | |
41 | + <img src="@User.findByLoginId(comment.authorLoginId).avatarUrl" width="32" height="32" alt="@comment.authorLoginId"> | |
42 | + </a> | |
43 | + </div> | |
44 | + <div class="media-body"> | |
45 | + <div class="meta-info"> | |
46 | + <span class="comment_author pull-left"> | |
47 | + <a href="@routes.UserApp.userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> | |
48 | + <strong>@comment.authorLoginId </strong> | |
49 | + </a> | |
50 | + </span> | |
51 | + <a href="#comment-@comment.id" class="ago" title="@JodaDateUtil.getDateString(comment.createdDate)">@utils.TemplateHelper.agoString(comment.ago())</a> | |
52 | + <span class="act-row pull-right"> | |
53 | + @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.UPDATE)) { | |
54 | + <button type="button" class="btn-transparent mr10" data-toggle="comment-edit" data-comment-id="@comment.id" title="@Messages("common.comment.edit")"><i class="yobicon-edit-2"></i></button> | |
55 | + } | |
56 | + @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.DELETE)) { | |
57 | + <button type="button" class="btn-transparent" data-toggle="comment-delete" data-request-uri="@routes.BoardApp.deleteComment(project.owner, project.name, post.getNumber, comment.id)" title="@Messages("common.comment.delete")"><i class="yobicon-trash"></i></button> | |
58 | + } | |
59 | + </span> | |
60 | + </div> | |
61 | + | |
62 | + @common.commentUpdateForm(comment.id, routes.BoardApp.newComment(project.owner, project.name, post.getNumber).toString(), comment.contents) | |
63 | + | |
64 | + <div id="comment-body-@comment.id"> | |
65 | + <div class="comment-body markdown-wrap markdown-before" markdown="true">@comment.contents</div> | |
66 | + <div class="attachments pull-right" data-resourceType="@ResourceType.NONISSUE_COMMENT" data-resourceId="@comment.id"></div> | |
67 | + </div> | |
68 | + </div> | |
69 | + </li> | |
70 | +} | |
71 | +</ul> |
--- app/views/board/view.scala.html
+++ app/views/board/view.scala.html
... | ... | @@ -8,10 +8,6 @@ |
8 | 8 |
|
9 | 9 |
@urlToPostings = @{ urlToList(request.getHeader("Referer"), routes.BoardApp.posts(project.owner, project.name).toString()) } |
10 | 10 |
|
11 |
-@isAuthorComment(commentId: String) = @{ |
|
12 |
- if(commentId == UserApp.currentUser().loginId) {"author"} |
|
13 |
-} |
|
14 |
- |
|
15 | 11 |
@projectLayout(post.title, project, utils.MenuType.BOARD){ |
16 | 12 |
@projectMenu(project, utils.MenuType.BOARD, "main-menu-only") |
17 | 13 |
<div class="page-wrap-outer"> |
... | ... | @@ -68,43 +64,7 @@ |
68 | 64 |
|
69 | 65 |
@** Comment **@ |
70 | 66 |
<div id="comments" class="board-comment-wrap"> |
71 |
- <div class="comment-header"><i class="yobicon-comments"></i> <strong>@Messages("common.comment")</strong> <strong class="num">@post.comments.size</strong></div> |
|
72 |
- <hr class="nm" /> |
|
73 |
- |
|
74 |
- <ul class="comments"> |
|
75 |
- @for(comment <-post.comments){ |
|
76 |
- <li class="comment @isAuthorComment(comment.authorLoginId)" id="comment-@comment.id"> |
|
77 |
- <div class="comment-avatar"> |
|
78 |
- <a href="@routes.UserApp.userInfo(comment.authorLoginId)" class="avatar-wrap" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
|
79 |
- <img src="@User.findByLoginId(comment.authorLoginId).avatarUrl" width="32" height="32" alt="@comment.authorLoginId"> |
|
80 |
- </a> |
|
81 |
- </div> |
|
82 |
- @common.commentUpdateForm(project, ResourceType.NONISSUE_COMMENT, comment.id, routes.BoardApp.newComment(project.owner, project.name, post.getNumber).toString(), comment.contents) |
|
83 |
- <div class="media-body" id="comment-body-@comment.id"> |
|
84 |
- <div class="meta-info"> |
|
85 |
- <span class="comment_author pull-left"> |
|
86 |
- <a href="@routes.UserApp.userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
|
87 |
- <strong>@comment.authorLoginId </strong> |
|
88 |
- </a> |
|
89 |
- </span> |
|
90 |
- <a href="#comment-@comment.id" class="ago" title="@JodaDateUtil.getDateString(comment.createdDate)">@utils.TemplateHelper.agoString(comment.ago())</a> |
|
91 |
- <span class="act-row pull-right"> |
|
92 |
- @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.UPDATE)) { |
|
93 |
- <button type="button" class="btn-transparent mr10" data-toggle="comment-edit" data-comment-editform-id="comment-editform-@comment.id" title="@Messages("common.comment.edit")"><i class="yobicon-edit-2"></i></button> |
|
94 |
- } |
|
95 |
- @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.DELETE)) { |
|
96 |
- <button type="button" class="btn-transparent" data-toggle="comment-delete" data-request-uri="@routes.BoardApp.deleteComment(project.owner, project.name, post.getNumber, comment.id)" title="@Messages("common.comment.delete")"><i class="yobicon-trash"></i></button> |
|
97 |
- } |
|
98 |
- </span> |
|
99 |
- </div> |
|
100 |
- |
|
101 |
- <div class="comment-body markdown-wrap markdown-before" markdown="true">@comment.contents</div> |
|
102 |
- |
|
103 |
- <div class="attachments pull-right" data-resourceType="@ResourceType.NONISSUE_COMMENT" data-resourceId="@comment.id"></div> |
|
104 |
- </div> |
|
105 |
- </li> |
|
106 |
- } |
|
107 |
- </ul> |
|
67 |
+ @partial_comments(project, post) |
|
108 | 68 |
|
109 | 69 |
@common.commentForm(post.asResource(), ResourceType.NONISSUE_COMMENT, routes.BoardApp.newComment(project.owner, project.name, post.getNumber).toString()) |
110 | 70 |
</div> |
--- app/views/common/commentForm.scala.html
+++ app/views/common/commentForm.scala.html
... | ... | @@ -1,34 +1,22 @@ |
1 | 1 |
@(container: models.resource.Resource, resourceType:ResourceType, action:String) |
2 | 2 |
|
3 |
+@import scala.collection.Map |
|
3 | 4 |
@import models.enumeration.ResourceType |
4 | 5 |
@import utils.AccessControl._ |
5 | 6 |
|
6 | 7 |
@if(isResourceCreatable(User.findByLoginId(session.get("loginId")), container, resourceType)){ |
7 | 8 |
|
8 | 9 |
<form id="comment-form" action="@action" method="post" enctype="multipart/form-data"> |
9 |
- <div class="write-comment-box"> |
|
10 |
+ <div class="write-comment-box clearbg"> |
|
11 |
+ @common.editor("contents", "", Map("id"->"comment-editor")) |
|
12 |
+ |
|
13 |
+ @** fileUploader **@ |
|
14 |
+ @if(!UserApp.currentUser.isAnonymous){ |
|
15 |
+ @common.fileUploader(resourceType, null) |
|
16 |
+ } |
|
17 |
+ @** end of fileUploader **@ |
|
18 |
+ |
|
10 | 19 |
<div class="write-comment-wrap"> |
11 |
- <div id="mode-select" data-toggle="buttons"> |
|
12 |
- <ul class="nav nav-tabs"> |
|
13 |
- <li class="active"> |
|
14 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
15 |
- <a href="#" data-toggle="tab" onclick="$('#edit-mode').trigger('click')">Edit</a> |
|
16 |
- </li> |
|
17 |
- <li> |
|
18 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
19 |
- <a href="#" onclick="$('#preview-mode').trigger('click')" data-toggle="tab">Preview</a> |
|
20 |
- </li> |
|
21 |
- </ul> |
|
22 |
- </div> |
|
23 |
- @help.markdown() |
|
24 |
- <div class="textarea-box"> |
|
25 |
- <textarea id="comment-editor" name="contents" class="comment" markdown="true"></textarea> |
|
26 |
- </div> |
|
27 |
- @** fileUploader **@ |
|
28 |
- @if(!UserApp.currentUser.isAnonymous) { |
|
29 |
- @common.fileUploader(resourceType, null) |
|
30 |
- } |
|
31 |
- @** end of fileUploader **@ |
|
32 | 20 |
<div class="right-txt"> |
33 | 21 |
<button type="button" class="ybtn hidden" id="dynamic-comment-btn"></button> |
34 | 22 |
<button type="submit" class="ybtn ybtn-success">@Messages("button.comment.new")</button> |
--- app/views/common/commentUpdateForm.scala.html
+++ app/views/common/commentUpdateForm.scala.html
... | ... | @@ -1,32 +1,18 @@ |
1 |
-@(project:Project, resourceType:ResourceType, resourceId:Long, action:String, contents:String) |
|
1 |
+@(commentId:Long, action:String, contents:String) |
|
2 | 2 |
|
3 |
-@import models.enumeration.ResourceType |
|
4 |
- <div id="comment-editform-@resourceId" class="comment-update-form"> |
|
5 |
- <form id="comment-update-form" action="@action" method="post"> |
|
3 |
+<div id="comment-editform-@commentId" class="comment-update-form"> |
|
4 |
+ <form action="@action" method="post"> |
|
5 |
+ <input type="hidden" name="id" value="@commentId"> |
|
6 |
+ |
|
6 | 7 |
<div class="write-comment-box"> |
7 | 8 |
<div class="write-comment-wrap"> |
8 |
- <div id="mode-select" data-toggle="buttons"> |
|
9 |
- <ul class="nav nav-tabs"> |
|
10 |
- <li class="active"> |
|
11 |
- <input type="radio" name="edit-mode" id="edit-mode-@resourceId" value="edit" checked="checked" class="radio-btn"> |
|
12 |
- <a href="#" data-toggle="tab" onclick="$('#edit-mode-@resourceId').trigger('click')">Edit</a> |
|
13 |
- </li> |
|
14 |
- <li> |
|
15 |
- <input type="radio" name="edit-mode" id="preview-mode-@resourceId" value="preview" class="radio-btn"> |
|
16 |
- <a href="#" onclick="$('#preview-mode-@resourceId').trigger('click')" data-toggle="tab">Preview</a> |
|
17 |
- </li> |
|
18 |
- </ul> |
|
19 |
- </div> |
|
20 |
- @help.markdown() |
|
21 |
- <input type="hidden" name="id" value="@resourceId"> |
|
22 |
- <div class="textarea-box"> |
|
23 |
- <textarea id="comment-editor" name="contents" class="comment comment-editor" markdown="true">@contents</textarea> |
|
24 |
- </div> |
|
9 |
+ @common.editor("contents", contents) |
|
10 |
+ |
|
25 | 11 |
<div class="right-txt comment-update-button"> |
26 |
- <button type="button" class="ybtn ybtn-cancel" data-comment-body-id="comment-body-@resourceId">@Messages("button.cancel")</button> |
|
12 |
+ <button type="button" class="ybtn ybtn-cancel" data-comment-id="@commentId">@Messages("button.cancel")</button> |
|
27 | 13 |
<button type="submit" class="ybtn ybtn-info">@Messages("button.save")</button> |
28 | 14 |
</div> |
29 | 15 |
</div> |
30 | 16 |
</div> |
31 | 17 |
</form> |
32 |
- </div> |
|
18 |
+</div> |
+++ app/views/common/editor.scala.html
... | ... | @@ -0,0 +1,52 @@ |
1 | +@** | |
2 | +* Yobi, Project Hosting SW | |
3 | +* | |
4 | +* Copyright 2014 NAVER Corp. | |
5 | +* http://yobi.io | |
6 | +* | |
7 | +* @Author JiHan Kim | |
8 | +* | |
9 | +* Licensed under the Apache License, Version 2.0 (the "License"); | |
10 | +* you may not use this file except in compliance with the License. | |
11 | +* You may obtain a copy of the License at | |
12 | +* | |
13 | +* http://www.apache.org/licenses/LICENSE-2.0 | |
14 | +* | |
15 | +* Unless required by applicable law or agreed to in writing, software | |
16 | +* distributed under the License is distributed on an "AS IS" BASIS, | |
17 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
18 | +* See the License for the specific language governing permissions and | |
19 | +* limitations under the License. | |
20 | +**@ | |
21 | +@(editorName:String = "contents", textValue:String="", textareaAttr:Map[String,String]=null) | |
22 | + | |
23 | +@import org.apache.commons.lang3.RandomStringUtils._ | |
24 | +@import utils.TemplateHelper._ | |
25 | + | |
26 | +@defining(randomAlphabetic(8)){ wrapId => | |
27 | +<div data-toggle="markdown-editor"> | |
28 | + <ul class="nav nav-tabs nm small"> | |
29 | + <li class="active"> | |
30 | + <a href="#edit-@wrapId" data-toggle="tab" data-mode="edit">@Messages("common.editor.edit")</a> | |
31 | + </li> | |
32 | + <li> | |
33 | + <a href="#preview-@wrapId" data-toggle="tab" data-mode="preview">@Messages("common.editor.preview")</a> | |
34 | + </li> | |
35 | + </ul> | |
36 | + | |
37 | + <div class="tab-content" style="position:relative;"> | |
38 | + @help.markdown() | |
39 | + | |
40 | + <div id="edit-@wrapId" class="tab-pane active"> | |
41 | + <div class="textarea-box"> | |
42 | + <textarea name="@editorName" class="content comment nm" markdown="true" | |
43 | + @if(textareaAttr != null){ @buildAttrString(textareaAttr) }>@textValue</textarea> | |
44 | + </div> | |
45 | + </div> | |
46 | + | |
47 | + <div id="preview-@wrapId" class="tab-pane"> | |
48 | + <div class="markdown-preview markdown-wrap"></div> | |
49 | + </div> | |
50 | + </div> | |
51 | +</div> | |
52 | +} |
--- app/views/common/fileUploader.scala.html
+++ app/views/common/fileUploader.scala.html
... | ... | @@ -1,23 +1,6 @@ |
1 |
-@(resType:ResourceType, resId:Long) |
|
1 |
+@(resourceType:ResourceType, resourceId:Long) |
|
2 | 2 |
|
3 |
-<div id="upload" class="upload-wrap content-footer" data-resourceType="@resType" @if(resId != null){data-resourceId="@resId"}> |
|
4 |
- <div class="attach-wrap"> |
|
5 |
- <span class="help help-droppable">@Messages("common.attach.drophere")</span> |
|
6 |
- <div class="btn-wrap"> |
|
7 |
- <div class="nbtn medium white fake-file-wrap"> |
|
8 |
- <i class="yobicon-upload"></i> @Messages("button.upload")<!-- |
|
9 |
- --> <input type="file" class="file" name="filePath" multiple="multiple"> |
|
10 |
- </div> |
|
11 |
- </div> |
|
12 |
- <span class="plain">@Messages("common.attach.clickbutton")</span> |
|
13 |
- <span class="help help-pastable">@Messages("common.attach.pastehere")</span> |
|
14 |
- </div> |
|
15 |
- |
|
16 |
- <ul class="attached-files unstyled"></ul> |
|
17 |
- <p class="right-txt help"> |
|
18 |
- <i class="yobicon-supportrequest"></i> @Messages("common.attach.attachIfYouSave") |
|
19 |
- </p> |
|
20 |
-</div> |
|
3 |
+@common.uploadForm(resourceType, resourceId, "upload") |
|
21 | 4 |
|
22 | 5 |
<script type="text/x-jquery-tmpl" id="tplAttachedFile"> |
23 | 6 |
<li class="attached-file" data-id="${fileId}" data-name="${fileName}" data-href="${fileHref}" data-mime="${mimeType}" data-size="${fileSize}"> |
--- app/views/common/markdown.scala.html
+++ app/views/common/markdown.scala.html
... | ... | @@ -1,7 +1,5 @@ |
1 | 1 |
@(project: Project = null) |
2 | 2 |
|
3 |
-@import utils.TemplateHelper._ |
|
4 |
- |
|
5 | 3 |
<link rel="stylesheet" type="text/css" href="@routes.Assets.at("javascripts/lib/highlight/styles/default.css")" /> |
6 | 4 |
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/highlight/highlight.pack.js")"></script> |
7 | 5 |
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/marked.js")"></script> |
... | ... | @@ -9,7 +7,6 @@ |
9 | 7 |
<script type="text/javascript"> |
10 | 8 |
$(document).ready(function(){ |
11 | 9 |
var htOptions = { |
12 |
- "sTplSwitch": $("#tplMarkdownPreview").text(), |
|
13 | 10 |
"bBreaks": ($('[markdown]').hasClass('readme-body')) ? false : true |
14 | 11 |
}; |
15 | 12 |
|
... | ... | @@ -21,11 +18,4 @@ |
21 | 18 |
// Reusable markdown renderer |
22 | 19 |
yobi.Markdown.init(htOptions); |
23 | 20 |
}); |
24 |
-</script> |
|
25 |
- |
|
26 |
-<script type="text/x-jquery-tmpl" id="tplMarkdownPreview"> |
|
27 |
-<input type="radio" name="edit-mode" value="edit" checked="checked" class="radio-btn" /> |
|
28 |
-<label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
29 |
-<input type="radio" name="edit-mode" value="preview" class="radio-btn" /> |
|
30 |
-<label for="preview-mode">Preview</label> |
|
31 | 21 |
</script> |
--- app/views/common/reviewForm.scala.html
+++ app/views/common/reviewForm.scala.html
... | ... | @@ -38,31 +38,11 @@ |
38 | 38 |
</div> |
39 | 39 |
<div class="write-comment-box nm"> |
40 | 40 |
<div class="write-comment-wrap"> |
41 |
- @help.markdown() |
|
42 |
- <div class="textarea-box"> |
|
43 |
- <textarea name="contents" class="text comment" markdown="true"></textarea> |
|
44 |
- </div> |
|
41 |
+ @common.editor("contents") |
|
45 | 42 |
|
46 | 43 |
@** fileUploader **@ |
47 | 44 |
@if(!UserApp.currentUser.isAnonymous){ |
48 |
- <div class="upload-wrap content-footer" data-resourceType="@resourceType"> |
|
49 |
- <div class="attach-wrap"> |
|
50 |
- <span class="help help-droppable">@Messages("common.attach.drophere")</span> |
|
51 |
- <div class="btn-wrap"> |
|
52 |
- <div class="nbtn medium white fake-file-wrap"> |
|
53 |
- <i class="yobicon-upload"></i> @Messages("button.upload")<!-- |
|
54 |
- --> <input type="file" class="file" name="filePath" multiple="multiple"> |
|
55 |
- </div> |
|
56 |
- </div> |
|
57 |
- <span class="plain">@Messages("common.attach.clickbutton")</span> |
|
58 |
- <span class="help help-pastable">@Messages("common.attach.pastehere")</span> |
|
59 |
- </div> |
|
60 |
- |
|
61 |
- <ul class="attached-files unstyled"></ul> |
|
62 |
- <p class="right-txt help"> |
|
63 |
- <i class="yobicon-supportrequest"></i> @Messages("common.attach.attachIfYouSave") |
|
64 |
- </p> |
|
65 |
- </div> |
|
45 |
+ @common.uploadForm(resourceType) |
|
66 | 46 |
} |
67 | 47 |
@** end of fileUploader **@ |
68 | 48 |
|
+++ app/views/common/uploadForm.scala.html
... | ... | @@ -0,0 +1,44 @@ |
1 | +@** | |
2 | +* Yobi, Project Hosting SW | |
3 | +* | |
4 | +* Copyright 2014 NAVER Corp. | |
5 | +* http://yobi.io | |
6 | +* | |
7 | +* @Author JiHan Kim | |
8 | +* | |
9 | +* Licensed under the Apache License, Version 2.0 (the "License"); | |
10 | +* you may not use this file except in compliance with the License. | |
11 | +* You may obtain a copy of the License at | |
12 | +* | |
13 | +* http://www.apache.org/licenses/LICENSE-2.0 | |
14 | +* | |
15 | +* Unless required by applicable law or agreed to in writing, software | |
16 | +* distributed under the License is distributed on an "AS IS" BASIS, | |
17 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
18 | +* See the License for the specific language governing permissions and | |
19 | +* limitations under the License. | |
20 | +**@ | |
21 | +@(resourceType:ResourceType, resourceId:Long=null, formId:String=null) | |
22 | +<div | |
23 | + class="upload-wrap content-footer" | |
24 | + data-resource-type="@resourceType" | |
25 | + @if(resourceId != null){data-resource-id="@resourceId"} | |
26 | + @if(formId != null){id="@formId"} | |
27 | +> | |
28 | + <div class="attach-wrap"> | |
29 | + <span class="help help-droppable">@Messages("common.attach.drophere")</span> | |
30 | + <div class="btn-wrap"> | |
31 | + <div class="nbtn medium white fake-file-wrap"> | |
32 | + <i class="yobicon-upload"></i> @Messages("button.upload") | |
33 | + <input type="file" class="file" name="filePath" multiple="multiple"> | |
34 | + </div> | |
35 | + </div> | |
36 | + <span class="plain">@Messages("common.attach.clickbutton")</span> | |
37 | + <span class="help help-pastable">@Messages("common.attach.pastehere")</span> | |
38 | + </div> | |
39 | + | |
40 | + <ul class="attached-files unstyled"></ul> | |
41 | + <p class="right-txt help"> | |
42 | + <i class="yobicon-supportrequest"></i> @Messages("common.attach.attachIfYouSave") | |
43 | + </p> | |
44 | +</div> |
--- app/views/git/edit.scala.html
+++ app/views/git/edit.scala.html
... | ... | @@ -1,5 +1,6 @@ |
1 | 1 |
@(title:String, form: Form[PullRequest], project: Project, fromBranches: List[playRepository.GitBranch], toBranches: List[playRepository.GitBranch], pull: PullRequest) |
2 | 2 |
|
3 |
+@import scala.collection.Map |
|
3 | 4 |
@import utils.TemplateHelper._ |
4 | 5 |
@import utils.TemplateHelper.Branches._ |
5 | 6 |
@implicitField = @{ helper.FieldConstructor(simpleForm) } |
... | ... | @@ -96,17 +97,7 @@ |
96 | 97 |
|
97 | 98 |
<input type="text" name="title" id="title" placeholder="" maxlength="maxlength" tabindex="1" class="text" value="@pull.title"> |
98 | 99 |
<div style="position: relative;"> |
99 |
- <div id="mode-select"> |
|
100 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
101 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
102 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
103 |
- <label for="preview-mode">Preview</label> |
|
104 |
- </div> |
|
105 |
- <a href="#" class="go-zen"><i class="s s--zen">Edit in Zen Mode</i></a> |
|
106 |
- @help.markdown() |
|
107 |
- <div class="textarea-box"> |
|
108 |
- <textarea id="body" name="body" markdown="true" class="zen-mode content" tabindex="2" >@pull.body</textarea> |
|
109 |
- </div> |
|
100 |
+ @common.editor("body", pull.body, Map("tabindex"->"2")) |
|
110 | 101 |
</div> |
111 | 102 |
|
112 | 103 |
@common.fileUploader(ResourceType.PULL_REQUEST, pull.id) |
--- app/views/git/partial_diff.scala.html
+++ app/views/git/partial_diff.scala.html
... | ... | @@ -5,11 +5,9 @@ |
5 | 5 |
@import utils.AccessControl._ |
6 | 6 |
@import models.enumeration |
7 | 7 |
@import playRepository.GitCommit |
8 |
-@implicitField = @{ helper.FieldConstructor(simpleForm) } |
|
8 |
+@import scala.collection.Map |
|
9 | 9 |
|
10 |
-@branchName(branch:String) = @{ |
|
11 |
- branch.replace("refs/heads/", "") |
|
12 |
-} |
|
10 |
+@implicitField = @{ helper.FieldConstructor(simpleForm) } |
|
13 | 11 |
|
14 | 12 |
@getCodeURL(project: Project) = @{ |
15 | 13 |
if(session == null){ |
... | ... | @@ -27,17 +25,7 @@ |
27 | 25 |
|
28 | 26 |
<input type="text" name="title" id="title" placeholder="" maxlength="maxlength" tabindex="1" class="text" value="@pullRequest.title"> |
29 | 27 |
<div style="position: relative;"> |
30 |
- <div id="mode-select"> |
|
31 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
32 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
33 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
34 |
- <label for="preview-mode">Preview</label> |
|
35 |
- </div> |
|
36 |
- <a href="#" class="go-zen"><i class="s s--zen">Edit in Zen Mode</i></a> |
|
37 |
- @help.markdown() |
|
38 |
- <div class="textarea-box"> |
|
39 |
- <textarea id="body" name="body" markdown="true" class="zen-mode content" tabindex="2" >@pullRequest.body</textarea> |
|
40 |
- </div> |
|
28 |
+ @common.editor("body", pullRequest.body, Map("tabindex"->"2")) |
|
41 | 29 |
</div> |
42 | 30 |
@common.fileUploader(ResourceType.PULL_REQUEST, null) |
43 | 31 |
@common.markdown(project) |
--- app/views/issue/create.scala.html
+++ app/views/issue/create.scala.html
... | ... | @@ -38,17 +38,7 @@ |
38 | 38 |
<div class="span9"> |
39 | 39 |
<dl> |
40 | 40 |
<dd style="position: relative;"> |
41 |
- <div id="mode-select"> |
|
42 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
43 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
44 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
45 |
- <label for="preview-mode">Preview</label> |
|
46 |
- </div> |
|
47 |
- <a href="#" class="go-zen"><i class="s s--zen">Edit in Zen Mode</i></a> |
|
48 |
- @help.markdown() |
|
49 |
- <div class="textarea-box"> |
|
50 |
- <textarea id="body" name="body" markdown="true" class="zen-mode content nm" tabindex="2" data-label="@Messages("issue.error.emptyBody")"></textarea> |
|
51 |
- </div> |
|
41 |
+ @common.editor("body", "", Map("tabindex"->"2")) |
|
52 | 42 |
</dd> |
53 | 43 |
</dl> |
54 | 44 |
|
--- app/views/issue/edit.scala.html
+++ app/views/issue/edit.scala.html
... | ... | @@ -39,17 +39,7 @@ |
39 | 39 |
<div class="span9"> |
40 | 40 |
<dl> |
41 | 41 |
<dd style="position: relative;"> |
42 |
- <div id="mode-select"> |
|
43 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
44 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
45 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
46 |
- <label for="preview-mode">Preview</label> |
|
47 |
- </div> |
|
48 |
- <a href="#" class="go-zen"><i class="s s--zen">Edit in Zen Mode</i></a> |
|
49 |
- @help.markdown() |
|
50 |
- <div class="textarea-box"> |
|
51 |
- <textarea id="body" name="body" markdown="true" class="zen-mode content nm" tabindex="2">@issue.body</textarea> |
|
52 |
- </div> |
|
42 |
+ @common.editor("body", issue.body, Map("tabindex"->"2")) |
|
53 | 43 |
</dd> |
54 | 44 |
</dl> |
55 | 45 |
|
--- app/views/issue/partial_comments.scala.html
+++ app/views/issue/partial_comments.scala.html
... | ... | @@ -77,8 +77,7 @@ |
77 | 77 |
<img src="@User.findByLoginId(comment.authorLoginId).avatarUrl" width="32" height="32" alt="@comment.authorLoginId"> |
78 | 78 |
</a> |
79 | 79 |
</div> |
80 |
- @common.commentUpdateForm(project, ResourceType.ISSUE_COMMENT, comment.id, routes.IssueApp.newComment(project.owner, project.name, issue.getNumber).toString(), comment.contents) |
|
81 |
- <div class="media-body" id="comment-body-@comment.id"> |
|
80 |
+ <div class="media-body"> |
|
82 | 81 |
<div class="meta-info"> |
83 | 82 |
<span class="comment_author pull-left"> |
84 | 83 |
<a href="@routes.UserApp.userInfo(comment.authorLoginId)" data-toggle="tooltip" data-placement="top" title="@comment.authorName"> |
... | ... | @@ -97,8 +96,12 @@ |
97 | 96 |
</span> |
98 | 97 |
</div> |
99 | 98 |
|
100 |
- <div class="comment-body markdown-wrap markdown-before" markdown="true">@comment.contents</div> |
|
101 |
- <div class="attachments pull-right" data-resourceType="@ResourceType.ISSUE_COMMENT" data-resourceId="@comment.id"></div> |
|
99 |
+ @common.commentUpdateForm(comment.id, routes.IssueApp.newComment(project.owner, project.name, issue.getNumber).toString(), comment.contents) |
|
100 |
+ |
|
101 |
+ <div id="comment-body-@comment.id"> |
|
102 |
+ <div class="comment-body markdown-wrap markdown-before" markdown="true">@comment.contents</div> |
|
103 |
+ <div class="attachments pull-right" data-resourceType="@ResourceType.ISSUE_COMMENT" data-resourceId="@comment.id"></div> |
|
104 |
+ </div> |
|
102 | 105 |
</div> |
103 | 106 |
</li> |
104 | 107 |
|
--- app/views/milestone/create.scala.html
+++ app/views/milestone/create.scala.html
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 |
|
3 | 3 |
@import utils.TemplateHelper._ |
4 | 4 |
@import models.enumeration._ |
5 |
+@import scala.collection.Map |
|
5 | 6 |
|
6 | 7 |
@projectLayout(title, project, utils.MenuType.MILESTONE) { |
7 | 8 |
@projectMenu(project, utils.MenuType.MILESTONE, "") |
... | ... | @@ -18,17 +19,7 @@ |
18 | 19 |
<div class="content-wrap"> |
19 | 20 |
<label for="contents">@Messages("milestone.form.content")</label> |
20 | 21 |
<div style="position: relative;"> |
21 |
- <div id="mode-select"> |
|
22 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
23 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
24 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
25 |
- <label for="preview-mode">Preview</label> |
|
26 |
- </div> |
|
27 |
- <a href="#" class="go-zen"><i class="s s--zen">Edit in Zen Mode</i></a> |
|
28 |
- @help.markdown() |
|
29 |
- <div class="textarea-box"> |
|
30 |
- <textarea id="contents" class="content" name="contents" markdown="true"></textarea> |
|
31 |
- </div> |
|
22 |
+ @common.editor("contents", "", Map("id"->"contents")) |
|
32 | 23 |
</div> |
33 | 24 |
</div> |
34 | 25 |
|
--- app/views/milestone/edit.scala.html
+++ app/views/milestone/edit.scala.html
... | ... | @@ -2,6 +2,8 @@ |
2 | 2 |
|
3 | 3 |
@import utils.TemplateHelper._ |
4 | 4 |
@import models.enumeration._ |
5 |
+@import scala.collection.Map |
|
6 |
+ |
|
5 | 7 |
@implicitField = @{ helper.FieldConstructor(simpleForm) } |
6 | 8 |
|
7 | 9 |
@projectLayout(title, project, utils.MenuType.MILESTONE) { |
... | ... | @@ -21,17 +23,7 @@ |
21 | 23 |
<label for="contents">@Messages("milestone.form.content")</label> |
22 | 24 |
@helper.input(form("contents")){(id, name, value, args) => |
23 | 25 |
<div style="position: relative;"> |
24 |
- <div id="mode-select"> |
|
25 |
- <input type="radio" name="edit-mode" id="edit-mode" value="edit" checked="checked" class="radio-btn"> |
|
26 |
- <label for="edit-mode" style="margin-right:3px;">Edit</label> |
|
27 |
- <input type="radio" name="edit-mode" id="preview-mode" value="preview" class="radio-btn"> |
|
28 |
- <label for="preview-mode">Preview</label> |
|
29 |
- </div> |
|
30 |
- <a href="#" class="go-zen"><i class="s s--zen">Edit in Zen Mode</i></a> |
|
31 |
- @help.markdown() |
|
32 |
- <div class="textarea-box"> |
|
33 |
- <textarea id="contents" class="content" id="@id" name="@name" markdown="true">@value</textarea> |
|
34 |
- </div> |
|
26 |
+ @common.editor("contents", value.getOrElse(""), Map("id"->"contents")) |
|
35 | 27 |
</div> |
36 | 28 |
} |
37 | 29 |
</div> |
--- conf/messages
+++ conf/messages
... | ... | @@ -128,6 +128,8 @@ |
128 | 128 |
common.comment.delete = Delete Comment |
129 | 129 |
common.comment.delete.confirm = If this is deleted, then it cannot be recovered. Is it okay and go through? |
130 | 130 |
common.comment.edit = comment edit |
131 |
+common.editor.edit = Edit |
|
132 |
+common.editor.preview = Preview |
|
131 | 133 |
common.experimental = Experimental |
132 | 134 |
common.experimental.description = It means that can be changed or interrupted at any time.<br>Appreciate for your generosity. |
133 | 135 |
common.experimental.title = Experimental: this feature is on development. |
--- conf/messages.ko
+++ conf/messages.ko
... | ... | @@ -128,6 +128,8 @@ |
128 | 128 |
common.comment.delete = 댓글 삭제 |
129 | 129 |
common.comment.delete.confirm = 해당 댓글이 삭제되면 영원히 복구할 수 없습니다. 그래도 삭제하시겠습니까? |
130 | 130 |
common.comment.edit = 댓글 수정 |
131 |
+common.editor.edit = 편집 |
|
132 |
+common.editor.preview = 미리보기 |
|
131 | 133 |
common.experimental = 실험적인 기능 |
132 | 134 |
common.experimental.description = 이 기능은 아직 개발 진행 중으로 언제든지 변경되거나 개발 중단될 수 있습니다.<br>너그러운 마음으로 응원해주세요. |
133 | 135 |
common.experimental.title = 실험적인 기능: 새롭게 개발 중인 기능을 선보입니다 |
--- public/javascripts/common/yobi.CodeCommentBox.js
+++ public/javascripts/common/yobi.CodeCommentBox.js
... | ... | @@ -85,20 +85,6 @@ |
85 | 85 |
htElement.welCommentForm.on("click", '[data-toggle="close"]', function(){ |
86 | 86 |
_hide(); |
87 | 87 |
}); |
88 |
- |
|
89 |
- htElement.welCommentForm.on("submit", function(){ |
|
90 |
- _removeEmptyFieldsOnForm(); |
|
91 |
- }); |
|
92 |
- } |
|
93 |
- |
|
94 |
- /** |
|
95 |
- * Remove empty INPUT elements |
|
96 |
- * @private |
|
97 |
- */ |
|
98 |
- function _removeEmptyFieldsOnForm(){ |
|
99 |
- htElement.welCommentForm.find("input").filter(function(){ |
|
100 |
- return ($(this).val().length === 0); |
|
101 |
- }).remove(); |
|
102 | 88 |
} |
103 | 89 |
|
104 | 90 |
/** |
--- public/javascripts/common/yobi.Markdown.js
+++ public/javascripts/common/yobi.Markdown.js
... | ... | @@ -9,7 +9,6 @@ |
9 | 9 |
yobi.Markdown = (function(htOptions){ |
10 | 10 |
|
11 | 11 |
var htVar = {}; |
12 |
- var htElement = {}; |
|
13 | 12 |
|
14 | 13 |
/** |
15 | 14 |
* initialize |
... | ... | @@ -27,10 +26,10 @@ |
27 | 26 |
* @param {Hash Table} htOptions |
28 | 27 |
*/ |
29 | 28 |
function _initVar(htOptions){ |
30 |
- htVar.sTplSwitch = htOptions.sTplSwitch; |
|
31 | 29 |
htVar.sIssuesUrl = htOptions.sIssuesUrl; |
32 | 30 |
htVar.sProjectUrl = htOptions.sProjectUrl; |
33 | 31 |
htVar.bBreaks = htOptions.bBreaks; |
32 |
+ |
|
34 | 33 |
htVar.sUserRules = '[a-z0-9_\\-\\.]'; |
35 | 34 |
htVar.sProjecRules = '[a-z0-9_\\-\\.]'; |
36 | 35 |
htVar.sIssueRules = '\\d'; |
... | ... | @@ -176,31 +175,33 @@ |
176 | 175 |
} |
177 | 176 |
|
178 | 177 |
/** |
178 |
+ * set Markdown Viewer |
|
179 |
+ * |
|
180 |
+ * @param {Wrapped Element} welTarget is not <textarea> or <input> |
|
181 |
+ */ |
|
182 |
+ function _setViewer(welTarget) { |
|
183 |
+ var sMarkdownText = welTarget.text(); |
|
184 |
+ var sContentBody = (sMarkdownText) ? _renderMarkdown(sMarkdownText) : welTarget.html(); |
|
185 |
+ welTarget.html(sContentBody).removeClass('markdown-before'); |
|
186 |
+ } |
|
187 |
+ |
|
188 |
+ /** |
|
179 | 189 |
* set Markdown Editor |
180 | 190 |
* |
181 | 191 |
* @param {Wrapped Element} welTextarea |
182 | 192 |
*/ |
183 |
- function _setEditor(welTextarea) { |
|
184 |
- // create new preview area |
|
185 |
- var welPreview = $('<div class="markdown-preview markdown-wrap">'); |
|
186 |
- var welTextareaBox = welTextarea.parents('.write-comment-wrap').find('.textarea-box'); |
|
193 |
+ function _setEditor(welTextarea){ |
|
194 |
+ var elContainer = welTextarea.parents('[data-toggle="markdown-editor"]').get(0); |
|
187 | 195 |
|
188 |
- welPreview.css({ |
|
189 |
- "display" : "none", |
|
190 |
- "min-height": welTextarea.height() + 'px' |
|
191 |
- }); |
|
196 |
+ if(!elContainer){ |
|
197 |
+ return false; |
|
198 |
+ } |
|
192 | 199 |
|
193 |
- var welPreviewSwitch = welTextarea.parents('.write-comment-wrap').find('input[name="edit-mode"]'); |
|
194 |
- |
|
195 |
- var fOnChangeSwitch = function() { |
|
196 |
- var bPreview = (welTextarea.parents('.write-comment-wrap').find("input:radio[name=edit-mode]:checked").val() == "preview"); |
|
200 |
+ $(elContainer).on("click", 'a[data-mode="preview"]', function(weEvt){ |
|
201 |
+ var welPreview = $(weEvt.delegateTarget).find("div.markdown-preview"); |
|
197 | 202 |
welPreview.html(_renderMarkdown(welTextarea.val())); |
198 |
- (bPreview ? welPreview: welTextareaBox).show(); |
|
199 |
- (bPreview ? welTextareaBox: welPreview).hide(); |
|
200 |
- }; |
|
201 |
- |
|
202 |
- welPreviewSwitch.change(fOnChangeSwitch); |
|
203 |
- welTextareaBox.before(welPreview); |
|
203 |
+ welPreview.css({"min-height": welTextarea.height() + 'px'}); |
|
204 |
+ }); |
|
204 | 205 |
|
205 | 206 |
welTextarea.on("keydown.tabkey-event-handler", function(e) { |
206 | 207 |
if(e.keyCode === 9){ //tab |
... | ... | @@ -211,17 +212,6 @@ |
211 | 212 |
this.selectionEnd = start + 1; |
212 | 213 |
} |
213 | 214 |
}); |
214 |
- } |
|
215 |
- |
|
216 |
- /** |
|
217 |
- * set Markdown Viewer |
|
218 |
- * |
|
219 |
- * @param {Wrapped Element} welTarget is not <textarea> or <input> |
|
220 |
- */ |
|
221 |
- function _setViewer(welTarget) { |
|
222 |
- var sMarkdownText = welTarget.text(); |
|
223 |
- var sContentBody = (sMarkdownText) ? _renderMarkdown(sMarkdownText) : welTarget.html(); |
|
224 |
- welTarget.html(sContentBody).removeClass('markdown-before'); |
|
225 | 215 |
} |
226 | 216 |
|
227 | 217 |
/** |
... | ... | @@ -238,7 +228,7 @@ |
238 | 228 |
} |
239 | 229 |
|
240 | 230 |
/** |
241 |
- * Returns that specifieid element is editable |
|
231 |
+ * Returns that specified element is editable |
|
242 | 232 |
* |
243 | 233 |
* @param {HTMLElement} elTarget |
244 | 234 |
* @return {Boolean} |
--- public/javascripts/service/yobi.issue.Write.js
+++ public/javascripts/service/yobi.issue.Write.js
... | ... | @@ -27,9 +27,6 @@ |
27 | 27 |
|
28 | 28 |
// 제목 입력란에 포커스 |
29 | 29 |
htElement.welInputTitle.focus(); |
30 |
- |
|
31 |
- // zenForm |
|
32 |
- _initZenForm(); |
|
33 | 30 |
} |
34 | 31 |
|
35 | 32 |
/** |
... | ... | @@ -136,19 +133,6 @@ |
136 | 133 |
|
137 | 134 |
$(window).off("beforeunload", _onBeforeUnload); |
138 | 135 |
return true; |
139 |
- } |
|
140 |
- |
|
141 |
- /** |
|
142 |
- * ZenForm 초기화 |
|
143 |
- * initialize zenForm |
|
144 |
- */ |
|
145 |
- function _initZenForm(){ |
|
146 |
- $(".zen-mode").zenForm({"theme": "light"}); |
|
147 |
- $(".s--zen").tooltip({ |
|
148 |
- "delay": {"show": 500, "hide": 100}, |
|
149 |
- "title": Messages("title.zenmode"), |
|
150 |
- "placement": "left" |
|
151 |
- }); |
|
152 | 136 |
} |
153 | 137 |
|
154 | 138 |
_init(htOptions); |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?