summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorJonas Franz <info@jonasfranz.software>2017-09-12 08:48:13 +0200
committerLauris BH <lauris@nix.lv>2017-09-12 09:48:13 +0300
commit5ccecb44adddf17e1a3ec8ae6e1ad75cb0ff94e6 (patch)
treee7ab5e7965be4d1ad92655c74d0ce8fbc0954df2 /templates
parent69dfe43ffc865bfa9c7a81375752d064a0013df3 (diff)
downloadgitea-5ccecb44adddf17e1a3ec8ae6e1ad75cb0ff94e6.tar.gz
gitea-5ccecb44adddf17e1a3ec8ae6e1ad75cb0ff94e6.zip
Feature: Timetracking (#2211)
* Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'templates')
-rw-r--r--templates/admin/config.tmpl4
-rw-r--r--templates/install.tmpl6
-rw-r--r--templates/repo/issue/view_content/comments.tmpl44
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl101
-rw-r--r--templates/repo/settings/options.tmpl19
5 files changed, 154 insertions, 20 deletions
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index f9038e1425..b57b1847f6 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -132,6 +132,10 @@
<dd><i class="fa fa{{if .Service.DefaultKeepEmailPrivate}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.default_allow_create_organization"}}</dt>
<dd><i class="fa fa{{if .Service.DefaultAllowCreateOrganization}}-check{{end}}-square-o"></i></dd>
+ <dt>{{.i18n.Tr "admin.config.default_enable_timetracking"}}</dt>
+ <dd><i class="fa fa{{if .Service.DefaultEnableTimetracking}}-check{{end}}-square-o"></i></dd>
+ <dt>{{.i18n.Tr "admin.config.default_allow_only_contributors_to_track_time"}}</dt>
+ <dd><i class="fa fa{{if .Service.DefaultAllowOnlyContributorsToTrackTime}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.no_reply_address"}}</dt>
<dd>{{if .Service.NoReplyAddress}}{{.Service.NoReplyAddress}}{{else}}-{{end}}</dd>
<div class="ui divider"></div>
diff --git a/templates/install.tmpl b/templates/install.tmpl
index 5c6d1a9473..924eb2837c 100644
--- a/templates/install.tmpl
+++ b/templates/install.tmpl
@@ -231,6 +231,12 @@
</div>
</div>
<div class="inline field">
+ <div class="ui checkbox">
+ <label class="poping up" data-content="{{.i18n.Tr "install.default_enable_timetracking_popup"}}"><strong>{{.i18n.Tr "install.default_enable_timetracking"}}</strong></label>
+ <input name="default_enable_timetracking" type="checkbox" {{if .default_enable_timetracking}}checked{{end}}>
+ </div>
+ </div>
+ <div class="inline field">
<label for="no_reply_address">{{.i18n.Tr "install.no_reply_address"}}</label>
<input id="_no_reply_address" name="no_reply_address" value="{{.no_reply_address}}">
<span class="help">{{.i18n.Tr "install.no_reply_address_helper"}}</span>
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index c1b4e7f599..34609ceb31 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -1,7 +1,7 @@
{{range .Issue.Comments}}
{{ $createdStr:= TimeSince .Created $.Lang }}
- <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL -->
+ <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL -->
{{if eq .Type 0}}
<div class="comment" id="{{.HashTag}}">
<a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
@@ -58,6 +58,7 @@
{{end}}
</div>
</div>
+
{{else if eq .Type 1}}
<div class="event">
<span class="octicon octicon-primitive-dot"></span>
@@ -140,5 +141,46 @@
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
{{$.i18n.Tr "repo.issues.delete_branch_at" .CommitSHA $createdStr | Safe}}
</span>
+ {{else if eq .Type 12}}
+ <div class="event">
+ <span class="octicon octicon-primitive-dot"></span>
+ <a class="ui avatar image" href="{{.Poster.HomeLink}}">
+ <img src="{{.Poster.RelAvatarLink}}">
+ </a>
+ <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}</span>
+ </div>
+ {{else if eq .Type 13}}
+ <div class="event">
+ <span class="octicon octicon-primitive-dot"></span>
+ <a class="ui avatar image" href="{{.Poster.HomeLink}}">
+ <img src="{{.Poster.RelAvatarLink}}">
+ </a>
+ <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}</span>
+
+ <div class="detail">
+ <span class="octicon octicon-clock"></span>
+ <span class="text grey">{{.Content}}</span>
+ </div>
+ </div>
+ {{else if eq .Type 14}}
+ <div class="event">
+ <span class="octicon octicon-primitive-dot"></span>
+ <a class="ui avatar image" href="{{.Poster.HomeLink}}">
+ <img src="{{.Poster.RelAvatarLink}}">
+ </a>
+ <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.add_time_history" $createdStr | Safe}}</span>
+ <div class="detail">
+ <span class="octicon octicon-clock"></span>
+ <span class="text grey">{{.Content}}</span>
+ </div>
+ </div>
+ {{else if eq .Type 15}}
+ <div class="event">
+ <span class="octicon octicon-primitive-dot"></span>
+ <a class="ui avatar image" href="{{.Poster.HomeLink}}">
+ <img src="{{.Poster.RelAvatarLink}}">
+ </a>
+ <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}</span>
+ </div>
{{end}}
{{end}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 2c6149ed29..079c6f52ab 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -102,26 +102,93 @@
</div>
{{if $.IssueWatch}}
- <div class="ui divider"></div>
+ <div class="ui divider"></div>
- <div class="ui watching">
- <span class="text"><strong>{{.i18n.Tr "notification.notifications"}}</strong></span>
- <div>
- <form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/watch">
- <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}" />
- {{$.CsrfTokenHtml}}
- <button class="fluid ui button">
- {{if $.IssueWatch.IsWatching}}
- <i class="octicon octicon-mute"></i>
- {{.i18n.Tr "repo.issues.unsubscribe"}}
+ <div class="ui watching">
+ <span class="text"><strong>{{.i18n.Tr "notification.notifications"}}</strong></span>
+ <div>
+ <form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/watch">
+ <input type="hidden" name="watch" value="{{if $.IssueWatch.IsWatching}}0{{else}}1{{end}}" />
+ {{$.CsrfTokenHtml}}
+ <button class="fluid ui button">
+ {{if $.IssueWatch.IsWatching}}
+ <i class="octicon octicon-mute"></i>
+ {{.i18n.Tr "repo.issues.unsubscribe"}}
+ {{else}}
+ <i class="octicon octicon-unmute"></i>
+ {{.i18n.Tr "repo.issues.subscribe"}}
+ {{end}}
+ </button>
+ </form>
+ </div>
+ </div>
+ {{end}}
+ {{if .Repository.IsTimetrackerEnabled }}
+ {{if .CanUseTimetracker }}
+ <div class="ui divider"></div>
+ <div class="ui timetrack">
+ <span class="text"><strong>{{.i18n.Tr "repo.issues.tracker"}}</strong></span>
+ <div>
+ <form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/stopwatch/toggle" id="toggle_stopwatch_form">
+ {{$.CsrfTokenHtml}}
+ </form>
+ <form method="POST" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/times/stopwatch/cancel" id="cancel_stopwatch_form">
+ {{$.CsrfTokenHtml}}
+ </form>
+ {{if $.IsStopwatchRunning}}
+ <div class="ui buttons fluid stop-cancel">
+ <button onclick="this.disabled=true;toggleStopwatch()" class="ui button stop">{{.i18n.Tr "repo.issues.stop_tracking"}}</button>
+ <button onclick="this.disabled=true;cancelStopwatch()" class="ui negative button cancel">{{.i18n.Tr "repo.issues.cancel_tracking"}}</button>
+ </div>
{{else}}
- <i class="octicon octicon-unmute"></i>
- {{.i18n.Tr "repo.issues.subscribe"}}
+ {{if .HasUserStopwatch}}
+ <div class="ui warning message">
+ {{.i18n.Tr "repo.issues.tracking_already_started" .OtherStopwatchURL | Safe}}
+ </div>
+ {{end}}
+ <div class="ui buttons two fluid start-add">
+ <button onclick="this.disabled=true;toggleStopwatch()" class="ui button poping up start" data-content='{{.i18n.Tr "repo.issues.start_tracking"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.start_tracking_short"}}</button>
+ <button onclick="timeAddManual()" class="ui button green poping up add-time" data-content='{{.i18n.Tr "repo.issues.add_time"}}' data-position="top center" data-variation="small inverted">{{.i18n.Tr "repo.issues.add_time_short"}}</button>
+ <div class="ui mini 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">
+ {{$.CsrfTokenHtml}}
+ <input placeholder='{{.i18n.Tr "repo.issues.add_time_hours"}}' type="number" name="hours">
+ <input placeholder='{{.i18n.Tr "repo.issues.add_time_minutes"}}' type="number" name="minutes" class="ui compact">
+ </form>
+ </div>
+ <div class="actions">
+ <div class="ui green approve button">{{.i18n.Tr "repo.issues.add_time_short"}}</div>
+ <div class="ui red cancel button">{{.i18n.Tr "repo.issues.add_time_cancel"}}</div>
+ </div>
+ </div>
+ </div>
{{end}}
- </button>
- </form>
- </div>
- </div>
+ </div>
+ </div>
+ {{end}}
+ {{if gt (len .WorkingUsers) 0}}
+ <div class="ui divider"></div>
+ <div class="ui participants comments">
+ <span class="text"><strong>{{.i18n.Tr "repo.issues.time_spent_total"}}</strong></span>
+ <div>
+ {{range $user, $trackedtime := .WorkingUsers}}
+ <div class="comment">
+ <a class="avatar">
+ <img src="{{$user.RelAvatarLink}}">
+ </a>
+ <div class="content">
+ <a class="author">{{$user.DisplayName}}</a>
+ <div class="text">
+ {{$trackedtime}}
+ </div>
+ </div>
+ </div>
+ {{end}}
+ </div>
+ </div>
+ {{end}}
{{end}}
</div>
</div>
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 8a7ea218bc..b2b7fc9c3a 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -134,13 +134,28 @@
<div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box">
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}checked{{end}}/>
+ <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}checked{{end}}/>
<label>{{.i18n.Tr "repo.settings.use_internal_issue_tracker"}}</label>
</div>
</div>
+ <div class="field {{if (.Repository.UnitEnabled $.UnitTypeExternalTracker)}}disabled{{end}}" id="internal_issue_box">
+ <div class="field">
+ <div class="ui checkbox">
+ <input name="enable_timetracker" class="enable-system" data-target="#only_contributors" type="checkbox" {{if .Repository.IsTimetrackerEnabled}}checked{{end}}>
+ <label>{{.i18n.Tr "repo.settings.enable_timetracker"}}</label>
+ </div>
+ </div>
+ <div class="field {{if not .Repository.IsTimetrackerEnabled}}disabled{{end}}" id="only_contributors">
+ <div class="ui checkbox">
+
+ <input name="allow_only_contributors_to_track_time" type="checkbox" {{if .Repository.AllowOnlyContributorsToTrackTime}}checked{{end}}>
+ <label>{{.i18n.Tr "repo.settings.allow_only_contributors_to_track_time"}}</label>
+ </div>
+ </div>
+ </div>
<div class="field">
<div class="ui radio checkbox">
- <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.UnitTypeExternalTracker}}checked{{end}}/>
+ <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.UnitTypeExternalTracker}}checked{{end}}/>
<label>{{.i18n.Tr "repo.settings.use_external_issue_tracker"}}</label>
</div>
</div>