# @cjsx React.DOM $ = require('jquery') Backbone = require('backbone') React = require('react') Cards = require('./cards') CardCollection = require('../models/cards') Pagination = require('./pagination') helpers = require('../helpers') config = require('../config') module.exports = React.createClass displayName: 'List' componentDidMount: -> @props.cards.on 'sync', @forceUpdate.bind(@, null) componentWillReceiveProps: (nextProps)-> console.log 'List: component will receive props' nextProps.cards.on 'sync', @forceUpdate.bind(@, null) atozParam: ()-> @queryParam {sort: 'title', order: 'asc', page: 1}, [] latestParam: ()-> @queryParam {sort: 'updated_at', order: 'desc', page: 1}, [] randomParam: ()-> @queryParam {order: 'random'}, ['sort', 'page'] tagParam: (tag)-> @queryParam {tag: tag}, ['seed'] queryParam: (param, deleteKeys)-> query = $.extend {}, @props.cards.query, param for key in deleteKeys delete query[key] $.param(query) render: -> console.log 'render', @props.cards.query
{if !@props.card
    { for menuItem in config.menu_items switch menuItem when 'atoz'
  • A to Z
  • when 'latest'
  • Latest
  • when 'random'
  • Random
  • }
{ if @props.cards.query.order == 'random'
  • { if @props.cards.pagination else }
else }
else
} { if !@props.card && helpers.isMobile()
}