Sha256: 69bd47344591d714a33787976a65976c79c6d8dc2275f35b095c9add43aae734

Contents?: true

Size: 1.8 KB

Versions: 10

Compression:

Stored size: 1.8 KB

Contents

# @cjsx React.DOM 
Backbone = require('backbone')
$ = require('jquery')
React = require('react')
helpers = require('../helpers')

module.exports = React.createClass
  displayName: 'Pagination'

  pageParam: (page)->
    query = $.extend {}, @props.cards.query
    query = $.extend query, {page: page}
    $.param(query)

  render: ->
    <ul className="nav nav-pills pull-right">
      <li>
        {
          if @props.cards.page
            if @props.cards.page.current > 1
              href = "#/?" + @pageParam(@props.cards.page.current - 1)
            else
              href = "#/?" + @pageParam(@props.cards.page.total)
          else
            href = "javascript:void(0)"
          <a href={href} aria-label="Previous" style={{padding:'6px 12px'}}>
            <span aria-hidden="true">&laquo;</span>
          </a>
        }
      </li>
      <li style={width:'4.0em',textAlign:'center'}>
        {
          if @props.cards.page
            <a href={"#/?" + @pageParam(@props.cards.page.current)} onClick={helpers.reload} style={{padding:'6px 12px'}}>
              {@props.cards.page.current} / {@props.cards.page.total}
            </a>
          else
            <a href="javascript:void(0)" style={{padding:'6px 12px'}}>
              <i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
            </a>
        }
      </li>
      <li>
        {
          if @props.cards.page
            if @props.cards.page.current < @props.cards.page.total
              href = "#/?" + @pageParam(@props.cards.page.current + 1)
            else
              href = "#/?" + @pageParam(1)
          else
            href = "javascript:void(0)"
          <a href={href} aria-label="Next" style={{padding:'6px 12px'}}>
            <span aria-hidden="true">&raquo;</span>
          </a>
        }
      </li>
    </ul>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
carte-server-0.0.19 lib/carte/client/views/pagination.cjsx
carte-server-0.0.18 lib/carte/client/views/pagination.cjsx
carte-server-0.0.17 lib/carte/client/views/pagination.cjsx
carte-server-0.0.16 lib/carte/client/views/pagination.cjsx
carte-server-0.0.15 lib/carte/client/views/pagination.cjsx
carte-server-0.0.14 lib/carte/client/views/pagination.cjsx
carte-server-0.0.13 lib/carte/client/views/pagination.cjsx
carte-server-0.0.12 lib/carte/client/views/pagination.cjsx
carte-server-0.0.11 lib/carte/client/views/pagination.cjsx
carte-server-0.0.10 lib/carte/client/views/pagination.cjsx