From abdebd2641e162791144fbd57acf480b4640baa8 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 8 Aug 2022 01:15:11 +0200 Subject: [PATCH] Rework repo buttons (#20602) * Rework repo buttons - Replace "New PR" and "Go to File" button with Icon Button - Move all "Add File" actions into a dropdown button - Remove most custom styling of clone buttons - Margin and wiki tweaks Buttons are now all equal height, mobile layout wraps gracefully. Fixes: https://github.com/go-gitea/gitea/issues/13671 Replaces: https://github.com/go-gitea/gitea/pull/20375 Co-authored-by: Lauris BH Co-authored-by: zeripath Co-authored-by: Lunny Xiao --- options/locale/locale_en-US.ini | 1 + templates/repo/branch_dropdown.tmpl | 11 +-- templates/repo/clone_buttons.tmpl | 10 +-- templates/repo/commits.tmpl | 6 +- templates/repo/home.tmpl | 99 +++++++++++----------- templates/repo/sub_menu.tmpl | 2 +- templates/repo/view_list.tmpl | 2 +- templates/repo/wiki/view.tmpl | 6 +- web_src/js/features/repo-common.js | 2 +- web_src/less/_repository.less | 123 ++++++++++++---------------- web_src/less/helpers.less | 1 + 11 files changed, 120 insertions(+), 143 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 56d6d41916..783783617b 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1063,6 +1063,7 @@ normal_view = Normal View line = line lines = lines +editor.add_file = Add File editor.new_file = New File editor.upload_file = Upload File editor.edit_file = Edit File diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index afdaae0f05..9d1ec10d3c 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -1,5 +1,6 @@ {{$release := .release}} {{$defaultBranch := $.root.BranchName}}{{if and .root.IsViewTag (not .noTag)}}{{$defaultBranch = .root.TagName}}{{end}}{{if eq $defaultBranch ""}}{{$defaultBranch = $.root.Repository.DefaultBranch}}{{end}} +{{$type := ""}}{{if and .root.IsViewTag (not .noTag)}}{{$type = "tag"}}{{else if .root.IsViewBranch}}{{$type = "branch"}}{{else}}{{$type = "tree"}}{{end}} {{$showBranchesInDropdown := not .root.HideBranchesInDropdown}}