Skip to content

Commit

Permalink
basic site filtering works
Browse files Browse the repository at this point in the history
  • Loading branch information
stereosteve committed Jul 20, 2011
1 parent ab16815 commit 606ef98
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions app/controllers/sites.coffee
Expand Up @@ -8,7 +8,6 @@ SiteList = Spine.List.create
require("views/sites/list")(items)

GroupList = Spine.List.create
selectFirst: true
template: (items) ->
require("views/sites/group-list")(items)

Expand Down Expand Up @@ -53,7 +52,7 @@ SiteDetail = Spine.Controller.create

module.exports = Spine.Controller.create

proxied: ["render", "change"]
proxied: ["render", "change", "selectGroup"]

init: ->
@groups = GroupList.init(el: $('.group-list'))
Expand All @@ -77,7 +76,9 @@ module.exports = Spine.Controller.create
@detail.active(item)

selectGroup: (item) ->
console.log("group selected")
sites = Site.filterGroupId(item.id)
console.log(sites)
@list.render(sites)

error: (e) ->
console.log "ERROR"
Expand Down
4 changes: 2 additions & 2 deletions app/models/site.coffee
@@ -1,8 +1,8 @@
Site = module.exports = Spine.Model.setup("Site", ["name", "url", "username", "password", "notes"])

Site.extend
social: ->
(site for site in Site.all() when site.group == 1)
filterGroupId: (id) ->
(site for site in Site.all() when site.group == id)

sort: ->
@all().sort (a, b) ->
Expand Down
1 change: 1 addition & 0 deletions public/css/application.css
Expand Up @@ -150,6 +150,7 @@ body {
#sites .site-list {
border: 1px solid #ccc;
border-top: 0;
border-bottom: 0;
}
#sites .site-detail h2 {
border-bottom: 1px solid #ccc;
Expand Down
1 change: 1 addition & 0 deletions public/css/application.less
Expand Up @@ -152,6 +152,7 @@ body {
.site-list {
border: 1px solid #ccc;
border-top: 0;
border-bottom: 0;
}

/* specific */
Expand Down

0 comments on commit 606ef98

Please sign in to comment.