Show appropriate message if repository was not found
This commit is contained in:
parent
a529231f1f
commit
8fab8448c2
|
@ -3,6 +3,10 @@ Travis.RepoController = Travis.Controller.extend
|
||||||
needs: ['repos', 'currentUser']
|
needs: ['repos', 'currentUser']
|
||||||
currentUserBinding: 'controllers.currentUser'
|
currentUserBinding: 'controllers.currentUser'
|
||||||
|
|
||||||
|
isError: (-> @get('content.isError') ).property('content.isError')
|
||||||
|
slug: (-> @get('content.slug') ).property('content.slug')
|
||||||
|
isLoading: (-> @get('content.isLoading') ).property('content.isLoading')
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||||
|
|
|
@ -140,7 +140,7 @@ Travis.RepoRoute = Ember.Route.extend
|
||||||
|
|
||||||
deserialize: (params) ->
|
deserialize: (params) ->
|
||||||
slug = "#{params.owner}/#{params.name}"
|
slug = "#{params.owner}/#{params.name}"
|
||||||
content = Ember.Object.create slug: slug, isLoaded: false
|
content = Ember.Object.create slug: slug, isLoaded: false, isLoading: true
|
||||||
proxy = Ember.ObjectProxy.create(content: content)
|
proxy = Ember.ObjectProxy.create(content: content)
|
||||||
|
|
||||||
repos = Travis.Repo.bySlug(slug)
|
repos = Travis.Repo.bySlug(slug)
|
||||||
|
@ -148,7 +148,14 @@ Travis.RepoRoute = Ember.Route.extend
|
||||||
observer = ->
|
observer = ->
|
||||||
if repos.get 'isLoaded'
|
if repos.get 'isLoaded'
|
||||||
repos.removeObserver 'isLoaded', observer
|
repos.removeObserver 'isLoaded', observer
|
||||||
proxy.set 'content', repos.objectAt(0)
|
proxy.set 'isLoading', false
|
||||||
|
|
||||||
|
if repos.get('length') == 0
|
||||||
|
# isError is also used in DS.Model, but maybe we should use something
|
||||||
|
# more focused like notFound later
|
||||||
|
proxy.set 'isError', true
|
||||||
|
else
|
||||||
|
proxy.set 'content', repos.objectAt(0)
|
||||||
|
|
||||||
if repos.length
|
if repos.length
|
||||||
proxy.set('content', repos[0])
|
proxy.set('content', repos[0])
|
||||||
|
|
|
@ -2,25 +2,28 @@
|
||||||
{{#if view.isEmpty}}
|
{{#if view.isEmpty}}
|
||||||
{{view Travis.ReposEmptyView}}
|
{{view Travis.ReposEmptyView}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if repo.isLoaded}}
|
{{#if isError}}
|
||||||
{{#with repo}}
|
<span class="not-found">The repository at {{slug}} was not found.</span>
|
||||||
<h3>
|
|
||||||
<a {{bindAttr href="controller.urlGithub"}}>{{slug}}</a>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<p class="description">{{description}}</p>
|
|
||||||
|
|
||||||
{{view Travis.RepoShowTabsView}}
|
|
||||||
{{view Travis.RepoShowToolsView}}
|
|
||||||
{{/with}}
|
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<span>Loading</span>
|
{{#if repo.isLoaded}}
|
||||||
{{/if}}
|
{{#with repo}}
|
||||||
|
<h3>
|
||||||
|
<a {{bindAttr href="controller.urlGithub"}}>{{slug}}</a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
<div class="tab">
|
<p class="description">{{description}}</p>
|
||||||
{{outlet pane}}
|
|
||||||
</div>
|
{{view Travis.RepoShowTabsView}}
|
||||||
|
{{view Travis.RepoShowToolsView}}
|
||||||
|
{{/with}}
|
||||||
|
|
||||||
|
<div class="tab">
|
||||||
|
{{outlet pane}}
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<span>Loading</span>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,7 @@ Travis.reopen
|
||||||
repoBinding: 'controllers.repo'
|
repoBinding: 'controllers.repo'
|
||||||
reposBinding: 'controllers.repos'
|
reposBinding: 'controllers.repos'
|
||||||
|
|
||||||
isLoadedBinding: 'repo.isLoaded'
|
classNameBindings: ['controller.isLoading:loading']
|
||||||
classNameBindings: ['loading:isLoaded']
|
|
||||||
|
|
||||||
isEmpty: (->
|
isEmpty: (->
|
||||||
@get('repos.isLoaded') && @get('repos.length') == 0
|
@get('repos.isLoaded') && @get('repos.length') == 0
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
overflow-x: hidden
|
overflow-x: hidden
|
||||||
padding-right: 10px
|
padding-right: 10px
|
||||||
|
|
||||||
|
.not-found
|
||||||
|
display: block
|
||||||
|
padding: 10px 5px
|
||||||
|
font-size: 12px
|
||||||
|
|
||||||
.description, .language
|
.description, .language
|
||||||
font-weight: normal
|
font-weight: normal
|
||||||
color: $color-text-light
|
color: $color-text-light
|
||||||
|
|
Loading…
Reference in New Issue
Block a user