Sha256: a21c32aa54a82a3891e902f755633fe9b9121736f414dc08aeaa15f1141ea87b

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

# @cjsx React.DOM 
$ = require('jquery')
React = require('react')

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)} 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

1 entries across 1 versions & 1 rubygems

Version Path
carte-server-0.0.9 lib/carte/client/views/pagination.cjsx