Skip to content

reactormonk/styler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stylist

Summary

This implements view-aware models, yet not. It’s using the ProxyClass pattern.

See

IRC

#rango@irc.freenode.net

Baretest

github.com/apeiros/baretest

Description

You use Styler::RangoMixin to render (or any other mixin). Call the render method with (template, *model_instance_variables), and it will replace the mentioned instance variables with Styles. You can use Style variables simply by calling #to_s on them (HAML does that by default). The template path for the Style is compiled by using

“#{__class__.to_s.downcase.gsub(‘::’,‘/’)}/#{@type}”

where @type is :default by default. Choose any other by calling #as(type). If you want to add any context, pass them as a hash and they will be avaible as instance variables. If you need to delegate more methods to model/controller use #delegate and #delegate_to_controller. There’s a special #association delegater method avaible which handles context passing and so on.

I’m not yet sure what happens if you use this for collections. Gotta try that.

About

This implements view-aware models, yet not.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages