Sha256: 030ca8718c9501f8303a2721c8be90c3a9f1fd314040e178e4194e60eb9e6da3
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require "pagination_ajax" module PaginationAjax module ViewHelpers def draw_pagination_links(options = {}) ## template -- cut off anything starting at a "." ## no template = no dice options.transform_keys!{|key| "data-#{key.to_s}"} options["data-current_page"] ||= 0 options["class"] = "pagination_container" content = create_pagination_links(options) content_tag(:div, content, options) end def create_pagination_links(options) if options["data-url"].nil? return "You must provide a url to send the ajax request to!" elsif options["data-template"].nil? return "You must provide a template with which to render the results!" end current_page = options["data-current_page"] link = "<a href=\"#\" class=\"pagination_link selected_page\" data-element_number=\"#{current_page}\">#{current_page+1}</a>" "<span class=\"link_canvas\">#{link}</span><div class=\"pagination_canvas\"></div>".html_safe end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pagination_ajax-1.0.5 | lib/pagination_ajax/view_helpers.rb |