diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/src/main/coffee/common/inputs.coffee | 10 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/coffee/common/inputs.coffee b/server/sonar-web/src/main/coffee/common/inputs.coffee index 452636f9cff..92c5c2e7ac2 100644 --- a/server/sonar-web/src/main/coffee/common/inputs.coffee +++ b/server/sonar-web/src/main/coffee/common/inputs.coffee @@ -1,5 +1,8 @@ $ = jQuery +window.SS = if typeof window.SS == 'object' then window.SS else {} +window.SS.hoursInDay = window.SS.hoursInDay || 8 + transformPattern = (pattern) -> return pattern.replace /\{0\}/g, '(\\d+)' @@ -22,15 +25,15 @@ convertWorkDuration = (value) -> if !value value else - (days * 8 + hours) * 60 + minutes + (days * window.SS.hoursInDay + hours) * 60 + minutes restoreWorkDuration = (value) -> return '0' if (value == '0' || value == 0) return value unless /^\d+$/.test value - days = Math.floor(value / (8 * 60)) - hours = Math.floor((value - days * 8 * 60) / 60) + days = Math.floor(value / (window.SS.hoursInDay * 60)) + hours = Math.floor((value - days * window.SS.hoursInDay * 60) / 60) minutes = value % 60 result = [] result.push t('work_duration.x_days').replace('{0}', days) if days > 0 @@ -85,4 +88,3 @@ $.fn.val = (value) -> convertValue originalVal.call(@), @ $.fn.originalVal = originalVal - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb index 193a0a0096a..d32c00b4ef8 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb @@ -24,6 +24,9 @@ <script> var pageLang = '<%= I18n.locale.to_s.gsub(/-/, '_') -%>'; + <%# The two lines below mean that before full removal of Rails, we have to find a way to handle config properties %> + window.SS = typeof window.SS === 'object' ? window.SS : {}; + window.SS.hoursInDay = <%= configuration('sonar.technicalDebt.hoursInDay', 8) %>; </script> <script src="<%= ApplicationController.root_context -%>/js/sonar.js"></script> <script> |