0.0
No release in over 3 years
Low commit activity in last 3 years
it should ease the pain of creating a presenter that requires to access Rails helper methods
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
= 4.1.8
~> 10.0
~> 1.3
 Project Readme

RailsPresenter::Base

  • Gem Version
  • Quality
  • Coverage
  • Build
  • Build Status
  • Dependencies
  • Downloads
  • Tags
  • Releases
  • Issues
  • Version

it should ease the pain of creating a presenter that requires to access Rails helper methods

  • it should be able to call rails render method for partials
  • it should be able to use capture(&block).to_s
  • it should be able to use helper methods such as content_tag
  • when using image_tag, it should be able to find content in app/assets

Installation

Add this line to your application's Gemfile:

gem 'rails-presenter'

And then execute:

$ bundle

Usage

class ExamplePresenter < RailsPresenter::Base

  # This is important, you need to call super, for the asset pipeline to work.
  def initialize
    super()
  end

  def example_image_from_the_pipeline
    image_tag('image.png')
  end

  def example_render_partial(view)
    view.render('partial/part', title: 'text')
  end

  def example_yield_content
    yield
  end

  def example_content_tag
    content_tag(:article, 'foo'.html_safe, class: 'foo', id: 'bar')
  end

end

Contributing

  1. Fork it ( https://github.com/somekool/rails-presenter/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Carefully look at your changes (git diff)
  4. Individually stage files (git add)
  5. Commit your changes (git commit -m 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create a new Pull Request