mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 18:54:43 +01:00
stopwatch notif: check if timetracking is enabled (#14750)
fixes #14435
This commit is contained in:
parent
aa4f9180e4
commit
91424fff3d
3 changed files with 9 additions and 2 deletions
|
@ -174,6 +174,9 @@ func NewFuncMap() []template.FuncMap {
|
||||||
"UseServiceWorker": func() bool {
|
"UseServiceWorker": func() bool {
|
||||||
return setting.UI.UseServiceWorker
|
return setting.UI.UseServiceWorker
|
||||||
},
|
},
|
||||||
|
"EnableTimetracking": func() bool {
|
||||||
|
return setting.Service.EnableTimetracking
|
||||||
|
},
|
||||||
"FilenameIsImage": func(filename string) bool {
|
"FilenameIsImage": func(filename string) bool {
|
||||||
mimeType := mime.TypeByExtension(filepath.Ext(filename))
|
mimeType := mime.TypeByExtension(filepath.Ext(filename))
|
||||||
return strings.HasPrefix(mimeType, "image/")
|
return strings.HasPrefix(mimeType, "image/")
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
MaxTimeout: {{NotificationSettings.MaxTimeout}},
|
MaxTimeout: {{NotificationSettings.MaxTimeout}},
|
||||||
EventSourceUpdateTime: {{NotificationSettings.EventSourceUpdateTime}},
|
EventSourceUpdateTime: {{NotificationSettings.EventSourceUpdateTime}},
|
||||||
},
|
},
|
||||||
|
EnableTimetracking: {{if EnableTimetracking}}true{{else}}false{{end}},
|
||||||
PageIsProjects: {{if .PageIsProjects }}true{{else}}false{{end}},
|
PageIsProjects: {{if .PageIsProjects }}true{{else}}false{{end}},
|
||||||
{{if .RequireTribute}}
|
{{if .RequireTribute}}
|
||||||
tributeValues: Array.from(new Map([
|
tributeValues: Array.from(new Map([
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import prettyMilliseconds from 'pretty-ms';
|
import prettyMilliseconds from 'pretty-ms';
|
||||||
const {AppSubUrl, csrf, NotificationSettings} = window.config;
|
const {AppSubUrl, csrf, NotificationSettings, EnableTimetracking} = window.config;
|
||||||
|
|
||||||
let updateTimeInterval = null; // holds setInterval id when active
|
let updateTimeInterval = null; // holds setInterval id when active
|
||||||
|
|
||||||
export async function initStopwatch() {
|
export async function initStopwatch() {
|
||||||
const stopwatchEl = $('.active-stopwatch-trigger');
|
if (!EnableTimetracking) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopwatchEl = $('.active-stopwatch-trigger');
|
||||||
stopwatchEl.removeAttr('href'); // intended for noscript mode only
|
stopwatchEl.removeAttr('href'); // intended for noscript mode only
|
||||||
stopwatchEl.popup({
|
stopwatchEl.popup({
|
||||||
position: 'bottom right',
|
position: 'bottom right',
|
||||||
|
|
Loading…
Reference in a new issue