Skip to content

Improve protected branch setting page #24379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5ae79ec
fine tune styles for branch settings
HesterG Apr 26, 2023
f9e743d
Merge branch 'go-gitea:main' into modify-branch-setting-style
HesterG Apr 26, 2023
37648a6
change order
HesterG Apr 26, 2023
4f9713d
Merge branch 'go-gitea:main' into modify-branch-setting-style
HesterG Apr 27, 2023
16a02cc
remove unnecessary div
HesterG Apr 27, 2023
227d465
use grouped fields
HesterG Apr 27, 2023
e7f555e
use grouped fields
HesterG Apr 27, 2023
70c47da
add conditions for default icon
HesterG Apr 27, 2023
db24ca8
remove unnecessary for/id
HesterG Apr 27, 2023
c623df1
Merge branch 'main' into modify-branch-setting-style
HesterG Apr 27, 2023
a09ce78
remove brs
HesterG Apr 27, 2023
eadbaf4
use flex
HesterG Apr 27, 2023
a039ca2
Merge branch 'go-gitea:main' into modify-branch-setting-style
HesterG Apr 28, 2023
272df35
remove one more for/id
HesterG Apr 28, 2023
bdc5966
move required signed commit to push
HesterG Apr 28, 2023
42a594f
Merge branch 'main' into modify-branch-setting-style
HesterG Apr 28, 2023
1e061c3
change orders and change merge checkbox to radio checkbox
HesterG Apr 28, 2023
4e0f07d
Merge branch 'main' into modify-branch-setting-style
HesterG Apr 28, 2023
acb3145
use general styles to fine tune
wxiaoguang Apr 28, 2023
3a81882
use general styles to fine tune
wxiaoguang Apr 28, 2023
78ec513
remove incorrect "for" attributes
wxiaoguang Apr 28, 2023
62ec72a
remove dead code
wxiaoguang Apr 28, 2023
32dc787
fix layout
wxiaoguang Apr 28, 2023
0fbb8eb
fix various bugs
wxiaoguang Apr 28, 2023
8ed0f34
fine tune more
wxiaoguang Apr 28, 2023
03398d7
fix lint
wxiaoguang Apr 28, 2023
e689995
Merge branch 'main' into modify-branch-setting-style
HesterG Apr 28, 2023
6b9400b
move status check to pr approvals
HesterG Apr 28, 2023
683b9b1
use table
HesterG Apr 28, 2023
32c7616
Update web_src/js/features/repo-settings.js
wxiaoguang Apr 29, 2023
5ca7647
Merge branch 'main' into modify-branch-setting-style
wxiaoguang Apr 29, 2023
aafbb0a
remove unnecessary styles
wxiaoguang Apr 29, 2023
9c3cdbe
Update options/locale/locale_en-US.ini
wxiaoguang Apr 29, 2023
58cb851
Merge branch 'main' into modify-branch-setting-style
GiteaBot Apr 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ settings.sync_mirror = Synchronize Now
settings.mirror_sync_in_progress = Mirror synchronization is in progress. Check back in a minute.
settings.site = Website
settings.update_settings = Update Settings
settings.branches.switch_default_branch = Switch Default Branch
settings.branches.update_default_branch = Update Default Branch
settings.branches.add_new_rule = Add New Rule
settings.advanced_settings = Advanced Settings
Expand Down Expand Up @@ -2096,6 +2097,8 @@ settings.event_pull_request_review = Pull Request Reviewed
settings.event_pull_request_review_desc = Pull request approved, rejected, or review comment.
settings.event_pull_request_sync = Pull Request Synchronized
settings.event_pull_request_sync_desc = Pull request synchronized.
settings.event_pull_request_approvals = Pull Request Approvals
settings.event_pull_request_merge = Pull Request Merge
settings.event_package = Package
settings.event_package_desc = Package created or deleted in a repository.
settings.branch_filter = Branch filter
Expand Down Expand Up @@ -2151,13 +2154,15 @@ settings.protected_branch.delete_rule = Delete Rule
settings.protected_branch_can_push = Allow push?
settings.protected_branch_can_push_yes = You can push
settings.protected_branch_can_push_no = You cannot push
settings.branch_protection = Branch Protection for Branch '<b>%s</b>'
settings.branch_protection = Branch Protection Rules for Branch '<b>%s</b>'
settings.protect_this_branch = Enable Branch Protection
settings.protect_this_branch_desc = Prevents deletion and restricts Git pushing and merging to the branch.
settings.protect_disable_push = Disable Push
settings.protect_disable_push_desc = No pushing will be allowed to this branch.
settings.protect_enable_push = Enable Push
settings.protect_enable_push_desc = Anyone with write access will be allowed to push to this branch (but not force push).
settings.protect_enable_merge = Enable Merge
settings.protect_enable_merge_desc = Anyone with write access will be allowed to merge the pull requests into this branch.
settings.protect_whitelist_committers = Whitelist Restricted Push
settings.protect_whitelist_committers_desc = Only whitelisted users or teams will be allowed to push to this branch (but not force push).
settings.protect_whitelist_deploy_keys = Whitelist deploy keys with write access to push.
Expand All @@ -2183,6 +2188,7 @@ settings.dismiss_stale_approvals_desc = When new commits that change the content
settings.require_signed_commits = Require Signed Commits
settings.require_signed_commits_desc = Reject pushes to this branch if they are unsigned or unverifiable.
settings.protect_branch_name_pattern = Protected Branch Name Pattern
settings.protect_patterns = Patterns
settings.protect_protected_file_patterns = "Protected file patterns (separated using semicolon ';'):"
settings.protect_protected_file_patterns_desc = "Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (';'). See <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>."
settings.protect_unprotected_file_patterns = "Unprotected file patterns (separated using semicolon ';'):"
Expand Down
9 changes: 0 additions & 9 deletions routers/web/repo/setting_protected_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ func SettingsProtectedBranch(c *context.Context) {
}

c.Data["branch_status_check_contexts"] = contexts
c.Data["is_context_required"] = func(context string) bool {
for _, c := range rule.StatusCheckContexts {
if c == context {
return true
}
}
return false
}

if c.Repo.Owner.IsOrganization() {
teams, err := organization.OrgFromUser(c.Repo.Owner).TeamsWithAccessToRepo(c.Repo.Repository.ID, perm.AccessModeRead)
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion templates/repo/branch/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
{{template "base/alert" .}}
{{template "repo/sub_menu" .}}
{{if .DefaultBranchBranch}}
<h4 class="ui top attached header gt-mt-4">
<h4 class="ui top attached header">
{{.locale.Tr "repo.default_branch"}}
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
<a role="button" class="right" href="{{.RepoLink}}/settings/branches" data-tooltip-content="{{.locale.Tr "repo.settings.branches.switch_default_branch"}}">
{{svg "octicon-arrow-switch"}}
</a>
{{end}}
</h4>

<div class="ui attached table segment">
Expand Down
14 changes: 4 additions & 10 deletions templates/repo/settings/branches.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@
<p>
{{.locale.Tr "repo.settings.default_branch_desc"}}
</p>
<form class="ui form" action="{{.Link}}" method="post">
<form class="gt-df" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="default_branch">
{{if not .Repository.IsEmpty}}
<div class="required inline field">
<div class="ui dropdown selection" tabindex="0">
<select name="branch">
<option value="{{.Repository.DefaultBranch}}">{{.Repository.DefaultBranch}}</option>
{{range .Branches}}
<option value="{{.}}">{{.}}</option>
{{end}}
</select>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="ui dropdown selection gt-f1 gt-mr-3 gt-max-width-24rem">
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<input type="hidden" name="branch" value="{{.Repository.DefaultBranch}}">
<div class="default text">{{.Repository.DefaultBranch}}</div>
<div class="menu">
{{range .Branches}}
Expand All @@ -32,7 +27,6 @@
</div>
</div>
<button class="ui green button">{{$.locale.Tr "repo.settings.branches.update_default_branch"}}</button>
</div>
{{end}}
</form>
</div>
Expand Down
Loading