Skip to content

Commit 31a1fe1

Browse files
6543lunny
authored andcommitted
[Branch View] add download button (#7604)
* add download-button info message * add overflow-visible css for table colum class * right colum is always there * add download button for default branch * add download button for all other branchs * resize table colum so two buttons fit in * code indent avter rebase * show commit divergence corect #7625 * changes because of merge master into ... * optimize if statement for protected branches * dont downloat a deleted branch - fix error 404
1 parent a19138c commit 31a1fe1

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,7 @@ branch.restore_success = Branch '%s' has been restored.
14081408
branch.restore_failed = Failed to restore branch '%s'.
14091409
branch.protected_deletion_failed = Branch '%s' is protected. It cannot be deleted.
14101410
branch.restore = Restore Branch '%s'
1411+
branch.download = Download Branch '%s'
14111412
14121413
topic.manage_topics = Manage Topics
14131414
topic.done = Done

public/css/index.css

+1
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ tbody.commit-list{vertical-align:baseline}
985985
.ui.repository.list .item .ui.avatar.image{width:24px;height:24px}
986986
.ui.repository.branches .info{font-size:12px;color:grey;display:flex;white-space:pre}
987987
.ui.repository.branches .info .commit-message{max-width:72em;overflow:hidden;text-overflow:ellipsis}
988+
.ui.repository.branches .overflow-visible{overflow:visible}
988989
.ui.user.list .item{padding-bottom:25px}
989990
.ui.user.list .item:not(:first-child){border-top:1px solid #eee;padding-top:25px}
990991
.ui.user.list .item .ui.avatar.image{width:40px;height:40px}

public/less/_explore.less

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
text-overflow: ellipsis;
7474
}
7575
}
76+
.overflow-visible {
77+
overflow: visible;
78+
}
7679
}
7780

7881
.ui.user.list {

templates/repo/branch/list.tmpl

+27-9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
{{end}}
2424
{{end}}
2525
</td>
26+
<td class="right aligned overflow-visible">
27+
<div class="ui basic jump dropdown icon button poping up" data-content="{{$.i18n.Tr "repo.branch.download" ($.DefaultBranch|EscapePound)}}" data-variation="tiny inverted" data-position="top right">
28+
<i class="download icon"></i>
29+
<div class="menu">
30+
<a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.DefaultBranch}}.zip"><i class="octicon octicon-file-zip"></i> ZIP</a>
31+
<a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.DefaultBranch}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
32+
</div>
33+
</div>
34+
</td>
2635
</tr>
2736
</tbody>
2837
</table>
@@ -50,7 +59,7 @@
5059
<p class="info"><i class="octicon octicon-git-commit"></i><a href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
5160
{{end}}
5261
</td>
53-
<td class="two wide ui">
62+
<td class="three wide ui">
5463
{{if not .IsDeleted}}
5564
<div class="commit-divergence">
5665
<div class="bar-group">
@@ -82,15 +91,24 @@
8291
{{end}}
8392
{{end}}
8493
</td>
85-
{{if and $.IsWriter (not $.IsMirror)}}
86-
<td class="one wide right aligned">
87-
{{if and .IsDeleted (not .IsProtected)}}
88-
<a class="ui basic jump button icon poping up undo-button" href data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID | urlquery}}&name={{.DeletedBranch.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.restore" (.Name | EscapePound)}}" data-variation="tiny inverted" data-position="top right"><i class="octicon octicon-reply text blue"></i></a>
89-
{{else if (not .IsProtected)}}
90-
<a class="ui basic jump button icon poping up delete-branch-button" href data-url="{{$.Link}}/delete?name={{.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.delete" (.Name | EscapePound)}}" data-variation="tiny inverted" data-position="top right" data-name="{{.Name}}"><i class="trash icon text red"></i></a>
94+
<td class="two wide right aligned overflow-visible">
95+
{{if (not .IsDeleted)}}
96+
<div class="ui basic jump dropdown icon button poping up" data-content="{{$.i18n.Tr "repo.branch.download" (.Name|EscapePound)}}" data-variation="tiny inverted" data-position="top right">
97+
<i class="download icon"></i>
98+
<div class="menu">
99+
<a class="item" href="{{$.RepoLink}}/archive/{{EscapePound .Name}}.zip"><i class="octicon octicon-file-zip"></i> ZIP</a>
100+
<a class="item" href="{{$.RepoLink}}/archive/{{EscapePound .Name}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
101+
</div>
102+
</div>
91103
{{end}}
92-
</td>
93-
{{end}}
104+
{{if and $.IsWriter (not $.IsMirror) (not .IsProtected)}}
105+
{{if .IsDeleted}}
106+
<a class="ui basic jump button icon poping up undo-button" href data-url="{{$.Link}}/restore?branch_id={{.DeletedBranch.ID | urlquery}}&name={{.DeletedBranch.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.restore" (.Name | EscapePound)}}" data-variation="tiny inverted" data-position="top right"><i class="octicon octicon-reply text blue"></i></a>
107+
{{else}}
108+
<a class="ui basic jump button icon poping up delete-branch-button" href data-url="{{$.Link}}/delete?name={{.Name | urlquery}}" data-content="{{$.i18n.Tr "repo.branch.delete" (.Name | EscapePound)}}" data-variation="tiny inverted" data-position="top right" data-name="{{.Name}}"><i class="trash icon text red"></i></a>
109+
{{end}}
110+
{{end}}
111+
</td>
94112
</tr>
95113
{{end}}
96114
{{end}}

0 commit comments

Comments
 (0)