Skip to content

Commit

Permalink
fixed and simplified materialize combo nav
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed May 12, 2021
1 parent 789773b commit 37c65a8
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 109 deletions.
20 changes: 10 additions & 10 deletions lib/pagy/extras/materialize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ def pagy_materialize_combo_nav_js(pagy, deprecated_id=nil, pagy_id: nil, link_ex
link = pagy_link_proc(pagy, link_extra: link_extra)
p_page = pagy.page
p_pages = pagy.pages
style = ' style="vertical-align: middle;"'
input = %(<input type="number" class="browser-default" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 2px; border: none; border-radius: 2px; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
style = ' style="vertical-align: middle"'
input = %(<input type="number" class="browser-default" min="1" max="#{p_pages}" value="#{p_page}" style="text-align: center; width: #{p_pages.to_s.length+1}rem;">)

%(<div#{p_id} class="pagy-materialize-combo-nav-js pagination" role="navigation" aria-label="pager"><div class="pagy-compact-chip" role="group" style="height: 35px; border-radius: 18px; background: #e4e4e4; display: inline-block;"><ul class="pagination" style="margin: 0" #{
pagy_json_attr pagy, :combo_nav, p_page, pagy_marked_link(link)
%(<ul#{p_id} class="pagy-materialize-combo-nav-js pagination btn" role="navigation" aria-label="pager" style="padding-right: 0" #{
pagy_json_attr pagy, :combo_nav, p_page, pagy_marked_link(link)
}>#{
pagy_materialize_prev_html pagy, link, style
}<div class="pagy-combo-input btn-flat" style="cursor: default; padding: 0px">#{
pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages
}</div>#{
pagy_materialize_next_html pagy, link, style
}</ul></div>)
pagy_materialize_prev_html pagy, link, style
}<li class="pagy-combo-input">#{
pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages
}</li>#{
pagy_materialize_next_html pagy, link, style
}</ul>)
end

private
Expand Down
8 changes: 0 additions & 8 deletions test/e2e/public/normalize-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ ul li,
margin-right: .3em;
}

/* normalize materialize combo specific */
.pagy-materialize-combo-nav-js .pagy-compact-chip {
height: auto !important;
background: none !important;
border-radius: 0 !important;
display: inline-flex !important;
}

/* normalize missing chevron icons (materialize and semantic) */
li i.material-icons,
.item i.chevron {
Expand Down
Loading

0 comments on commit 37c65a8

Please sign in to comment.