Skip to content
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

Attach a tooltip to the action control button #24595

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ milestones = Milestones

ok = OK
cancel = Cancel
rerun = Re-run
save = Save
add = Add
add_all = Add All
Expand Down
10 changes: 9 additions & 1 deletion templates/repo/actions/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

<div class="page-content repository">
{{template "repo/header" .}}
<div id="repo-action-view" data-run-index="{{.RunIndex}}" data-job-index="{{.JobIndex}}" data-actions-url="{{.ActionsURL}}"></div>
<div id="repo-action-view"
data-run-index="{{.RunIndex}}"
data-job-index="{{.JobIndex}}"
data-actions-url="{{.ActionsURL}}"
data-locale-approve="{{.locale.Tr "repo.diff.review.approve"}}"
data-locale-cancel="{{.locale.Tr "cancel"}}"
data-locale-rerun="{{.locale.Tr "rerun"}}"
>
</div>
</div>

{{template "base/footer" .}}
12 changes: 9 additions & 3 deletions web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<div class="action-title">
{{ run.title }}
</div>
<button class="action-control-button text green" @click="approveRun()" v-if="run.canApprove">
<button :data-tooltip-content="locale.approve" class="action-control-button text green" @click="approveRun()" v-if="run.canApprove">
<SvgIcon name="octicon-play" :size="20"/>
</button>
<button class="action-control-button text red" @click="cancelRun()" v-else-if="run.canCancel">
<button :data-tooltip-content="locale.cancel" class="action-control-button text red" @click="cancelRun()" v-else-if="run.canCancel">
<SvgIcon name="octicon-x-circle-fill" :size="20"/>
</button>
<button class="action-control-button text green" @click="rerun()" v-else-if="run.canRerun">
<button :data-tooltip-content="locale.rerun" class="action-control-button text green" @click="rerun()" v-else-if="run.canRerun">
<SvgIcon name="octicon-sync" :size="20"/>
</button>
</div>
Expand Down Expand Up @@ -93,6 +93,7 @@ const sfc = {
runIndex: String,
jobIndex: String,
actionsURL: String,
locale: Object,
},

data() {
Expand Down Expand Up @@ -314,6 +315,11 @@ export function initRepositoryActionView() {
runIndex: el.getAttribute('data-run-index'),
jobIndex: el.getAttribute('data-job-index'),
actionsURL: el.getAttribute('data-actions-url'),
locale: {
approve: el.getAttribute('data-locale-approve'),
cancel: el.getAttribute('data-locale-cancel'),
rerun: el.getAttribute('data-locale-rerun'),
}
});
view.mount(el);
}
Expand Down