Module: Card::Set::Abstract::Paging::PagingViews::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb
Constant Summary collapse
- PAGE_LI_CLASS =
{ ellipses: "disabled", current: "active" }.freeze
Instance Method Summary collapse
-
#page_link(text, page, options) ⇒ Object
-
#page_link_li(text, page, status, options = {}) ⇒ Object
First page is 0 (not 1).
-
#page_link_li_class(status) ⇒ Object
-
#page_link_path_args(page) ⇒ Object
-
#paging_links ⇒ Object
-
#paging_path_args(local_args = {}) ⇒ Object
-
#view: paging ⇒ Object
-
#with_paging(path_args = {}) ⇒ Object
-
#with_paging_path_args(args) ⇒ Object
Instance Method Details
#page_link(text, page, options) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 53 def page_link text, page, return content_tag(:div, text.html_safe, class: "page-link") unless page .merge! class: "card-paging-link slotter page-link", remote: true, path: page_link_path_args(page) link_to raw(text), end |
#page_link_li(text, page, status, options = {}) ⇒ Object
First page is 0 (not 1)
43 44 45 46 47 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 43 def page_link_li text, page, status, ={} wrap_with :li, class: page_link_li_class(status) do page_link text, page, end end |
#page_link_li_class(status) ⇒ Object
49 50 51 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 49 def page_link_li_class status ["page-item", PAGE_LI_CLASS[status]].compact.join " " end |
#page_link_path_args(page) ⇒ Object
77 78 79 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 77 def page_link_path_args page paging_path_args.merge offset: page * limit end |
#paging_links ⇒ Object
36 37 38 39 40 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 36 def paging_links PagingLinks.new(total_pages, current_page).build 5 do |text, page, status, | page_link_li text, page, status, end end |
#paging_path_args(local_args = {}) ⇒ Object
70 71 72 73 74 75 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 70 def paging_path_args local_args={} @paging_path_args ||= {} @paging_path_args.reverse_merge!(limit: limit, offset: offset) @paging_path_args.merge! extra_paging_path_args @paging_path_args.merge local_args end |
#view: paging ⇒ Object
34 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 34 view :paging, cache: :never, template: :haml |
#with_paging(path_args = {}) ⇒ Object
28 29 30 31 32 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 28 def with_paging path_args={} with_paging_path_args path_args do output [yield(@paging_path_args), render_paging] end end |
#with_paging_path_args(args) ⇒ Object
62 63 64 65 66 67 68 |
# File 'platypus/tmp/set/gem-defaults/mod002-collection/abstract/paging/paging_views.rb', line 62 def with_paging_path_args args tmp = @paging_path_args @paging_path_args = paging_path_args args yield ensure @paging_path_args = tmp end |