use a handlebars helper for setting up the search box
This commit is contained in:
parent
5b56895d44
commit
e2678d0e8e
|
@ -13,33 +13,6 @@ Travis.reopen
|
|||
@connectOutlet(outletName: 'top', controller: @topController, viewClass: Travis.TopView)
|
||||
@topController.set('tab', @get('name'))
|
||||
|
||||
RepositoriesController: Ember.ArrayController.extend
|
||||
# sortProperties: ['sortOrder']
|
||||
# sortAscending: false
|
||||
|
||||
searchBox: Ember.TextField.create()
|
||||
|
||||
init: ->
|
||||
@set('content', Travis.Repository.find())
|
||||
@searchBox.appendTo('#search_box')
|
||||
|
||||
recent: ->
|
||||
@set('content', Travis.Repository.find())
|
||||
# @tabs.activate('recent')
|
||||
|
||||
owned_by: (githubId) ->
|
||||
@set('content', Travis.Repository.owned_by(githubId))
|
||||
# @tabs.activate('my_repositories')
|
||||
|
||||
search: ->
|
||||
@set('content', Travis.Repository.search(@searchBox.value))
|
||||
# @tabs.activate('search')
|
||||
|
||||
searchObserver: (->
|
||||
this[if @searchBox.value then 'search' else 'recent']()
|
||||
# @tabs.setDisplay('search', @searchBox.value)
|
||||
).observes('searchBox.value'),
|
||||
|
||||
BuildsController: Em.ArrayController.extend
|
||||
repositoryBinding: 'parent.repository'
|
||||
contentBinding: 'parent.builds'
|
||||
|
@ -54,6 +27,7 @@ Travis.reopen
|
|||
require 'controllers/home'
|
||||
require 'controllers/profile'
|
||||
require 'controllers/repository'
|
||||
require 'controllers/repositories'
|
||||
require 'controllers/sidebar'
|
||||
require 'controllers/sponsors'
|
||||
require 'controllers/stats'
|
||||
|
|
|
@ -60,7 +60,6 @@ require 'models'
|
|||
success: (json) ->
|
||||
root = type.pluralName()
|
||||
@sideload(store, type, json, root)
|
||||
console.log json, root
|
||||
recordArray.load(json[root])
|
||||
accepts:
|
||||
json: 'application/vnd.travis-ci.2+json'
|
||||
|
|
|
@ -3,25 +3,7 @@
|
|||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="search_box"></div>
|
||||
|
||||
<ul class="tabs">
|
||||
<li id="tab_recent" class="active">
|
||||
<h5><a href="#">{{t layouts.application.recent}}</a></h5>
|
||||
</li>
|
||||
{{#if currentUser}}
|
||||
<li id="tab_my_repos">
|
||||
<h5><a href="#">{{t layouts.application.my_repositories}}</a></h5>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li id="tab_search">
|
||||
<h5><a href="#">{{t layouts.application.search}}</a></h5>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab">
|
||||
{{outlet left}}
|
||||
</div>
|
||||
{{outlet left}}
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
|
|
|
@ -1,25 +1,43 @@
|
|||
<ul id="repositories">
|
||||
{{#each repository in controller.arrangedContent}}
|
||||
{{#view Travis.RepositoriesItemView contextBinding="repository"}}
|
||||
<li {{bindAttr class="view.classes"}}>
|
||||
<a {{bindAttr href="view.urlRepository"}} class="current">{{slug}}</a>
|
||||
<a {{bindAttr href="view.urlLastBuild"}} class="last_build">#{{lastBuildNumber}}</a>
|
||||
<div id="search_box">
|
||||
{{view Ember.TextField valueBinding="controller.search"}}
|
||||
</div>
|
||||
|
||||
<p class="summary">
|
||||
<span class="duration_label">{{t repositories.duration}}:</span>
|
||||
<abbr class="duration" {{bindAttr title="lastBuildStartedAt"}}>{{formatDuration lastBuildDuration}}</abbr>,
|
||||
<span class="finished_at_label">{{t repositories.finished_at}}:</span>
|
||||
<abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinishedAt}}</abbr>
|
||||
</p>
|
||||
{{#if description}}
|
||||
<p class="description">{{description}}</p>
|
||||
{{/if}}
|
||||
<span class="indicator"></span>
|
||||
</li>
|
||||
{{/view}}
|
||||
{{else}}
|
||||
<div class="loading">
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
<ul>
|
||||
<ul class="tabs">
|
||||
<li id="tab_recent" {{bindAttr class="view.classRecent"}}>
|
||||
<h5><a href="#">{{t layouts.application.recent}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_owned" {{bindAttr class="view.classOwned"}}>
|
||||
<h5><a href="#">{{t layouts.application.my_repositories}}</a></h5>
|
||||
</li>
|
||||
<li id="tab_search" {{bindAttr class="view.classSearch"}}>
|
||||
<h5><a href="#">{{t layouts.application.search}}</a></h5>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab">
|
||||
<ul id="repositories">
|
||||
{{#each repository in controller.arrangedContent}}
|
||||
{{#view Travis.RepositoriesItemView contextBinding="repository"}}
|
||||
<li {{bindAttr class="view.classes"}}>
|
||||
<a {{bindAttr href="view.urlRepository"}} class="current">{{slug}}</a>
|
||||
<a {{bindAttr href="view.urlLastBuild"}} class="last_build">#{{lastBuildNumber}}</a>
|
||||
|
||||
<p class="summary">
|
||||
<span class="duration_label">{{t repositories.duration}}:</span>
|
||||
<abbr class="duration" {{bindAttr title="lastBuildStartedAt"}}>{{formatDuration lastBuildDuration}}</abbr>,
|
||||
<span class="finished_at_label">{{t repositories.finished_at}}:</span>
|
||||
<abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinishedAt}}</abbr>
|
||||
</p>
|
||||
{{#if description}}
|
||||
<p class="description">{{description}}</p>
|
||||
{{/if}}
|
||||
<span class="indicator"></span>
|
||||
</li>
|
||||
{{/view}}
|
||||
{{else}}
|
||||
<div class="loading">
|
||||
<span>Loading</span>
|
||||
</div>
|
||||
{{/each}}
|
||||
<ul>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
@Travis.reopen
|
||||
RepositoriesView: Em.View.extend
|
||||
templateName: 'repositories/list'
|
||||
tabBinding: 'controller.tab'
|
||||
|
||||
classRecent: (->
|
||||
'active' if @get('tab') == 'recent'
|
||||
).property('tab')
|
||||
|
||||
classOwned: (->
|
||||
'active' if @get('tab') == 'owned'
|
||||
).property('tab')
|
||||
|
||||
classSearch: (->
|
||||
'active' if @get('tab') == 'search'
|
||||
).property('tab')
|
||||
|
||||
RepositoriesItemView: Em.View.extend
|
||||
repositoryBinding: 'context'
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user