lib/pagy/extras/items.rb in pagy-0.9.1 vs lib/pagy/extras/items.rb in pagy-0.9.2

- old
+ new

@@ -1,6 +1,7 @@ # See the Pagy documentation: https://ddnexus.github.io/pagy/extras/items +# frozen_string_literal: true class Pagy # Default variables for this extra VARS[:items_param] = :items @@ -29,14 +30,14 @@ # return the items selector HTML. For example "Show [20] items per page" def pagy_items_selector(pagy, id=caller(1,1)[0].hash) pagy = pagy.clone; p_vars = pagy.vars; p_items = p_vars[:items]; p_vars[:items] = "#{MARKER}-items-" - tags = %(<span id="pagy-items-#{id}">) + tags = +%(<span id="pagy-items-#{id}">) tags << %(<a href="#{pagy_url_for("#{MARKER}-page-", pagy)}"></a>) input = %(<input type="number" min="1" max="#{p_vars[:max_items]}" value="#{p_items}" style="padding: 0; text-align: center; width: #{p_items.to_s.length+1}rem;">) - tags << %(#{pagy_t('pagy.items.show'.freeze)} #{input} #{pagy_t('pagy.items.items'.freeze)}) + tags << %(#{pagy_t('pagy.items.show')} #{input} #{pagy_t('pagy.items.items')}) tags << %(</span><script>PagyItems('#{id}', '#{MARKER}', #{pagy.from});</script>) end end