From 68b9b31d7f2f8ae241a77a399d88935a3b0e938a Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Thu, 5 Jul 2012 18:19:52 +0200 Subject: [PATCH] add isBuildTab and isJobTab helpers --- .../app/templates/repositories/tabs.hbs | 16 ++++++++-------- assets/javascripts/app/views/tabs.coffee | 9 +++++++++ public/javascripts/application.js | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/assets/javascripts/app/templates/repositories/tabs.hbs b/assets/javascripts/app/templates/repositories/tabs.hbs index 3108ec0a..e8ebb7d3 100644 --- a/assets/javascripts/app/templates/repositories/tabs.hbs +++ b/assets/javascripts/app/templates/repositories/tabs.hbs @@ -11,20 +11,20 @@
  • {{t repositories.tabs.branches}}
  • - {{#with controller.build}} - {{#if isLoaded}} + {{#if view.isBuildTab}} + {{#with controller.build}}
  • {{t repositories.tabs.build}} #{{number}}
  • - {{/if}} - {{/with}} - {{#with controller.job}} - {{#if isLoaded}} + {{/with}} + {{/if}} + {{#if view.isJobTab}} + {{#with controller.job}}
  • {{t repositories.tabs.job}} #{{number}}
  • - {{/if}} - {{/with}} + {{/with}} + {{/if}}
    diff --git a/assets/javascripts/app/views/tabs.coffee b/assets/javascripts/app/views/tabs.coffee index ed6d1429..0b6bfd77 100644 --- a/assets/javascripts/app/views/tabs.coffee +++ b/assets/javascripts/app/views/tabs.coffee @@ -5,6 +5,15 @@ toggleTools: -> $('#tools .pane').toggle() + isBuildTab: (-> + tab = @getPath('controller.tab') + (tab == 'build' || tab == 'job') && @getPath('controller.build.isLoaded') + ).property('controller.tab', 'controller.build.isLoaded') + + isJobTab: (-> + @getPath('controller.tab') == 'job' && @getPath('controller.job.isLoaded') + ).property('controller.tab', 'controller.job.isLoaded') + # hrm. how to parametrize bindAttr? classCurrent: (-> 'active' if @getPath('controller.tab') == 'current' diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 06c04044..f838b1e3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1 +1 @@ -minispade.register('templates', "(function() {Ember.TEMPLATES['builds/list']=Ember.Handlebars.compile(\"{{#with controller.builds}}\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n \\n {{#each build in content}}\\n {{#view Travis.Views.BuildsItemView contextBinding=\\\"build\\\"}}\\n \\n \\n \\n \\n \\n \\n \\n {{/view}}\\n {{else}}\\n Loading ...\\n {{/each}}\\n \\n
    {{t builds.name}}{{t builds.commit}}{{t builds.message}}{{t builds.duration}}{{t builds.finished_at}}
    {{number}}{{formatCommit commit}}{{{formatMessage commit.message short=\\\"true\\\"}}}{{formatDuration duration}}{{formatTime finished_at}}
    \\n\\n

    \\n \\n

    \\n{{/with}}\\n\");Ember.TEMPLATES['builds/show']=Ember.Handlebars.compile(\"{{#with controller.build}}\\n {{#unless isLoaded}}\\n Loading ...\\n {{else}}\\n
    \\n
    \\n
    \\n
    {{t builds.name}}
    \\n
    {{number}}
    \\n
    {{t builds.finished_at}}
    \\n
    {{formatTime finished_at}}
    \\n
    {{t builds.duration}}
    \\n
    {{formatDuration duration}}
    \\n
    \\n\\n
    \\n
    {{t builds.commit}}
    \\n
    {{formatCommit commit}}
    \\n {{#if commit.compareUrl}}\\n
    {{t builds.compare}}
    \\n
    {{pathFrom commit.compareUrl}}
    \\n {{/if}}\\n {{#if commit.authorName}}\\n
    {{t builds.author}}
    \\n
    {{commit.authorName}}
    \\n {{/if}}\\n {{#if commit.committerName}}\\n
    {{t builds.committer}}
    \\n
    {{commit.committerName}}
    \\n {{/if}}\\n
    \\n\\n
    {{t builds.message}}
    \\n
    {{{formatMessage commit.message}}}
    \\n\\n {{#unless isMatrix}}\\n
    {{t builds.config}}
    \\n
    {{formatConfig config}}
    \\n {{/unless}}\\n
    \\n\\n {{#if isMatrix}}\\n {{view Travis.Views.JobsView jobsBinding=\\\"view.requiredJobs\\\" required=\\\"true\\\"}}\\n {{view Travis.Views.JobsView jobsBinding=\\\"view.allowedFailureJobs\\\"}}\\n {{else}}\\n {{view Travis.Views.LogView contextBinding=\\\"jobs.firstObject\\\"}}\\n {{/if}}\\n
    \\n {{/unless}}\\n{{/with}}\\n\");Ember.TEMPLATES['jobs/list']=Ember.Handlebars.compile(\"{{#with controller.build}}\\n {{#if jobs.length}}\\n {{#if view.required}}\\n \\n \\n {{else}}\\n
    \\n {{t jobs.build_matrix}}\\n
    \\n \\n {{/if}}\\n \\n \\n {{#each configKeys}}\\n \\n {{/each}}\\n \\n \\n \\n {{#each job in view.jobs}}\\n {{#view Travis.Views.JobsItemView contextBinding=\\\"job\\\"}}\\n \\n \\n \\n \\n {{#each configValues}}\\n \\n {{/each}}\\n \\n {{/view}}\\n {{/each}}\\n \\n
    \\n {{t jobs.allowed_failures}}\\n \\n
    {{this}}
    {{number}}{{formatDuration duration}}{{formatTime finished_at}}{{this}}
    \\n\\n {{#unless view.required}}\\n
    \\n
    {{t \\\"jobs.allowed_failures\\\"}}
    \\n
    \\n

    \\n Allowed Failures are items in your build matrix that are allowed to\\n fail without causing the entire build to be shown as failed. This lets you add\\n in experimental and preparatory builds to test against versions or\\n configurations that you are not ready to officially support.\\n

    \\n

    \\n You can define allowed failures in the build matrix as follows:\\n

    \\n
     matrix:\\n    allow_failures:\\n      - rvm: ruby-head 
    \\n
    \\n
    \\n {{/unless}}\\n {{/if}}\\n{{/with}}\\n\");Ember.TEMPLATES['jobs/log']=Ember.Handlebars.compile(\"
    {{{formatLog log.body}}}
    \\n\\n{{#if sponsor.name}}\\n

    \\n {{t builds.messages.sponsored_by}}\\n {{sponsor.name}}\\n

    \\n{{/if}}\\n\");Ember.TEMPLATES['jobs/show']=Ember.Handlebars.compile(\"{{#with controller.job}}\\n {{#if isLoaded}}\\n
    \\n
    \\n
    \\n
    Job
    \\n
    {{number}}
    \\n
    {{t jobs.finished_at}}
    \\n
    {{formatTime finished_at}}
    \\n
    {{t jobs.duration}}
    \\n
    {{formatDuration duration}}
    \\n
    \\n\\n
    \\n
    {{t jobs.commit}}
    \\n
    {{formatCommit commit}}
    \\n {{#if commit.compareUrl}}\\n
    {{t jobs.compare}}
    \\n
    {{pathFrom commit.compareUrl}}
    \\n {{/if}}\\n {{#if commit.authorName}}\\n
    {{t jobs.author}}
    \\n
    {{commit.authorName}}
    \\n {{/if}}\\n {{#if commit.committerName}}\\n
    {{t jobs.committer}}
    \\n
    {{commit.committerName}}
    \\n {{/if}}\\n
    \\n\\n
    {{t jobs.message}}
    \\n
    {{formatMessage commit.message}}
    \\n
    {{t jobs.config}}
    \\n
    {{formatConfig config}}
    \\n
    \\n\\n {{view Travis.Views.LogView}}\\n
    \\n {{/if}}\\n{{/with}}\\n\");Ember.TEMPLATES['layouts/home']=Ember.Handlebars.compile(\"
    \\n {{outlet top}}\\n
    \\n\\n
    \\n
    \\n \\n
    \\n\\n \\n\\n
    \\n {{outlet left}}\\n
    \\n
    \\n\\n
    \\n {{outlet main}}\\n\\n {{outlet tabs}}\\n\\n
    \\n {{outlet tab}}\\n
    \\n\\n
    \\n {{outlet right}}\\n
    \\n
    \\n\\n\");Ember.TEMPLATES['layouts/sidebar']=Ember.Handlebars.compile(\"\\n {{t layouts.application.fork_me}}\\n\\n\\n
    \\n
     \\n
    \\n\\n{{view templateName=\\\"sponsors/decks\\\"}}\\n{{view templateName=\\\"workers/list\\\" id=\\\"workers\\\"}}\\n{{view templateName=\\\"queues/list\\\" id=\\\"queues\\\"}}\\n{{view templateName=\\\"sponsors/links\\\"}}\\n\\n
    \\n

    {{t layouts.about.alpha}}

    \\n

    {{{t layouts.about.messages.alpha}}}

    \\n
    \\n\\n
    \\n

    {{t layouts.about.join}}

    \\n \\n
    \\n\");Ember.TEMPLATES['layouts/simple']=Ember.Handlebars.compile(\"
    \\n {{outlet top}}\\n
    \\n\\n
    \\n {{outlet main}}\\n
    \\n\\n\");Ember.TEMPLATES['layouts/top']=Ember.Handlebars.compile(\"\\n

    Travis

    \\n
    \\n\\n\\n\");Ember.TEMPLATES['profile/hooks']=Ember.Handlebars.compile(\"{{#if content.length}}\\n \\n{{else}}\\n

    Please wait while we sync with GitHub

    \\n{{/if}}\\n\\n\");Ember.TEMPLATES['profile/show']=Ember.Handlebars.compile(\"

    {{name}}

    \\n\\n\\n
    \\n
    \\n {{t profiles.show.github}}:\\n
    \\n
    \\n {{login}}\\n
    \\n
    \\n {{t profiles.show.email}}:\\n
    \\n
    \\n {{email}}\\n
    \\n
    \\n {{t profiles.show.token}}:\\n
    \\n
    \\n {{token}}\\n
    \\n
    \\n\\n

    \\n {{{t profiles.show.messages.notice}}}\\n

    \\n\\n

    {{t profiles.show.your_locale}}

    \\n
    \\n \\n \\n
    \\n\\n

    {{t profiles.show.your_repos}}

    \\n

    \\n {{{t profiles.show.message.your_repos}}}\\n \\n {{{t profiles.show.message.config}}}\\n \\n

    \\n\\n{{outlet hooks}}\\n\");Ember.TEMPLATES['queues/list']=Ember.Handlebars.compile(\"{{#each queue in queues}}\\n

    {{t queue}}: {{queue.name}}

    \\n \\n{{/each}}\\n\");Ember.TEMPLATES['repositories/list']=Ember.Handlebars.compile(\"