diff --git a/app/assets/javascripts/ci/build.coffee b/app/assets/javascripts/ci/build.coffee index 44d5ddb7d95..6c75876a207 100644 --- a/app/assets/javascripts/ci/build.coffee +++ b/app/assets/javascripts/ci/build.coffee @@ -4,6 +4,8 @@ class CiBuild constructor: (build_url, build_status) -> clearInterval(CiBuild.interval) + @initScrollButtonAffix() + if build_status == "running" || build_status == "pending" # # Bind autoscroll button to follow build output @@ -38,4 +40,15 @@ class CiBuild checkAutoscroll: -> $("html,body").scrollTop $("#build-trace").height() if "enabled" is $("#autoscroll-button").data("state") + initScrollButtonAffix: -> + buildScroll = $('#js-build-scroll') + body = $('body') + buildTrace = $('#build-trace') + + buildScroll.affix( + offset: + bottom: -> + body.outerHeight() - (buildTrace.outerHeight() + buildTrace.offset().top) + ) + @CiBuild = CiBuild diff --git a/app/assets/javascripts/ci_build.js.coffee b/app/assets/javascripts/ci_build.js.coffee deleted file mode 100644 index e110eece16b..00000000000 --- a/app/assets/javascripts/ci_build.js.coffee +++ /dev/null @@ -1,14 +0,0 @@ -class @CiBuild - constructor: -> - @initScrollButtonAffix() - - initScrollButtonAffix: -> - buildScroll = $('#js-build-scroll') - body = $('body') - buildTrace = $('#build-trace') - - buildScroll.affix( - offset: - bottom: -> - body.outerHeight() - (buildTrace.outerHeight() + buildTrace.offset().top) - ) diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index f5e5c7c75c7..d7feb5d5c87 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -103,8 +103,6 @@ class Dispatcher new ProjectFork() when 'projects:artifacts:browse' new BuildArtifacts() - when 'projects:builds:show' - new CiBuild() switch path.first() when 'admin'