From 5e28b81046ed6b2423ceec30cb3365def8296cd3 Mon Sep 17 00:00:00 2001 From: Julea Pikareva Date: Fri, 28 Dec 2012 15:02:59 +0400 Subject: [PATCH 1/5] [issue #795] output server time Time change from local to server --- app/views/projects/build_lists/index.html.haml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/projects/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml index a3ecebef8..f5149f162 100644 --- a/app/views/projects/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -1,5 +1,8 @@ -set_meta_tags :title => t('.title') +%div.servertime + %input{:type => 'text', :id => 'servertime', :name => 'servertime'} + = Time.now.utc.to_i %div.reloader = label_tag :autoreload do = check_box_tag :autoreload, true, true @@ -46,7 +49,8 @@ .replace("%d", formatNumber(minutes)); } // TODO Very, very ugly method. - var now = (new Date).getTime(); + var now = (new Date); + now = document.getElementById('servertime').value; $("time.js-relative-date").each(function() { var time = parseIso8601($(this).attr('datetime')).getTime(); $(this).text(strTimeBetween(time, now)); From 0b267031b513bc394262623093036d52d9b72f1a Mon Sep 17 00:00:00 2001 From: Julea Pikareva Date: Fri, 28 Dec 2012 15:05:41 +0400 Subject: [PATCH 2/5] [issue #795] output server time add stylesheets --- app/assets/stylesheets/design/custom.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 188c8c508..cc1d59736 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1709,3 +1709,6 @@ table#myTable thead tr.search th form.button_to div input { margin-top: 2px; } +.servertime { + display: none; +} \ No newline at end of file From dcc936fdb6ce3b40df47efbb0d25fb5aa834bf4b Mon Sep 17 00:00:00 2001 From: Julea Pikareva Date: Fri, 28 Dec 2012 17:50:39 +0400 Subject: [PATCH 3/5] [issue #795] output server time fix --- app/views/projects/build_lists/index.html.haml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/projects/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml index f5149f162..3094188f4 100644 --- a/app/views/projects/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -1,8 +1,7 @@ -set_meta_tags :title => t('.title') %div.servertime - %input{:type => 'text', :id => 'servertime', :name => 'servertime'} - = Time.now.utc.to_i + %input{:type => 'text', :id => 'servertime', :name => 'servertime', :value => "#{Time.now.utc.to_i}"} %div.reloader = label_tag :autoreload do = check_box_tag :autoreload, true, true @@ -49,8 +48,7 @@ .replace("%d", formatNumber(minutes)); } // TODO Very, very ugly method. - var now = (new Date); - now = document.getElementById('servertime').value; + var now = document.getElementById('servertime').value*1000; $("time.js-relative-date").each(function() { var time = parseIso8601($(this).attr('datetime')).getTime(); $(this).text(strTimeBetween(time, now)); From 87a6134da0d85c430bbb9d7e0aaff0eaf212524c Mon Sep 17 00:00:00 2001 From: Julea Pikareva Date: Fri, 28 Dec 2012 18:03:17 +0400 Subject: [PATCH 4/5] [issue #795] output server time hot fix --- app/assets/stylesheets/design/custom.scss | 4 ---- app/views/projects/build_lists/index.html.haml | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index cc1d59736..7ac5210e0 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1708,7 +1708,3 @@ form#new_pull_request { table#myTable thead tr.search th form.button_to div input { margin-top: 2px; } - -.servertime { - display: none; -} \ No newline at end of file diff --git a/app/views/projects/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml index 3094188f4..d775bf62e 100644 --- a/app/views/projects/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -1,7 +1,6 @@ -set_meta_tags :title => t('.title') -%div.servertime - %input{:type => 'text', :id => 'servertime', :name => 'servertime', :value => "#{Time.now.utc.to_i}"} += hidden_field_tag :servertime, Time.now.utc.to_i %div.reloader = label_tag :autoreload do = check_box_tag :autoreload, true, true From 079d6578d3766fbddb8c4f9e36861dc015566e70 Mon Sep 17 00:00:00 2001 From: Julea Pikareva Date: Fri, 28 Dec 2012 20:34:10 +0400 Subject: [PATCH 5/5] [issue #795] output server time reduction to a single style --- app/assets/stylesheets/design/custom.scss | 1 + app/views/projects/build_lists/index.html.haml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 7ac5210e0..188c8c508 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -1708,3 +1708,4 @@ form#new_pull_request { table#myTable thead tr.search th form.button_to div input { margin-top: 2px; } + diff --git a/app/views/projects/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml index d775bf62e..9821d0a3d 100644 --- a/app/views/projects/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -47,7 +47,7 @@ .replace("%d", formatNumber(minutes)); } // TODO Very, very ugly method. - var now = document.getElementById('servertime').value*1000; + var now = $('#servertime').val() * 1000; $("time.js-relative-date").each(function() { var time = parseIso8601($(this).attr('datetime')).getTime(); $(this).text(strTimeBetween(time, now));