diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-05-06 15:17:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 07:17:22 +0000 |
commit | eda10cc2bb229a6b13ace76caea118384b381429 (patch) | |
tree | 50bb4a2e07cc88e56d92ecd60deb9ba79069bcb8 /templates | |
parent | ce8b11ae131bef6cd7df0849ed39da7984953a4b (diff) | |
download | gitea-eda10cc2bb229a6b13ace76caea118384b381429.tar.gz gitea-eda10cc2bb229a6b13ace76caea118384b381429.zip |
Fix some UI problems (dropdown/container) (#30849)
Follow #30345
Follow #30547
`ellipsis` / `white-space` shouldn't be put on the general dropdown components.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/devtest/fomantic-dropdown.tmpl | 109 | ||||
-rw-r--r-- | templates/devtest/gitea-ui.tmpl | 88 | ||||
-rw-r--r-- | templates/repo/branch_dropdown.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/header.tmpl | 174 | ||||
-rw-r--r-- | templates/repo/issue/branch_selector_field.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/reference_issue_dialog.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/settings/options.tmpl | 2 |
7 files changed, 201 insertions, 178 deletions
diff --git a/templates/devtest/fomantic-dropdown.tmpl b/templates/devtest/fomantic-dropdown.tmpl new file mode 100644 index 0000000000..57a7c1313e --- /dev/null +++ b/templates/devtest/fomantic-dropdown.tmpl @@ -0,0 +1,109 @@ +{{template "base/head" .}} +<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/devtest.css?v={{AssetVersion}}"> +<div class="page-content devtest ui container"> + <div> + <h2>Dropdown</h2> + <div> + <div class="ui dropdown tw-border tw-border-red tw-border-dashed" data-tooltip-content="border for demo purpose only"> + <span class="text">search-input & flex-item in menu</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu flex-items-menu"> + <div class="ui icon search input"><i class="icon">{{svg "octicon-search"}}</i><input type="text" value="search input in menu"></div> + <div class="item"><input type="radio">item</div> + <div class="item"><input type="radio">item</div> + </div> + </div> + <div class="ui search selection dropdown"> + <span class="text">search ...</span> + <input name="value" class="search"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{svg "octicon-x" 14 "remove icon"}} + <div class="menu"> + <div class="item">item</div> + </div> + </div> + <div class="ui multiple selection dropdown"> + <input class="hidden" value="1"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{svg "octicon-x" 14 "remove icon"}} + <div class="default text">empty multiple dropdown</div> + <div class="menu"> + <div class="item">item</div> + </div> + </div> + <div class="ui multiple clearable search selection dropdown"> + <input type="hidden" value="1"> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + {{svg "octicon-x" 14 "remove icon"}} + <div class="default text">clearable search dropdown</div> + <div class="menu"> + <div class="item" data-value="1">item</div> + </div> + </div> + <div class="ui buttons"> + <button class="ui button">Button with Dropdown</button> + <div class="ui dropdown button icon"> + {{svg "octicon-triangle-down"}} + <div class="menu"> + <div class="item">item</div> + </div> + </div> + </div> + </div> + + <h2>Selection</h2> + <div> + {{/* the "selection" class is optional, it will be added by JS automatically */}} + <select class="ui dropdown selection ellipsis-items-nowrap"> + <option>a</option> + <option>abcdefuvwxyz</option> + <option>loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong</option> + </select> + <select class="ui dropdown ellipsis-items-nowrap tw-max-w-[8em]"> + <option>loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong</option> + <option>abcdefuvwxyz</option> + <option>a</option> + </select> + </div> + <h2>Dropdown Button (demo only without menu)</h2> + <div> + <div class="ui dropdown mini button"> + <span class="text">mini dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui dropdown tiny button"> + <span class="text">tiny dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui button dropdown"> + <span class="text">button dropdown</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + </div> + + <div> + <div class="ui dropdown mini compact button"> + <span class="text">mini compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui dropdown tiny compact button"> + <span class="text">tiny compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + <div class="ui button compact dropdown"> + <span class="text">button compact</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + </div> + + <div> + <hr> + <div class="ui tiny button">Other button align with ...</div> + <div class="ui dropdown tiny button"> + <span class="text">... Dropdown Button</span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + </div> + </div> + </div> +</div> +{{template "base/footer" .}} diff --git a/templates/devtest/gitea-ui.tmpl b/templates/devtest/gitea-ui.tmpl index 3b13c13be8..ea293fd3b4 100644 --- a/templates/devtest/gitea-ui.tmpl +++ b/templates/devtest/gitea-ui.tmpl @@ -180,94 +180,6 @@ <input type="text" placeholder="place holder"> </div> </div> - - <h2>Dropdown with SVG</h2> - <div> - <div class="ui dropdown tw-border tw-border-red tw-border-dashed" data-tooltip-content="border for demo purpose only"> - <span class="text">search-input & flex-item in menu</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - <div class="menu flex-items-menu"> - <div class="ui icon search input"><i class="icon">{{svg "octicon-search"}}</i><input type="text" value="search input in menu"></div> - <div class="item"><input type="radio">item</div> - <div class="item"><input type="radio">item</div> - </div> - </div> - <div class="ui search selection dropdown"> - <span class="text">search ...</span> - <input name="value" class="search"> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - {{svg "octicon-x" 14 "remove icon"}} - <div class="menu"> - <div class="item">item</div> - </div> - </div> - <div class="ui multiple selection dropdown"> - <input class="hidden" value="1"> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - {{svg "octicon-x" 14 "remove icon"}} - <div class="default text">empty multiple dropdown</div> - <div class="menu"> - <div class="item">item</div> - </div> - </div> - <div class="ui multiple clearable search selection dropdown"> - <input type="hidden" value="1"> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - {{svg "octicon-x" 14 "remove icon"}} - <div class="default text">clearable search dropdown</div> - <div class="menu"> - <div class="item" data-value="1">item</div> - </div> - </div> - <div class="ui buttons"> - <button class="ui button">Button with Dropdown</button> - <div class="ui dropdown button icon"> - {{svg "octicon-triangle-down"}} - <div class="menu"> - <div class="item">item</div> - </div> - </div> - </div> - </div> - - <div> - <div class="ui dropdown mini button"> - <span class="text">mini dropdown</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - <div class="ui dropdown tiny button"> - <span class="text">tiny dropdown</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - <div class="ui button dropdown"> - <span class="text">button dropdown</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - </div> - - <div> - <div class="ui dropdown mini compact button"> - <span class="text">mini compact</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - <div class="ui dropdown tiny compact button"> - <span class="text">tiny compact</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - <div class="ui button compact dropdown"> - <span class="text">button compact</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - </div> - - <div> - <hr> - <div class="ui tiny button">Button align with ...</div> - <div class="ui dropdown tiny button"> - <span class="text">... Dropdown Button</span> - {{svg "octicon-triangle-down" 14 "dropdown icon"}} - </div> - </div> </div> <div> diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index 8f58826c6a..c4f73875f2 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -69,7 +69,7 @@ <div class="js-branch-tag-selector {{if .ContainerClasses}}{{.ContainerClasses}}{{end}}"> {{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}} - <div class="ui dropdown custom branch-selector-dropdown"> + <div class="ui dropdown custom branch-selector-dropdown ellipsis-items-nowrap"> <div class="ui button branch-dropdown-button"> <span class="flex-text-block gt-ellipsis"> {{if .release}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index c0d833a187..34f47b7d89 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -128,107 +128,109 @@ {{if .IsGenerated}}<div class="fork-flag">{{ctx.Locale.Tr "repo.generated_from"}} <a href="{{(.TemplateRepo ctx).Link}}">{{(.TemplateRepo ctx).FullName}}</a></div>{{end}} </div> {{end}} - <overflow-menu class="ui container secondary pointing tabular top attached borderless menu tw-pt-0 tw-my-0"> - {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} - <div class="overflow-menu-items"> - {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} - <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}"> - {{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}} - </a> - {{end}} - - {{if .Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} - <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues"> - {{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}} - {{if .Repository.NumOpenIssues}} - <span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span> - {{end}} + <div class="ui container"> + <overflow-menu class="ui secondary pointing menu"> + {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}} + <div class="overflow-menu-items"> + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}} + <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}"> + {{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}} </a> - {{end}} + {{end}} - {{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalTracker}} - <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer"> - {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues"}} - </a> - {{end}} + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} + <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues"> + {{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues"}} + {{if .Repository.NumOpenIssues}} + <span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span> + {{end}} + </a> + {{end}} - {{if and .Repository.CanEnablePulls (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests)}} - <a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls"> - {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}} - {{if .Repository.NumOpenPulls}} - <span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span> - {{end}} - </a> - {{end}} + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalTracker}} + <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer"> + {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.issues"}} + </a> + {{end}} - {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}} - <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions"> - {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} - {{if .Repository.NumOpenActionRuns}} - <span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span> - {{end}} - </a> - {{end}} + {{if and .Repository.CanEnablePulls (.Permission.CanRead ctx.Consts.RepoUnitTypePullRequests)}} + <a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls"> + {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "repo.pulls"}} + {{if .Repository.NumOpenPulls}} + <span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span> + {{end}} + </a> + {{end}} - {{if .Permission.CanRead ctx.Consts.RepoUnitTypePackages}} - <a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item"> - {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}} - </a> - {{end}} + {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeActions)}} + <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions"> + {{svg "octicon-play"}} {{ctx.Locale.Tr "actions.actions"}} + {{if .Repository.NumOpenActionRuns}} + <span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span> + {{end}} + </a> + {{end}} - {{$projectsUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeProjects}} - {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}} - <a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item"> - {{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project_board"}} - {{if .Repository.NumOpenProjects}} - <span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span> - {{end}} - </a> - {{end}} + {{if .Permission.CanRead ctx.Consts.RepoUnitTypePackages}} + <a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item"> + {{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}} + </a> + {{end}} - {{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} - <a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases"> - {{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}} - {{if .NumReleases}} - <span class="ui small label">{{CountFmt .NumReleases}}</span> - {{end}} - </a> - {{end}} + {{$projectsUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeProjects}} + {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead ctx.Consts.RepoUnitTypeProjects) ($projectsUnit.ProjectsConfig.IsProjectsAllowed "repo")}} + <a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item"> + {{svg "octicon-project"}} {{ctx.Locale.Tr "repo.project_board"}} + {{if .Repository.NumOpenProjects}} + <span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span> + {{end}} + </a> + {{end}} - {{if .Permission.CanRead ctx.Consts.RepoUnitTypeWiki}} - <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki"> - {{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}} + {{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} + <a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases"> + {{svg "octicon-tag"}} {{ctx.Locale.Tr "repo.releases"}} + {{if .NumReleases}} + <span class="ui small label">{{CountFmt .NumReleases}}</span> + {{end}} </a> - {{end}} + {{end}} - {{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalWiki}} - <a class="item" href="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer"> - {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}} - </a> - {{end}} + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeWiki}} + <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki"> + {{svg "octicon-book"}} {{ctx.Locale.Tr "repo.wiki"}} + </a> + {{end}} - {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} - <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity"> - {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}} - </a> - {{end}} + {{if .Permission.CanRead ctx.Consts.RepoUnitTypeExternalWiki}} + <a class="item" href="{{(.Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer"> + {{svg "octicon-link-external"}} {{ctx.Locale.Tr "repo.wiki"}} + </a> + {{end}} - {{template "custom/extra_tabs" .}} + {{if and (.Permission.CanReadAny ctx.Consts.RepoUnitTypePullRequests ctx.Consts.RepoUnitTypeIssues ctx.Consts.RepoUnitTypeReleases) (not .IsEmptyRepo)}} + <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity"> + {{svg "octicon-pulse"}} {{ctx.Locale.Tr "repo.activity"}} + </a> + {{end}} - {{if .Permission.IsAdmin}} - <span class="item-flex-space"></span> + {{template "custom/extra_tabs" .}} + + {{if .Permission.IsAdmin}} + <span class="item-flex-space"></span> + <a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings"> + {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} + </a> + {{end}} + </div> + {{else if .Permission.IsAdmin}} + <div class="overflow-menu-items"> <a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings"> {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} </a> - {{end}} - </div> - {{else if .Permission.IsAdmin}} - <div class="overflow-menu-items"> - <a class="{{if .PageIsRepoSettings}}active {{end}} item" href="{{.RepoLink}}/settings"> - {{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}} - </a> - </div> - {{end}} - </overflow-menu> + </div> + {{end}} + </overflow-menu> + </div> <div class="ui tabs divider"></div> </div> diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl index e9e5574cd7..cbf7929fdb 100644 --- a/templates/repo/issue/branch_selector_field.tmpl +++ b/templates/repo/issue/branch_selector_field.tmpl @@ -4,7 +4,7 @@ <form method="post" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref" id="update_issueref_form"> {{$.CsrfTokenHtml}} </form> -<div class="ui dropdown select-branch branch-selector-dropdown {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" +<div class="ui dropdown select-branch branch-selector-dropdown ellipsis-items-nowrap {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" data-no-results="{{ctx.Locale.Tr "no_results_found"}}" {{if not .Issue}}data-for-new-issue="true"{{end}} > diff --git a/templates/repo/issue/view_content/reference_issue_dialog.tmpl b/templates/repo/issue/view_content/reference_issue_dialog.tmpl index c7a471f55e..d6c9081001 100644 --- a/templates/repo/issue/view_content/reference_issue_dialog.tmpl +++ b/templates/repo/issue/view_content/reference_issue_dialog.tmpl @@ -7,7 +7,7 @@ {{.CsrfTokenHtml}} <div class="field"> <label><strong>{{ctx.Locale.Tr "repository"}}</strong></label> - <div class="ui search selection dropdown issue_reference_repository_search"> + <div class="ui search selection dropdown issue_reference_repository_search ellipsis-items-nowrap"> <div class="default text gt-ellipsis">{{.Repository.FullName}}</div> <div class="menu"></div> </div> diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 40617021d9..b94c202f16 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -345,7 +345,7 @@ <div class="inline field"> {{$unitInternalWiki := .Repository.MustGetUnit ctx ctx.Consts.RepoUnitTypeWiki}} <label>{{ctx.Locale.Tr "repo.settings.default_wiki_everyone_access"}}</label> - <select name="default_wiki_everyone_access" class="ui dropdown"> + <select name="default_wiki_everyone_access" class="ui selection dropdown"> {{/* everyone access mode is different from others, none means it is unset and won't be applied */}} <option value="none" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 0) "selected"}}>{{ctx.Locale.Tr "settings.permission_not_set"}}</option> <option value="read" {{Iif (eq $unitInternalWiki.EveryoneAccessMode 1) "selected"}}>{{ctx.Locale.Tr "settings.permission_read"}}</option> |