Git Product home page Git Product logo

poirot's People

Contributors

carlosramireziii avatar clemenshelm avatar dcu avatar ismasan avatar olivernn avatar shawndrost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

poirot's Issues

New version of mustache.js

Is it possible to have the last version of mustache.js? As it is stated here:

"NOTICE: The dot notation feature was recently implemented for the 0.4 release, which is not out as of Nov 9 2011. You can find the feature in the current master branch of mustachejs".

This new version brings the dot notation feature!

Rails 4?

I'm finally upgrading an app to Rails 4 which relies heavily on Poirot. Upon server side render of a partial I'm getting:

undefined method `_partial_renderer' for #<ActionView::Renderer:0x007fde81364b08>

I assume this is because Rails 4 is not supported. Correct? What are my options?

Poirot With Cells

I'm trying to use Cells [https://github.com/apotonick/cells] to create reusable view components. The view that I want to make reusable already exists, and it uses Poirot templates. The problem is template_include_tag which requires that all templates live inside of app\views whereas Cell keeps its view templates in app\cells.

A secondary problem is that, while cells are like controllers, they don't implement the controller_name method. This could be hacked around using an absolute path if Poirot had some way to either specify a rooted path (kinda yuck) or to search for templates in the current folder. Regarding this last suggestion I'm not sure if there is a way to know from a helper what file it's running from. If not, maybe there could be some way to denote that the file references is rooted at app instead of app/views. Perhaps like ~/path/to/mustache/template

undefined method `view_renderer'

I am getting this error with rails 3.0.10:

undefined method `view_renderer' for #<#<Class:0x0000000b9d2fc8>:0x0000000b9ccc90>

in

vendor/gems/poirot/lib/poirot/view.rb:41:in `assign_variables!'

Poirot::View does not support Rails' render

Trying to use Rails' render method inside a Poirot::View when trying to render a rails partial call's Mustache's render (which is fine, but should be called out clearly in documentation).

The solution is to use controller.render_to_body if you want to render a partial into a mustache template. Again, just a doc update.

Best,
@jasim and @kaiwren

Support partials

It'd be nice if I could use the {{> partial}} syntax to render partials. Right now it doesn't find the partial; perhaps it's not going through the Rails asset pipeline at all?

Work with ActionMailer

Hey, is there a way to get this to work for ActionMailer as well? Currently when I try to use a foo.text.mustache template, I get an exception in my Mailer class:

ActionView::Template::Error: undefined method `params' for #<MyMailer:0x007fa738e84c20>
    path/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.11/lib/action_view/helpers/controller_helper.rb:10:in `params'
    from path/.rvm/gems/ruby-1.9.3-p194/gems/poirot-0.2.4/lib/poirot/view.rb:8:in `initialize'

Use erb or haml in stache templates

It would be wonderful if stache could handle template files like _posts.html.haml.mustache or _posts.html.erb.mustache.
Is is possibile? I can help if you provide me with the right directions!

Thank you for this wonderful gem!

poirot not defined?

Thanks for the great gem. The only thing I'm having trouble with is accessing my templates client-side using poirot.viewName(), as it seems poirot isn't being defined in my js.

I'm using Rails 3.1, and the rails g poirot:installer isn't available. Any ideas as to what the issue might be?

Thanks again

segmentation fault when rendering a partial

I am rendering a haml partial inside a Poirot::View subclass, something like this

class IndexView
    def add_something
        render :partial  => "path/to/haml/partial"
    end
 end

the rails process crashes with SEG FAULT in the "render :partial" line

Problem with parameterize in cucumber/selenium

When I run cucumber/selenium the execution gets stuck when template_include_tag is called. After playing around with it, I realized that the parameterize call causes this error.

I came up with a patch for the whole method (because also the template file wouldn't get closed):

module Poirot
  module AssetHelper
    def template_include_tag(*sources)
      sources.collect do |source|
        template = File.read(resolve_partial_path(source))
        template_name = source.to_s.split('/').last.dasherize
        content_tag :script, template.html_safe, :type => "text/mustache", :id => "#{template_name}-template"
      end.join("\n").html_safe
    end
  end
end

This works perfectly for me and even the template_name method is obsolete. Is there a case where parameterize is really necessary?

Poirot::View method_missing glitch

Hello,

I'm working on a copy of poirot that I have adapted for my needs, in the context of a 3.1 mountable engine, so I'm not sure if the problem exists on your version, but just in case you hit it :

I had to change the method_missing method in Poirot::View : https://github.com/olivernn/poirot/blob/master/lib/poirot/view.rb#L18

When I was calling "new_whatever_path" in a subclass, it returned me nil. Problem is, instance_var was tested to see if it was defined, which I don't understand how it can not be, since it's defined in the previous line.

So, I changed the method to :

def method_missing(method_name, *args, &block)
  if instance_variable_defined?( "@#{method_name}" ) && args.empty?
    instance_variable_get("@#{method_name}")
  else
    view_context.send(method_name,*args, &block)
  end
end

Accessing View Class Methods via poirot JS

Hopefully my last issue. Any help would be greatly appreciated.

I'm trying to access my helper methods in my optional view class. For example:

# View Class
module Users
  class UserListView < Poirot::View
    def foo
      "bar"
    end
  end
end
// JS call (coffeescript)
users = poirot.userList()

When loading the template with data, anything I define inside the JS obviously makes it into the view except for {{ foo }}.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.