lib/carte/client/views/content.cjsx in carte-server-1.0.0 vs lib/carte/client/views/content.cjsx in carte-server-1.0.1
- old
+ new
@@ -1,9 +1,10 @@
# @cjsx React.DOM
$ = require('jquery')
React = require('react')
List = require('./list')
+Slideshow = require('./slideshow')
CardCollection = require('../models/cards')
CardModel = require('../models/card')
String = require('string')
config = require('../config')
@@ -32,12 +33,16 @@
#for k, v of cards.query
# title.push(String(k).capitalize() + ': ' + v)
#title = title.join(', ')
#title = config.title + ' (' + title + ')'
#document.title = title
- document.title = config.title
- <List key='list' router={@props.router} cards={cards} />
+ if cards.query.mode == 'flash'
+ document.title = config.title + '、スライドショー'
+ <Slideshow key='slideshow' router={@props.router} cards={cards} />
+ else
+ document.title = config.title
+ <List key='list' router={@props.router} cards={cards} />
when "show"
cards = new CardCollection()
cards.fetching = true
card = new CardModel(title: @props.router.title)
card.fetch
@@ -55,19 +60,9 @@
cards.fetching = false
error: (card, response)=>
cards.fetching = false
document.title = config.title + '、' + card.get('title')
<List key='show' cards={cards} card={card} />
- when "slideshow"
- console.log 'slideshow', @props.router.query
- cards = new CardCollection()
- cards.query = $.extend {}, config.default_query, @props.router.query
- cards.fetching = true
- cards.fetch success: ()-> cards.fetching = false
- document.title = config.title + '、スライドショー'
- e = React.createElement(Slideshow, cards: cards)
- React.render(e, document.body)
- #<Slideshow key='slideshow' router={@props.router} cards={cards} />
else
<div>Loading ...</div>
}
</div>