[Notice] Announcing the End of Demo Server [Read me]
김지한 2013-10-23
Merge pull request #150 from insanehong/hive refs/heads/issue/title-message
@f216c0ad106e4df47f50544d83948400b359c622
app/assets/stylesheets/less/_page.less
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
@@ -517,7 +517,6 @@
 
 .project-page-wrap {    
     margin:30px 0;
-    overflow:auto;
     padding:0 40px 0 160px;
     position: relative;
     min-height:580px;
@@ -537,6 +536,10 @@
 
             }
         }
+    }
+
+    .tab-content {
+        overflow:visible;
     }
 }
 
@@ -811,7 +814,7 @@
                 .feature-desc {
                     margin:0;
                     padding:0;
-                    font-size:11px;
+                    font-size:13px;
                     text-align:left;
                 }
             }
@@ -3042,11 +3045,9 @@
     .avatar-wrap { margin-right:10px; }
 
     .title {
+        text-overflow: ellipsis; 
+        white-space: nowrap; 
         overflow: hidden;
-        white-space: nowrap;
-        text-overflow:ellipsis;
-        -webkit-line-clamp:4;
-        -webkit-box-orient:vertical;
     }
 
     .infos {
@@ -3071,7 +3072,6 @@
     }
     
     .title-link { 
-        display:inline-block; 
         margin:5px 0; margin-right:5px; 
         font-size:14px; font-weight:bold;
         
app/assets/stylesheets/less/_yobiUI.less
--- app/assets/stylesheets/less/_yobiUI.less
+++ app/assets/stylesheets/less/_yobiUI.less
@@ -6,8 +6,8 @@
  * (bootstrap 2.3.1 : 14px,
  *  bootstrap 2.2.1 : 12px)
  */
-html {position: relative; }
-body { font-size:12px; padding-bottom: 55px;}
+html {position: relative; padding-bottom: 90px; }
+body { font-size:12px; }
 label, input, button, select, textarea { font-size:12px; }
 select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"],
 input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"],
app/controllers/PullRequestApp.java
--- app/controllers/PullRequestApp.java
+++ app/controllers/PullRequestApp.java
@@ -201,8 +201,6 @@
         pullRequest.fromProject = project;
         pullRequest.fromBranch = request().getQueryString("fromBranch");
         pullRequest.toBranch = request().getQueryString("toBranch");
-        //TODO cloneAndFetch시 브랜치명에 id를 사용하고 있어 임의로 추가   
-        pullRequest.id = Long.MAX_VALUE;    
         
         PullRequestMergeResult mergeResult = null;
         
app/controllers/SiteApp.java
--- app/controllers/SiteApp.java
+++ app/controllers/SiteApp.java
@@ -294,17 +294,4 @@
 
         return ok(toJson(emails));
     }
-    
-    /**
-     * NHN NEXT의 이슈로 number가 null인 데이터를 초기화하는 임시 기능입니다.  
-     * @return
-     */
-    public static Result updatePostNumber() {
-        List<Posting> postings = Posting.finder.where().isNull("number").findList();
-        for(Posting post: postings) {
-            post.updateNumber();
-        }
-        
-        return ok("complete");    
-    }
 }
app/models/PullRequest.java
--- app/models/PullRequest.java
+++ app/models/PullRequest.java
@@ -133,9 +133,6 @@
     @OneToMany(cascade = CascadeType.ALL)
     public List<PullRequestEvent> pullRequestEvents;
     
-    @Lob
-    public String patch;
-    
     /**
      * {@link #fromBranch}의 가장 최근 커밋 ID
      *
@@ -194,14 +191,6 @@
                 ", received=" + received +
                 ", state=" + state +
                 '}';
-    }
-    
-    public void setPatch(String patch) {
-        this.patch = patch;
-    }
-    
-    public String getPatch() {
-        return this.patch;
     }
     
     public Duration createdAgo() {
@@ -683,13 +672,9 @@
                 }
                 
                 GitRepository.checkout(clonedRepository, cloneAndFetch.getDestToBranchName());
-                
-                pullRequest.setPatch(GitRepository.getPatch(clonedRepository,
-                    cloneAndFetch.getDestFromBranchName(), cloneAndFetch.getDestToBranchName()));
 
                 String mergedCommitIdFrom = null;
                 MergeResult mergeResult = null;
-
 
                 synchronized(this) {
                     mergedCommitIdFrom =
@@ -737,119 +722,5 @@
 
     public void endMerge() {
         this.isMerging = false;
-    }
-    
-    public Map<String, Object> getDiffCommitAndPatch() {
-        final Map<String, Object> result = new HashMap<>();
-        final PullRequest pullRequest = this;
-        
-        GitRepository.cloneAndFetch(pullRequest, new AfterCloneAndFetchOperation() {
-            @Override
-            public void invoke(CloneAndFetch cloneAndFetch) throws IOException, GitAPIException {
-                List<GitCommit> gitCommits = GitRepository.diffCommits(cloneAndFetch.getRepository(),
-                        cloneAndFetch.getDestFromBranchName(), cloneAndFetch.getDestToBranchName());
-
-                String patch = GitRepository.getPatch(cloneAndFetch.getRepository(), cloneAndFetch.getDestFromBranchName(), cloneAndFetch.getDestToBranchName());
-                
-                result.put("patch", patch);
-                result.put("commits", gitCommits);
-                
-                /*List<DiffCommit> commits = new ArrayList<>();
-                for (GitCommit gitCommit : gitCommits) {
-                    DiffCommit commit = new DiffCommit(gitCommit);
-                    commits.add(commit);
-                }                 
-                result.put("commits", commits);
-                result.put("patch", patch);*/                                
-            }
-        });
-        
-        return result;
-    }
-    
-    class DiffCommit {
-        
-        public DiffCommit(GitCommit gitCommit) {
-            this.id = gitCommit.getId();
-            this.authorDate = gitCommit.getAuthorDate();
-            this.message = gitCommit.getMessage();
-            this.shortId = gitCommit.getShortId();
-            this.authorEmail = gitCommit.getAuthorEmail();
-        }
-        
-        public String id;
-        public Date authorDate;
-        public Date created;
-        public String message;
-        public String shortId;
-        public String authorEmail;
-        
-        public String getId() {
-            return id;
-        }
-        public void setId(String id) {
-            this.id = id;
-        }
-        public Date getAuthorDate() {
-            return authorDate;
-        }
-        public String getAuthorDateAgo() {
-            Duration duration = JodaDateUtil.ago(authorDate);
-            if (duration != null){
-                long sec = duration.getMillis() / DateTimeConstants.MILLIS_PER_SECOND;
-
-                if(sec >= 86400) {
-                    return Messages.get("common.time.day", duration.getStandardDays());
-                } else if(sec >= 3600) {
-                    return Messages.get("common.time.hour", duration.getStandardHours());
-                } else if(sec >= 60) {
-                    return Messages.get("common.time.minute", duration.getStandardMinutes());
-                } else if(sec >= 0) {
-                    return Messages.get("common.time.second", duration.getStandardSeconds());
-                } else {
-                    return Messages.get("common.time.just");
-                }
-            } else {
-                return StringUtils.EMPTY;
-            }
-        }
-        public void setAuthorDate(Date authorDate) {
-            this.authorDate = authorDate;
-        }
-        public Date getCreated() {
-            return created;
-        }
-        public void setCreated(Date created) {
-            this.created = created;
-        }
-        public String getMessage() {
-            return message;
-        }
-        public void setMessage(String message) {
-            this.message = message;
-        }
-        public String getShortId() {
-            return shortId;
-        }
-        public void setShortId(String shortId) {
-            this.shortId = shortId;
-        }
-        public String getAuthorEmail() {
-            return authorEmail;
-        }
-        public boolean getExistUser() {
-            return User.find.where().eq("email", authorEmail).findUnique() != null;
-        }
-        public String getAuthorAvatarUrl() {
-            User user = User.find.where().eq("email", authorEmail).findUnique();
-            return user.avatarUrl;
-        }
-        public String getAuthorGravatarUrl() {
-            return GravatarUtil.getAvatar(authorEmail, 32);
-        }
-        
-        public void setAuthorEmail(String authorEmail) {
-            this.authorEmail = authorEmail;
-        }
     }
 }
app/playRepository/GitRepository.java
--- app/playRepository/GitRepository.java
+++ app/playRepository/GitRepository.java
@@ -769,7 +769,6 @@
                     // merge 커밋 메시지 수정
                     amend(cloneRepository, UserApp.currentUser(), pullRequest);
 
-                    ObjectId[] mergedCommits = mergeResult.getMergedCommits();
                     pullRequest.mergedCommitIdFrom = mergedCommitIdFrom;
                     pullRequest.mergedCommitIdTo = mergeResult.getNewHead().getName();
 
app/views/git/create.scala.html
--- app/views/git/create.scala.html
+++ app/views/git/create.scala.html
@@ -107,10 +107,26 @@
             <div id="frmWrap">
 			@views.html.git.partial_diff(form, project, mergeResult, pullRequest)
 			</div>
+			<div id="compare" class="modal hide compare-wrap" tabindex="-1" role="dialog">
+			    <h4 class="path">
+			        <span></span>
+			        <button type="button" class="ybtn pull-right" data-dismiss="modal" style="margin-right:20px;">@Messages("button.confirm")</button>
+			    </h4>
+			    <div class="row-fluid">
+			        <div class="span6 compare-from"></div>
+			        <div class="span6 compare-to"></div>
+			    </div>
+			    <div id="mergely" class="mergely-wrap"></div>
+			</div>
         }
     </div>
 </div>
 
+<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/mergely/codemirror.css")">
+<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/mergely/mergely.css")">
+<script type="text/javascript" src="@getJSLink("lib/mergely/codemirror.min")"></script>
+<script type="text/javascript" src="@getJSLink("lib/mergely/mergely")"></script>
+
 <script type="text/javascript" src="/assets/javascripts/lib/spin.js"></script>
 <script type="text/javascript">
 $(document).ready(function() {
app/views/git/partial_diff.scala.html
--- app/views/git/partial_diff.scala.html
+++ app/views/git/partial_diff.scala.html
@@ -121,11 +121,25 @@
 			</div>
 			   
 			<div id="__changes" class="tab-pane">
-				<pre>@pullRequest.getPatch()</pre>
+				<div class="diff-body">
+				@views.html.partial_diff(pullRequest.getDiff)
+				</div>
 			</div>
 			</div>
 			}
 			}
 			</div>
-
-			
(No newline at end of file)
+			<input type="hidden" id="commitChanged" value="@if(result != null){ @result.commitChanged } else {false}" />
+			<script type="text/javascript">
+			$(document).ready(function() {
+				$yobi.loadModule("code.Diff", {
+		            "welDiff": $("#pull-request-changes"),
+		            "sAttachmentAction": "@routes.AttachmentApp.uploadFile",
+		            "bCommentable": false,
+		            "sTplFileURLA"    : "@routes.CodeApp.codeBrowserWithBranch(pullRequest.toProject.owner, pullRequest.toProject.name, "${commitId}", "${path}")",
+		            "sTplFileURLB"    : "@routes.CodeApp.codeBrowserWithBranch(pullRequest.fromProject.owner, pullRequest.fromProject.name, "${commitId}", "${path}")",
+		            "sTplRawURLA"     : "@routes.CodeApp.showRawFile(pullRequest.toProject.owner, pullRequest.toProject.name, "${commitId}", "${path}")",
+		            "sTplRawURLB"     : "@routes.CodeApp.showRawFile(pullRequest.fromProject.owner, pullRequest.fromProject.name, "${commitId}", "${path}")"
+		        });
+			});
+			</script>
(No newline at end of file)
app/views/partial_diff.scala.html
--- app/views/partial_diff.scala.html
+++ app/views/partial_diff.scala.html
@@ -1,4 +1,4 @@
-@(fileDiffs: java.util.List[playRepository.FileDiff], comments:java.util.List[_ <: CodeComment])
+@(fileDiffs: java.util.List[playRepository.FileDiff], comments:java.util.List[_ <: CodeComment] = new ArrayList[CodeComment])
 
 @for(diff <- fileDiffs) {
   @views.html.partial_filediff(diff, comments)
 
conf/evolutions/default/42.sql (added)
+++ conf/evolutions/default/42.sql
@@ -0,0 +1,7 @@
+# --- !Ups
+
+ALTER TABLE pull_request DROP COLUMN patch;
+
+# --- !Downs
+
+ALTER TABLE pull_request ADD COLUMN patch clob;
conf/routes
--- conf/routes
+++ conf/routes
@@ -56,7 +56,6 @@
 POST    /resetPassword                                  controllers.PasswordResetApp.resetPassword()
 GET     /sites/postList                                 controllers.SiteApp.postList(pageNum: Int ?= 1)
 GET     /sites/issueList                                controllers.SiteApp.issueList(pageNum: Int ?= 1)
-GET		/sites/updatePostNumber							controllers.SiteApp.updatePostNumber()
 
 # Attachments
 GET     /files                                          controllers.AttachmentApp.getFileList()
public/javascripts/service/yobi.git.Write.js
--- public/javascripts/service/yobi.git.Write.js
+++ public/javascripts/service/yobi.git.Write.js
@@ -35,6 +35,8 @@
             htVar.oToBranch  = new yobi.ui.Dropdown({"elContainer": htOptions.welToBranch});
             htVar.sUploaderId = null;
             htVar.oSpinner = null;
+            htVar.bCommitChanged = false;
+            
             htVar.htUserInput = {};
             htVar.sTplFileItem = $('#tplAttachedFile').text();
         }
@@ -204,7 +206,14 @@
                     return false;
                 }
             }
-
+            
+            htVar.bCommitChanged = $.trim($("#commitChanged").val()) == "true";
+            
+            if(!htVar.bCommitChanged) {
+                $yobi.alert(Messages("pullRequest.diff.noChanges"));
+                return false;
+            }
+            
             return true;
         }
 
Add a comment
List