
Commits: add button for copy commitId
@6d77a3e9654dd3ac534e6351e564d8e06390632e
--- app/assets/stylesheets/less/_page.less
+++ app/assets/stylesheets/less/_page.less
... | ... | @@ -3492,23 +3492,38 @@ |
3492 | 3492 |
.commit-wrap { |
3493 | 3493 |
background-color: @white; |
3494 | 3494 |
|
3495 |
- .commit-id { text-align:center; vertical-align: top; } |
|
3495 |
+ .commit-id { text-align:center; vertical-align: top; padding:0; } |
|
3496 | 3496 |
|
3497 | 3497 |
.tbody { |
3498 | 3498 |
td { padding:10px 15px 10px 5px; } |
3499 |
+ |
|
3499 | 3500 |
.messages { /* see .commitMsg */ } |
3500 | 3501 |
|
3501 | 3502 |
.commit-id { |
3502 |
- width: 70px; text-align:center; |
|
3503 |
+ position:relative; |
|
3504 |
+ text-align:center; |
|
3503 | 3505 |
vertical-align:top; |
3504 |
- padding-top:15px; |
|
3505 |
- font-family:Consolas; |
|
3506 |
+ padding:12px 3px; |
|
3507 |
+ font-family:@fixed-font-family; |
|
3506 | 3508 |
font-size:12px; |
3507 | 3509 |
|
3508 | 3510 |
a { |
3509 | 3511 |
color:@secondary; |
3510 | 3512 |
&:hover { color:@link-hover-color; text-decoration:underline; } |
3511 | 3513 |
} |
3514 |
+ |
|
3515 |
+ .btn-copy-commitId { |
|
3516 |
+ display:none; |
|
3517 |
+ &.hover { background:#f1f1f1; } |
|
3518 |
+ } |
|
3519 |
+ |
|
3520 |
+ &:hover { |
|
3521 |
+ .btn-copy-commitId { |
|
3522 |
+ position:absolute; display:block; |
|
3523 |
+ top:15px; left:-15px; |
|
3524 |
+ color:@secondary; |
|
3525 |
+ } |
|
3526 |
+ } |
|
3512 | 3527 |
} |
3513 | 3528 |
.messages { vertical-align:top;} |
3514 | 3529 |
.author { |
--- app/views/code/history.scala.html
+++ app/views/code/history.scala.html
... | ... | @@ -123,6 +123,10 @@ |
123 | 123 |
@defining(getShowCommitURL(project, commit, path)){ showCommitURL => |
124 | 124 |
<tr> |
125 | 125 |
<td class="commit-id"> |
126 |
+ <button type="button" class="ybtn ybtn-mini btn-copy-commitId" |
|
127 |
+ title="@Messages("code.copyCommitId")" data-commitId="@commit.getId()"> |
|
128 |
+ <i class="yobicon-copy"></i> |
|
129 |
+ </button> |
|
126 | 130 |
<a href="@showCommitURL" title="@Messages("code.showCommit")"> |
127 | 131 |
@commit.getShortId() |
128 | 132 |
</a> |
... | ... | @@ -198,6 +202,28 @@ |
198 | 202 |
$(this).next("pre.commitMsg.desc").toggleClass("hidden"); |
199 | 203 |
}); |
200 | 204 |
|
205 |
+ // Copy CommitId |
|
206 |
+ $("#history").find(".btn-copy-commitId").each(function(i, el){ |
|
207 |
+ var welBtnCopy = $(el); |
|
208 |
+ |
|
209 |
+ // zclip() works only in visible element |
|
210 |
+ welBtnCopy.on("mouseenter", function(){ |
|
211 |
+ if(!welBtnCopy.data("zclipped")){ |
|
212 |
+ welBtnCopy.data("zclipped", true); |
|
213 |
+ |
|
214 |
+ $(this).zclip({ |
|
215 |
+ "path": "@routes.Assets.at("javascripts/lib/jquery/ZeroClipboard.swf")", |
|
216 |
+ "copy": function(){ |
|
217 |
+ return $(this).data("commitid"); |
|
218 |
+ }, |
|
219 |
+ "afterCopy": function(){ |
|
220 |
+ $yobi.notify("@Messages("code.copyCommitId.copied")", 1000); |
|
221 |
+ } |
|
222 |
+ }); |
|
223 |
+ } |
|
224 |
+ }); |
|
225 |
+ }); |
|
226 |
+ |
|
201 | 227 |
var htKeyMap = {}; |
202 | 228 |
@if(page > 0){ |
203 | 229 |
htKeyMap.A = "@getHistoryURL(path)?page=@(page - 1)"; |
--- conf/messages
+++ conf/messages
... | ... | @@ -78,6 +78,8 @@ |
78 | 78 |
code.commitMsg.empty = No commit message |
79 | 79 |
code.commits = Commits |
80 | 80 |
code.copiedPath = {1} (Copied from {0}) |
81 |
+code.copyCommitId = Copy commit ID |
|
82 |
+code.copyCommitId.copied = Commit ID has copied |
|
81 | 83 |
code.copyUrl = Copy URL |
82 | 84 |
code.copyUrl.copied = Url copied |
83 | 85 |
code.deletedPath = {0} (Deleted) |
--- conf/messages.ko
+++ conf/messages.ko
... | ... | @@ -78,6 +78,8 @@ |
78 | 78 |
code.commitMsg.empty = No commit message |
79 | 79 |
code.commits = 커밋 |
80 | 80 |
code.copiedPath = {1} ({0}로부터 복사됨) |
81 |
+code.copyCommitId = 커밋 ID 복사 |
|
82 |
+code.copyCommitId.copied = 커밋 ID가 복사되었습니다 |
|
81 | 83 |
code.copyUrl = 주소 복사 |
82 | 84 |
code.copyUrl.copied = 주소가 복사 되었습니다. |
83 | 85 |
code.deletedPath = {0} (삭제됨) |
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?