Skip to content

Commit

Permalink
Replace fomantic popup module with tippy.js (go-gitea#20428)
Browse files Browse the repository at this point in the history
- replace fomantic popup module with tippy.js
- fix chaining and add comment
- add 100ms delay to tooltips
- stopwatch improvments, raise default maxWidth
- update web_src/js/features/common-global.js
- use type=submit instead of js
  • Loading branch information
silverwind authored and Sysoev, Vladimir committed Aug 10, 2022
1 parent 08daa7b commit f491377
Show file tree
Hide file tree
Showing 28 changed files with 199 additions and 2,129 deletions.
2 changes: 1 addition & 1 deletion templates/admin/user/edit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
</div>
</div>
<div class="inline field"{{if DisableGitHooks}} hidden{{end}}>
<div class="ui checkbox tooltip" data-content="{{.locale.Tr "admin.users.allow_git_hook_tooltip"}}" data-variation="very wide">
<div class="ui checkbox tooltip" data-content="{{.locale.Tr "admin.users.allow_git_hook_tooltip"}}">
<label><strong>{{.locale.Tr "admin.users.allow_git_hook"}}</strong></label>
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}>
</div>
Expand Down
6 changes: 4 additions & 2 deletions templates/base/head_navbar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
<span class="sr-mobile-only">{{.locale.Tr "active_stopwatch"}}</span>
</span>
</a>
<div class="ui popup very wide">
<div class="active-stopwatch-popup hide">
<div class="df ac">
<a class="stopwatch-link df ac" href="{{.ActiveStopwatch.IssueLink}}">
{{svg "octicon-issue-opened"}}
{{svg "octicon-issue-opened" 16 "mr-3"}}
<span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span>
<span class="ui primary label stopwatch-time my-0 mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}">
{{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}}
Expand All @@ -98,6 +98,7 @@
<form class="stopwatch-commit" method="POST" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle">
{{.CsrfTokenHtml}}
<button
type="submit"
class="ui button mini compact basic icon fitted tooltip"
data-content="{{.locale.Tr "repo.issues.stop_tracking"}}"
data-position="top right"
Expand All @@ -106,6 +107,7 @@
<form class="stopwatch-cancel" method="POST" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel">
{{.CsrfTokenHtml}}
<button
type="submit"
class="ui button mini compact basic icon fitted tooltip"
data-content="{{.locale.Tr "repo.issues.cancel_tracking"}}"
data-position="top right"
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/commit_statuses.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<a class="ui link commit-statuses-trigger">{{template "repo/commit_status" .Status}}</a>
<div class="ui popup very wide fixed basic commit-statuses">
<div class="ui commit-statuses-popup commit-statuses hide">
<div class="ui relaxed list divided">
{{range .Statuses}}
<div class="ui item singular-status df">
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/diff/stats.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{Add .file.Addition .file.Deletion}}
<span class="diff-stats-bar tooltip mx-3" data-content="{{.root.locale.Tr "repo.diff.stats_desc_file" (Add .file.Addition .file.Deletion) .file.Addition .file.Deletion | Str2html}}" data-variation="wide">
<span class="diff-stats-bar tooltip mx-3" data-content="{{.root.locale.Tr "repo.diff.stats_desc_file" (Add .file.Addition .file.Deletion) .file.Addition .file.Deletion | Str2html}}">
<div class="diff-stats-add-bar" style="width: {{DiffStatsWidth .file.Addition .file.Deletion}}%"></div>
</span>
2 changes: 1 addition & 1 deletion templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
{{else if and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0)}}
data-content="{{$.locale.Tr "repo.fork_from_self"}}"
{{end}}
data-position="top center" data-variation="tiny" tabindex="0">
data-position="top center" tabindex="0">
<a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button"
{{if not $.CanSignedUserFork}}
{{if gt (len $.UserAndOrgForks) 1}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/view_content/add_reaction.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="header">{{ .ctx.locale.Tr "repo.pick_reaction"}}</div>
<div class="divider"></div>
{{range $value := AllowedReactions}}
<div class="item reaction" data-content="{{$value}}">{{ReactionToEmoji $value}}</div>
<div class="item reaction tooltip" data-content="{{$value}}">{{ReactionToEmoji $value}}</div>
{{end}}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/settings/deploy_keys.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</button>
</div>
<div class="left floated content">
<i class="{{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}>{{svg "octicon-key" 32}}</i>
<i class="tooltip{{if .HasRecentActivity}} green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</i>
</div>
<div class="content">
<strong>{{.Name}}</strong>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/settings/webhook/history.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="right menu">
<form class="item" action="{{$.Link}}/replay/{{.UUID}}" method="post">
{{$.CsrfTokenHtml}}
<button class="ui tiny button tooltip" data-content="{{$.locale.Tr "repo.settings.webhook.replay.description"}}" data-variation="inverted tiny">{{svg "octicon-sync"}}</button>
<button class="ui tiny button tooltip" data-content="{{$.locale.Tr "repo.settings.webhook.replay.description"}}">{{svg "octicon-sync"}}</button>
</form>
</div>
{{end}}
Expand Down
22 changes: 6 additions & 16 deletions templates/repo/view_file.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,12 @@
{{end}}
</tbody>
</table>
<div class="code-line-menu ui fluid popup transition hidden">
<div class="ui column relaxed equal height">
<div class="column">
{{if $.Permission.CanRead $.UnitTypeIssues}}
<div class="ui link list">
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{.Repository.HTMLURL}}{{printf "/src/commit/" }}{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}" rel="nofollow noindex">{{.locale.Tr "repo.issues.context.reference_issue"}}</a>
</div>
{{end}}
<div class="ui link list">
<a class="item view_git_blame" href="{{.Repository.HTMLURL}}/blame/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{.locale.Tr "repo.view_git_blame"}}</a>
</div>
<div class="ui link list">
<a data-clipboard-text="{{.Repository.HTMLURL}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}" class="item copy-line-permalink">{{.locale.Tr "repo.file_copy_permalink"}}</a>
</div>
</div>
</div>
<div class="code-line-menu ui vertical pointing menu hide">
{{if $.Permission.CanRead $.UnitTypeIssues}}
<a class="item ref-in-new-issue" href="{{.RepoLink}}/issues/new?body={{.Repository.HTMLURL}}{{printf "/src/commit/" }}{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}" rel="nofollow noindex">{{.locale.Tr "repo.issues.context.reference_issue"}}</a>
{{end}}
<a class="item view_git_blame" href="{{.Repository.HTMLURL}}/blame/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{.locale.Tr "repo.view_git_blame"}}</a>
<a class="item copy-line-permalink" data-url="{{.Repository.HTMLURL}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{.locale.Tr "repo.file_copy_permalink"}}</a>
</div>
{{end}}
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/user/settings/applications.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{{$.locale.Tr "settings.delete_token"}}
</button>
</div>
<i class="big send icon {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.token_state_desc"}}" data-variation="inverted tiny"{{end}}></i>
<i class="big send icon tooltip{{if .HasRecentActivity}} green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.token_state_desc"}}"{{end}}></i>
<div class="content">
<strong>{{.Name}}</strong>
<div class="activity meta">
Expand Down
2 changes: 1 addition & 1 deletion templates/user/settings/keys_principal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{$.locale.Tr "settings.delete_key"}}
</button>
</div>
<i class="big send icon {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.principal_state_desc"}}" data-variation="inverted tiny"{{end}}></i>
<i class="big send icon tooltip{{if .HasRecentActivity}} green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.principal_state_desc"}}"{{end}}></i>
<div class="content">
<strong>{{.Name}}</strong>
<div class="activity meta">
Expand Down
2 changes: 1 addition & 1 deletion templates/user/settings/keys_ssh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

</div>
<div class="left floated content">
<span class="{{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.key_state_desc"}}" data-variation="inverted tiny"{{end}}>{{svg "octicon-key" 32}}</span>
<span class="tooltip{{if .HasRecentActivity}} green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span>
</div>
<div class="content">
{{if .Verified}}
Expand Down
Loading

0 comments on commit f491377

Please sign in to comment.