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

Add UI to delete tracked times #14100

Merged
merged 40 commits into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
99d977f
add DeleteTime issue action
noerw Dec 21, 2020
864651a
store time ID for CommentTypeAddTimeManual & StopTracking
noerw Dec 21, 2020
083bb1e
add template to render delete time button on comments
noerw Dec 21, 2020
a322b60
code review
noerw Dec 22, 2020
0ee2dce
make linter happy
noerw Dec 22, 2020
0bfc614
Update routers/repo/issue_timetrack.go
noerw Dec 22, 2020
3cab4a8
Update routers/repo/issue_timetrack.go
noerw Dec 22, 2020
ba50f18
Merge branch 'master' into delete-times-ui
6543 Dec 22, 2020
7470f8a
add confirmation dialog
noerw Dec 22, 2020
78f4b2c
revert vscode shenanigans
noerw Dec 22, 2020
dd0a7d7
make linter happy
noerw Dec 22, 2020
6a37c2f
(╯°□°)╯︵ ┻━┻
noerw Dec 22, 2020
3548da4
Merge branch 'master' into delete-times-ui
6543 Dec 22, 2020
7d2f0d3
Add migration
6543 Dec 22, 2020
c8e6271
Merge branch 'master' into delete-times-ui
noerw Dec 24, 2020
d360901
rename to comments_delete_time template
noerw Dec 24, 2020
e0a11f4
rectangular button
noerw Dec 24, 2020
c97d667
submit add time on enter
noerw Dec 24, 2020
0bd16c9
revert -> Revert Time Log
noerw Dec 24, 2020
acf5a84
Merge branch 'master' into delete-times-ui
6543 Dec 27, 2020
209304e
revert -> delete, trashcan icon
noerw Jan 10, 2021
b655885
move migration for curr master
noerw Jan 10, 2021
1f6f28a
Merge remote-tracking branch 'origin/master' into delete-times-ui
noerw Jan 10, 2021
432127b
Merge remote-tracking branch 'noerw/delete-times-ui' into delete-time…
noerw Jan 10, 2021
12ba398
Merge remote-tracking branch 'origin/master' into delete-times-ui
noerw Jan 12, 2021
c0396e5
fixup! Merge remote-tracking branch 'origin/master' into delete-times-ui
noerw Jan 12, 2021
d35eb22
fixup! Merge remote-tracking branch 'origin/master' into delete-times-ui
noerw Jan 12, 2021
a1260a3
Merge remote-tracking branch 'origin/master' into delete-times-ui
noerw Jan 13, 2021
f2c8542
Merge branch 'master' into delete-times-ui
noerw Jan 16, 2021
498f15f
Merge branch 'master' into delete-times-ui
6543 Jan 19, 2021
18d62ef
Merge branch 'master' into delete-times-ui
6543 Jan 23, 2021
a2b0b66
Merge branch 'master' into delete-times-ui
6543 Feb 4, 2021
2041c93
migrate to chi
6543 Feb 4, 2021
0955919
Merge branch 'master' into delete-times-ui
6543 Feb 9, 2021
fbf4a1d
add
6543 Feb 12, 2021
4543349
Merge branch 'master' into delete-times-ui
6543 Feb 12, 2021
040cea4
Merge branch 'master' into delete-times-ui
6543 Feb 15, 2021
bc0fc82
Merge branch 'master' into delete-times-ui
6543 Feb 19, 2021
2a2dd93
Flash Success
6543 Feb 19, 2021
574fad2
imports
6543 Feb 19, 2021
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 @@ -1136,6 +1136,7 @@ issues.tracking_already_started = `You have already started time tracking on <a
issues.stop_tracking = Stop
issues.stop_tracking_history = `stopped working %s`
issues.add_time = Manually Add Time
issues.del_time = Revert Time Log
issues.add_time_short = Add Time
issues.add_time_cancel = Cancel
issues.add_time_history = `added spent time %s`
Expand Down
21 changes: 14 additions & 7 deletions templates/repo/issue/view_content/delete_time.tmpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{{ if .comment.Time }} <!-- compatibility with pre v1.14 -->
{{ if .comment.Time }} {{/* compatibility with time comments made before v1.14 */}}
{{ if (not .comment.Time.Deleted) }}
{{ if (or .ctx.IsAdmin (and .ctx.IsSigned (eq .ctx.SignedUserID .comment.PosterID))) }}
<span class="ui float right">
<form method="POST" action="{{.ctx.RepoLink}}/issues/{{.ctx.Issue.Index}}/times/{{.comment.TimeID}}/delete">
{{.ctx.CsrfTokenHtml}}
<button type="submit" class="ui icon button circular small">
<i class="icon delete"></i>
</button>
</form>
<div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}">
<form method="POST" class="delete-time-form" action="{{.ctx.RepoLink}}/issues/{{.ctx.Issue.Index}}/times/{{.comment.TimeID}}/delete">
{{.ctx.CsrfTokenHtml}}
</form>
<div class="header">{{.ctx.i18n.Tr "repo.issues.del_time"}}</div>
<div class="actions">
<div class="ui red approve button">{{.ctx.i18n.Tr "repo.issues.context.delete"}}</div>
<div class="ui cancel button">{{.ctx.i18n.Tr "repo.issues.add_time_cancel"}}</div>
</div>
</div>
<button class="ui icon button circular small issue-delete-time poping up" data-id="{{.comment.Time.ID}}" data-content='{{.ctx.i18n.Tr "repo.issues.del_time"}}' data-position="top right" data-variation="small inverted">
<i class="icon delete"></i>
</button>
</span>
{{end}}
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
{{end}}
<div class="ui buttons two fluid">
<button class="ui button poping up issue-start-time" data-content='{{.i18n.Tr "repo.issues.start_tracking"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.start_tracking_short"}}</button>
<div class="ui mini modal">
<div class="ui mini modal issue-start-time-modal">
<div class="header">{{.i18n.Tr "repo.issues.add_time"}}</div>
<div class="content">
<form method="POST" id="add_time_manual_form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/add" class="ui action input fluid">
Expand Down
45 changes: 27 additions & 18 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/* exported deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */

import './publicpath.js';

import Vue from 'vue';
import {htmlEscape} from 'escape-goat';
import { htmlEscape } from 'escape-goat';
import 'jquery.are-you-sure';
import './vendor/semanticdropdown.js';

import initMigration from './features/migration.js';
import Vue from 'vue';
import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
import initClipboard from './features/clipboard.js';
import { createCodeEditor, createMonaco } from './features/codeeditor.js';
import createColorPicker from './features/colorpicker.js';
import initContextPopups from './features/contextpopup.js';
import createDropzone from './features/dropzone.js';
import initGitGraph from './features/gitgraph.js';
import initClipboard from './features/clipboard.js';
import initHeatmap from './features/heatmap.js';
import initMigration from './features/migration.js';
import { initNotificationCount, initNotificationsTable } from './features/notification.js';
import initProject from './features/projects.js';
import initServiceWorker from './features/serviceworker.js';
import initTableSort from './features/tablesort.js';
import attachTribute from './features/tribute.js';
import initMarkdownAnchors from './markdown/anchors.js';
import renderMarkdownContent from './markdown/content.js';
import attachTribute from './features/tribute.js';
import createColorPicker from './features/colorpicker.js';
import createDropzone from './features/dropzone.js';
import initTableSort from './features/tablesort.js';
import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
import {initNotificationsTable, initNotificationCount} from './features/notification.js';
import {createCodeEditor, createMonaco} from './features/codeeditor.js';
import {svg, svgs} from './svg.js';
import {stripTags} from './utils.js';
import './publicpath.js';
noerw marked this conversation as resolved.
Show resolved Hide resolved
import { svg, svgs } from './svg.js';
import { stripTags } from './utils.js';
import './vendor/semanticdropdown.js';



const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;

Expand Down Expand Up @@ -3117,7 +3117,7 @@ function initVueApp() {

function initIssueTimetracking() {
$(document).on('click', '.issue-add-time', () => {
$('.mini.modal').modal({
$('.issue-start-time-modal').modal({
duration: 200,
onApprove() {
$('#add_time_manual_form').trigger('submit');
Expand All @@ -3130,6 +3130,15 @@ function initIssueTimetracking() {
$(document).on('click', '.issue-cancel-time', () => {
$('#cancel_stopwatch_form').trigger('submit');
});
$(document).on('click', 'button.issue-delete-time', function () {
const sel = `.issue-delete-time-modal[data-id="${$(this).data('id')}"]`
$(sel).modal({
duration: 200,
onApprove() {
$(`${sel} form`).trigger('submit');
}
}).modal('show');
});
}

function initFilterBranchTagDropdown(selector) {
Expand Down