Sha256: 68fcbd65db0fde901eb48d72ff8eb09d4c8bc8560031c8031b212a18b1cca888

Contents?: true

Size: 500 Bytes

Versions: 9

Compression:

Stored size: 500 Bytes

Contents

module Georgia
  class ActiveFacetPresenter < Presenter

    attr_reader :text, :param

    def initialize view_context, text, param, options={}
      super
      @text = text
      @param = param
      @options = options
    end

    def to_s
      link_to url_for(unmerged_params), class: 'label label-primary' do
        "#{text} #{icon_tag('times')}".html_safe
      end
    end

    private

    def unmerged_params
      params.merge(param => ((params[param] || []) - [text]))
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
georgia-0.7.8 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.7 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.6 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.5 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.4 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.3 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.2 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.1 app/presenters/georgia/active_facet_presenter.rb
georgia-0.7.0 app/presenters/georgia/active_facet_presenter.rb