Skip to content

Instantly share code, notes, and snippets.

@jmreidy
Created October 4, 2010 20:09
Show Gist options
  • Save jmreidy/610330 to your computer and use it in GitHub Desktop.
Save jmreidy/610330 to your computer and use it in GitHub Desktop.
def transform
find('.item').replace_each(@items) do |item|
find('h2').text("#{item.name}").attr('data', item.id.to_s)
find('.tags').html(markup_for_tags item.tags)
find('.deleteBttn').attr('id',item.id.to_s)
end
if @page_count > 1
if @curr_page != @page_count
find("#paginator li.next a").attr('href',"items?page=#{@curr_page+1}")
else
find("#paginator li.next a").attr('class',"disabled").attr('href',"places?page=#{@curr_page}")
end
find('#paginator .page').replace_each((0..max_paginator_item)) do |page|
find('a').attr('class','num active') if page == @curr_page-1
find('a').text(page+1)
find('a').attr('href',"places?page=#{page+1}")
end
else
find('#paginator').attr('class','noPages')
end
end
def transform
find('.item').replace_each(@items) do |item|
find('h2').text("#{item.name}").attr('data', item.id.to_s)
find('.tags').html(markup_for_tags item.tags)
find('.deleteBttn').attr('id',item.id.to_s)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment