Sha256: 6a88b1bdd21a85e3110acb1f5ce1485853e16c4c980a82ee7fa58d50e687c837

Contents?: true

Size: 1.88 KB

Versions: 14

Compression:

Stored size: 1.88 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 carte-pagination">
      <li className="carte-pagination-prev">
        {
          if @props.cards.pagination
            if @props.cards.pagination.current_page > 1
              href = "#/?" + @pageParam(@props.cards.pagination.current_page - 1)
            else
              href = "#/?" + @pageParam(@props.cards.pagination.total_pages)
          else
            href = "javascript:void(0)"
          <a href={href} aria-label="Previous">
            <span aria-hidden="true">&laquo;</span>
          </a>
        }
      </li>
      <li className="carte-pagination-curr">
        {
          if @props.cards.pagination
            <a href={"#/?" + @pageParam(@props.cards.pagination.current_page)} onClick={helpers.reload}>
              {@props.cards.pagination.current_page} / {@props.cards.pagination.total_pages}
            </a>
          else
            <a href="javascript:void(0)">
              <i className="glyphicon glyphicon-refresh glyphicon-refresh-animate" />
            </a>
        }
      </li>
      <li className="carte-pagination-next">
        {
          if @props.cards.pagination
            if @props.cards.pagination.current_page < @props.cards.pagination.total_pages
              href = "#/?" + @pageParam(@props.cards.pagination.current_page + 1)
            else
              href = "#/?" + @pageParam(1)
          else
            href = "javascript:void(0)"
          <a href={href} aria-label="Next">
            <span aria-hidden="true">&raquo;</span>
          </a>
        }
      </li>
    </ul>

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
carte-server-1.0.11 lib/carte/client/views/pagination.cjsx
carte-server-1.0.10 lib/carte/client/views/pagination.cjsx
carte-server-1.0.9 lib/carte/client/views/pagination.cjsx
carte-server-1.0.8 lib/carte/client/views/pagination.cjsx
carte-server-1.0.7 lib/carte/client/views/pagination.cjsx
carte-server-1.0.6 lib/carte/client/views/pagination.cjsx
carte-server-1.0.5 lib/carte/client/views/pagination.cjsx
carte-server-1.0.4 lib/carte/client/views/pagination.cjsx
carte-server-1.0.3 lib/carte/client/views/pagination.cjsx
carte-server-1.0.2 lib/carte/client/views/pagination.cjsx
carte-server-1.0.1 lib/carte/client/views/pagination.cjsx
carte-server-1.0.0 lib/carte/client/views/pagination.cjsx
carte-server-0.0.28 lib/carte/client/views/pagination.cjsx
carte-server-0.0.27 lib/carte/client/views/pagination.cjsx