[Notice] Announcing the End of Demo Server [Read me]

pull-request form: Apply server-side code diff rendering
1. Apply server-side code diff rendering 2. Add changed commit validation
@165f6bdd57e786d0b8aaa3c01c2ce95b344961fe
--- app/views/git/create.scala.html
+++ app/views/git/create.scala.html
... | ... | @@ -107,10 +107,26 @@ |
107 | 107 |
<div id="frmWrap"> |
108 | 108 |
@views.html.git.partial_diff(form, project, mergeResult, pullRequest) |
109 | 109 |
</div> |
110 |
+ <div id="compare" class="modal hide compare-wrap" tabindex="-1" role="dialog"> |
|
111 |
+ <h4 class="path"> |
|
112 |
+ <span></span> |
|
113 |
+ <button type="button" class="ybtn pull-right" data-dismiss="modal" style="margin-right:20px;">@Messages("button.confirm")</button> |
|
114 |
+ </h4> |
|
115 |
+ <div class="row-fluid"> |
|
116 |
+ <div class="span6 compare-from"></div> |
|
117 |
+ <div class="span6 compare-to"></div> |
|
118 |
+ </div> |
|
119 |
+ <div id="mergely" class="mergely-wrap"></div> |
|
120 |
+ </div> |
|
110 | 121 |
} |
111 | 122 |
</div> |
112 | 123 |
</div> |
113 | 124 |
|
125 |
+<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/mergely/codemirror.css")"> |
|
126 |
+<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/mergely/mergely.css")"> |
|
127 |
+<script type="text/javascript" src="@getJSLink("lib/mergely/codemirror.min")"></script> |
|
128 |
+<script type="text/javascript" src="@getJSLink("lib/mergely/mergely")"></script> |
|
129 |
+ |
|
114 | 130 |
<script type="text/javascript" src="/assets/javascripts/lib/spin.js"></script> |
115 | 131 |
<script type="text/javascript"> |
116 | 132 |
$(document).ready(function() { |
--- app/views/git/partial_diff.scala.html
+++ app/views/git/partial_diff.scala.html
... | ... | @@ -121,11 +121,25 @@ |
121 | 121 |
</div> |
122 | 122 |
|
123 | 123 |
<div id="__changes" class="tab-pane"> |
124 |
- <pre>@pullRequest.getPatch()</pre> |
|
124 |
+ <div class="diff-body"> |
|
125 |
+ @views.html.partial_diff(pullRequest.getDiff, new ArrayList[CodeComment]) |
|
126 |
+ </div> |
|
125 | 127 |
</div> |
126 | 128 |
</div> |
127 | 129 |
} |
128 | 130 |
} |
129 | 131 |
</div> |
130 |
- |
|
131 |
-(No newline at end of file) |
|
132 |
+ <input type="hidden" id="commitChanged" value="@if(result != null){ @result.commitChanged } else {false}" /> |
|
133 |
+ <script type="text/javascript"> |
|
134 |
+ $(document).ready(function() { |
|
135 |
+ $yobi.loadModule("code.Diff", { |
|
136 |
+ "welDiff": $("#pull-request-changes"), |
|
137 |
+ "sAttachmentAction": "@routes.AttachmentApp.uploadFile", |
|
138 |
+ "bCommentable": false, |
|
139 |
+ "sTplFileURLA" : "@routes.CodeApp.codeBrowserWithBranch(pullRequest.toProject.owner, pullRequest.toProject.name, "${commitId}", "${path}")", |
|
140 |
+ "sTplFileURLB" : "@routes.CodeApp.codeBrowserWithBranch(pullRequest.fromProject.owner, pullRequest.fromProject.name, "${commitId}", "${path}")", |
|
141 |
+ "sTplRawURLA" : "@routes.CodeApp.showRawFile(pullRequest.toProject.owner, pullRequest.toProject.name, "${commitId}", "${path}")", |
|
142 |
+ "sTplRawURLB" : "@routes.CodeApp.showRawFile(pullRequest.fromProject.owner, pullRequest.fromProject.name, "${commitId}", "${path}")" |
|
143 |
+ }); |
|
144 |
+ }); |
|
145 |
+ </script>(No newline at end of file) |
--- public/javascripts/service/yobi.git.Write.js
+++ public/javascripts/service/yobi.git.Write.js
... | ... | @@ -35,6 +35,8 @@ |
35 | 35 |
htVar.oToBranch = new yobi.ui.Dropdown({"elContainer": htOptions.welToBranch}); |
36 | 36 |
htVar.sUploaderId = null; |
37 | 37 |
htVar.oSpinner = null; |
38 |
+ htVar.bCommitChanged = false; |
|
39 |
+ |
|
38 | 40 |
htVar.htUserInput = {}; |
39 | 41 |
htVar.sTplFileItem = $('#tplAttachedFile').text(); |
40 | 42 |
} |
... | ... | @@ -204,7 +206,14 @@ |
204 | 206 |
return false; |
205 | 207 |
} |
206 | 208 |
} |
207 |
- |
|
209 |
+ |
|
210 |
+ htVar.bCommitChanged = $.trim($("#commitChanged").val()) == "true"; |
|
211 |
+ |
|
212 |
+ if(!htVar.bCommitChanged) { |
|
213 |
+ $yobi.alert(Messages("pullRequest.diff.noChanges")); |
|
214 |
+ return false; |
|
215 |
+ } |
|
216 |
+ |
|
208 | 217 |
return true; |
209 | 218 |
} |
210 | 219 |
|
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?