From db2f01aa23ff64fb56ab87148e62a131ccda04f7 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 20 Feb 2013 03:19:34 +0100 Subject: [PATCH] Fix sponsors --- assets/scripts/app/controllers/sidebar.coffee | 19 +++++ assets/scripts/app/models/sponsor.coffee | 5 +- assets/scripts/app/store/rest_adapter.coffee | 4 + assets/scripts/app/views/sidebar.coffee | 21 +---- assets/scripts/data/sponsors.coffee | 84 +++++++++---------- assets/scripts/travis.coffee | 2 +- 6 files changed, 73 insertions(+), 62 deletions(-) diff --git a/assets/scripts/app/controllers/sidebar.coffee b/assets/scripts/app/controllers/sidebar.coffee index fedd6448..8dd299ae 100644 --- a/assets/scripts/app/controllers/sidebar.coffee +++ b/assets/scripts/app/controllers/sidebar.coffee @@ -66,3 +66,22 @@ Travis.reopen end: -> @start() + @get('perPage') +Travis.DecksController = Travis.SponsorsController.extend + needs: ['sidebar'] + perPage: 1 + + init: -> + @_super.apply this, arguments + + @get('controllers.sidebar').tickables.push(this) + @set 'content', Travis.Sponsor.decks() + +Travis.LinksController = Travis.SponsorsController.extend + needs: ['sidebar'] + perPage: 6 + + init: -> + @_super.apply this, arguments + + @get('controllers.sidebar').tickables.push(this) + @set 'content', Travis.Sponsor.links() diff --git a/assets/scripts/app/models/sponsor.coffee b/assets/scripts/app/models/sponsor.coffee index 82b9564b..201173fb 100644 --- a/assets/scripts/app/models/sponsor.coffee +++ b/assets/scripts/app/models/sponsor.coffee @@ -4,10 +4,11 @@ require 'travis/model' type: DS.attr('string') url: DS.attr('string') link: DS.attr('string') + _image: DS.attr('string') image: (-> - "/images/sponsors/#{@get('data.image')}" - ).property('data.image') + "/images/sponsors/#{@get('_image')}" + ).property('_image') Travis.Sponsor.reopenClass decks: -> diff --git a/assets/scripts/app/store/rest_adapter.coffee b/assets/scripts/app/store/rest_adapter.coffee index 9c9f5cc1..54352ee5 100644 --- a/assets/scripts/app/store/rest_adapter.coffee +++ b/assets/scripts/app/store/rest_adapter.coffee @@ -66,3 +66,7 @@ Travis.RestAdapter.map 'Travis.Job', { Travis.RestAdapter.map 'Travis.User', { _name: { key: 'name' } } + +Travis.RestAdapter.map 'Travis.Sponsor', { + _image: { key: 'image' } +} diff --git a/assets/scripts/app/views/sidebar.coffee b/assets/scripts/app/views/sidebar.coffee index 2285c657..12d1a1ea 100644 --- a/assets/scripts/app/views/sidebar.coffee +++ b/assets/scripts/app/views/sidebar.coffee @@ -4,28 +4,15 @@ DecksView: Em.View.extend templateName: "sponsors/decks" - controller: Travis.SponsorsController.create - perPage: 1 - - didInsertElement: -> - controller = @get 'controller' - # TODO: move this stuff to controller - #unless controller.get('content') - #Travis.app.get('router.sidebarController').tickables.push(controller) - #controller.set 'content', Travis.Sponsor.decks() + init: -> @_super.apply this, arguments + @set 'controller', @get('controller').container.lookup('controller:decks') LinksView: Em.View.extend templateName: "sponsors/links" - controller: Travis.SponsorsController.create - perPage: 6 - - didInsertElement: -> - controller = @get 'controller' - #unless controller.get('content') - # controller.set 'content', Travis.Sponsor.links() - # Travis.app.get('router.sidebarController').tickables.push(controller) + init: -> @_super.apply this, arguments + @set 'controller', @get('controller').container.lookup('controller:links') WorkersView: Em.View.extend templateName: 'workers/list' diff --git a/assets/scripts/data/sponsors.coffee b/assets/scripts/data/sponsors.coffee index 032a3e86..b8148a36 100644 --- a/assets/scripts/data/sponsors.coffee +++ b/assets/scripts/data/sponsors.coffee @@ -1,48 +1,48 @@ @Travis.SPONSORS = [ - { type: 'platinum', url: "http://www.wooga.com", image: "wooga-205x130.png" } - { type: 'platinum', url: "http://bendyworks.com", image: "bendyworks-205x130.png" } - { type: 'platinum', url: "http://cloudcontrol.com", image: "cloudcontrol-205x130.png" } - { type: 'platinum', url: "http://xing.de", image: "xing-205x130.png" } + { id: '1', type: 'platinum', url: "http://www.wooga.com", image: "wooga-205x130.png" } + { id: '2', type: 'platinum', url: "http://bendyworks.com", image: "bendyworks-205x130.png" } + { id: '3', type: 'platinum', url: "http://cloudcontrol.com", image: "cloudcontrol-205x130.png" } + { id: '4', type: 'platinum', url: "http://xing.de", image: "xing-205x130.png" } - { type: 'gold', url: "http://heroku.com", image: "heroku-205x60.png" } - { type: 'gold', url: "http://soundcloud.com", image: "soundcloud-205x60.png" } - { type: 'gold', url: "http://nedap.com", image: "nedap-205x60.png" } - { type: 'gold', url: "http://mongohq.com", image: "mongohq-205x60.png" } - { type: 'gold', url: "http://zweitag.de", image: "zweitag-205x60.png" } - { type: 'gold', url: "http://kanbanery.com", image: "kanbanery-205x60.png" } - { type: 'gold', url: "http://ticketevolution.com", image: "ticketevolution-205x60.jpg" } - { type: 'gold', url: "http://plan.io/travis", image: "planio-205x60.png" } + { id: '5', type: 'gold', url: "http://heroku.com", image: "heroku-205x60.png" } + { id: '6', type: 'gold', url: "http://soundcloud.com", image: "soundcloud-205x60.png" } + { id: '7', type: 'gold', url: "http://nedap.com", image: "nedap-205x60.png" } + { id: '8', type: 'gold', url: "http://mongohq.com", image: "mongohq-205x60.png" } + { id: '9', type: 'gold', url: "http://zweitag.de", image: "zweitag-205x60.png" } + { id: '10', type: 'gold', url: "http://kanbanery.com", image: "kanbanery-205x60.png" } + { id: '11', type: 'gold', url: "http://ticketevolution.com", image: "ticketevolution-205x60.jpg" } + { id: '12', type: 'gold', url: "http://plan.io/travis", image: "planio-205x60.png" } - { type: 'silver', link: "Cobot: The one tool to run your coworking space" } - { type: 'silver', link: "JumpstartLab: We build developers" } - { type: 'silver', link: "Evil Martians: Agile Ruby on Rails development" } - { type: 'silver', link: "Zendesk: Love your helpdesk" } - { type: 'silver', link: "Stripe: Payments for developers" } - { type: 'silver', link: "Basho: We make Riak!" } - { type: 'silver', link: "Relevance: We deliver software solutions" } - { type: 'silver', link: "Mindmatters: Software für Menschen" } - { type: 'silver', link: "Amen: The best and worst of everything" } - { type: 'silver', link: "Site5: Premium Web Hosting Solutions" } - { type: 'silver', link: "Crowd Interactive: Leading Rails consultancy in Mexico" } - { type: 'silver', link: "Atomic Object: Work with really smart people" } - { type: 'silver', link: "Codeminer: smart services for your startup" } - { type: 'silver', link: "Cloudant: grow into your data layer, not out of it" } - { type: 'silver', link: "Gidsy: Explore, organize & book unique things to do!" } - { type: 'silver', link: "5apps: Package & deploy HTML5 apps automatically" } - { type: 'silver', link: "Meltmedia: We are Interactive Superheroes" } - { type: 'silver', link: "Fingertips offers design and development services" } - { type: 'silver', link: "Engine Yard: Build epic apps, let us handle the rest" } - { type: 'silver', link: "Malwarebytes: Defeat Malware once and for all." } - { type: 'silver', link: "Readmill: The best reading app on the iPad." } - { type: 'silver', link: "Medidata: clinical tech improving quality of life" } - { type: 'silver', link: "ESM: Japan's best agile Ruby/Rails consultancy" } - { type: 'silver', link: "Twitter: instantly connects people everywhere" } - { type: 'silver', link: "AGiLE ANiMAL: we <3 Travis CI." } - { type: 'silver', link: "Tupalo: Discover, review & share local businesses." } - { type: 'silver', link: "Pivotal Labs"} - { type: 'silver', link: "Fiksu"} - { type: 'silver', link: "Sauce Labs"} - { type: 'silver', link: "Mogotest: Never be embarrassed by a visually broken site again."} + { id: '13', type: 'silver', link: "Cobot: The one tool to run your coworking space" } + { id: '14', type: 'silver', link: "JumpstartLab: We build developers" } + { id: '15', type: 'silver', link: "Evil Martians: Agile Ruby on Rails development" } + { id: '16', type: 'silver', link: "Zendesk: Love your helpdesk" } + { id: '17', type: 'silver', link: "Stripe: Payments for developers" } + { id: '18', type: 'silver', link: "Basho: We make Riak!" } + { id: '19', type: 'silver', link: "Relevance: We deliver software solutions" } + { id: '20', type: 'silver', link: "Mindmatters: Software für Menschen" } + { id: '21', type: 'silver', link: "Amen: The best and worst of everything" } + { id: '22', type: 'silver', link: "Site5: Premium Web Hosting Solutions" } + { id: '23', type: 'silver', link: "Crowd Interactive: Leading Rails consultancy in Mexico" } + { id: '24', type: 'silver', link: "Atomic Object: Work with really smart people" } + { id: '25', type: 'silver', link: "Codeminer: smart services for your startup" } + { id: '26', type: 'silver', link: "Cloudant: grow into your data layer, not out of it" } + { id: '27', type: 'silver', link: "Gidsy: Explore, organize & book unique things to do!" } + { id: '28', type: 'silver', link: "5apps: Package & deploy HTML5 apps automatically" } + { id: '29', type: 'silver', link: "Meltmedia: We are Interactive Superheroes" } + { id: '30', type: 'silver', link: "Fingertips offers design and development services" } + { id: '31', type: 'silver', link: "Engine Yard: Build epic apps, let us handle the rest" } + { id: '32', type: 'silver', link: "Malwarebytes: Defeat Malware once and for all." } + { id: '33', type: 'silver', link: "Readmill: The best reading app on the iPad." } + { id: '34', type: 'silver', link: "Medidata: clinical tech improving quality of life" } + { id: '35', type: 'silver', link: "ESM: Japan's best agile Ruby/Rails consultancy" } + { id: '36', type: 'silver', link: "Twitter: instantly connects people everywhere" } + { id: '37', type: 'silver', link: "AGiLE ANiMAL: we <3 Travis CI." } + { id: '38', type: 'silver', link: "Tupalo: Discover, review & share local businesses." } + { id: '39', type: 'silver', link: "Pivotal Labs"} + { id: '40', type: 'silver', link: "Fiksu"} + { id: '41', type: 'silver', link: "Sauce Labs"} + { id: '42', type: 'silver', link: "Mogotest: Never be embarrassed by a visually broken site again."} ] @Travis.WORKERS = { diff --git a/assets/scripts/travis.coffee b/assets/scripts/travis.coffee index 70c1ecb2..d3ceacf4 100644 --- a/assets/scripts/travis.coffee +++ b/assets/scripts/travis.coffee @@ -25,7 +25,7 @@ window.Travis = Em.Application.extend(Ember.Evented, @store = Travis.Store.create( adapter: Travis.RestAdapter.create(serializer: DS.RESTSerializer) ) - #@store.loadMany(Travis.Sponsor, Travis.SPONSORS) + @store.loadMany(Travis.Sponsor, Travis.SPONSORS) @slider = new Travis.Slider() @pusher = new Travis.Pusher(Travis.config.pusher_key)