8000 global config and template handler allowing custom view paths by zelig · Pull Request #38 · erector/erector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

global config and template handler allowing custom view paths #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zelig
8000
Copy link
Contributor
@zelig zelig commented Nov 17, 2012

I implemented some new features i've been longing for :)

  • rails template handler
    • widget resolvers to allow custom vew_paths with registered widget class prefix
    • widget resolvers to allow fallback to custom action (widget) libraries
    • template handler checks if template defines the right class
    • global setting for default class prefix, so everything works out of the box
    • rewritten render specs
# given render 'prefix/name' this resolver will correctly find '/path/to/widgets/prefix/name.html.rb'
# and the template handler expects it to define class 'virtual/class_prefix/prefix/name'
ActiveSupport.on_load(:action_controller) do
    append_view_path(WidgetLibraryResolver.new('virtual_class_prefix', '/path/to/widgets'))
end

# given render 'prefix/name' this resolver allows fall back '/path/to/widgets/name.html.rb'
# and the template handler expects it to define class 'virtual/class_prefix/name'
ActiveSupport.on_load(:action_controller) do
    append_view_path(ActionWidgetLibraryResolver.new('virtual_class_prefix', '/path/to/widgets'))
end
  • global settings:
    • global settings extracted, implemented the usual way with mattr_accessors on the Erector module
    • core and rails-specific configs are separated in erector/config and erector/rails/config respctively, config tests are separated too
    • set defaults and overrides implemented and tested where used (e.g., output, output_spec)
    • erector script also reads config
    • AbstractWidget.prettyprint_default deprecated
    • added rails3 initializer config generator with tests
Erector.setup do |config|

  # erector configuration - global settings
  # uncomment to change the defaults

  #config.ignore_extra_controller_assigns          = true
  #config.controller_assigns_propagate_to_partials = true
  #config.widget_class_name                        = 'Erector::Widget'
  #config.content_method                           = :content
  #config.prettyprint                              = false
  #config.indentation                              = 0
  #config.max_length                               = nil
  #config.add_accessors_for_needs                  = false
  #config.widget_class_prefix                      = "views"
end
  • full test coverage and some doc change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0