Sha256: d1ba8cef2b63dff770d4493f6d6d0bd78bfe3353b542aa719197026ff7a22064

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

module Espresso
  module Helpers
    include WillPaginate::ViewHelpers

    def simple_search
      returning '' do |form|
        form << form_tag(url_for(:action => :index), :method => :get)
        form << content_tag(:table, :class => 'b_search') do
                  content_tag(:tr) do
                    returning '' do |result|
                      result << content_tag(:td,
                                            content_tag(:div, text_field_tag(:q, params[:q], :type => 'search'), :class => 'b_input'),
                                            :class => 'input')
                      result << content_tag(:td,
                                            submit_tag(t('krasivotokak.espresso.find', :default => 'Find!'), :class => 'submit'),
                                            :class => 'button')
                    end
                  end
                end
        form << yield if block_given?
        form << '</form>'
      end
    end

    def will_paginate_with_i18n(collection, options = {})
      will_paginate_without_i18n(collection,
                                 options.merge({
        :class => 'b_pagination',
        :previous_label => t('krasivotokak.espresso.previous', :default => '← Previous'),
        :next_label =>     t('krasivotokak.espresso.next', :default => 'Next →')}))
    end
    alias_method_chain :will_paginate, :i18n
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
espresso-0.1.1 lib/espresso/helpers.rb
espresso-0.1.0 lib/espresso/helpers.rb