Module: Zafu::ControllerMethods::Common
- Included in:
- Zafu::ControllerMethods, ViewMethods
- Defined in:
- lib/zafu/controller_methods.rb
Instance Method Summary collapse
-
#fquote(text) ⇒ Object
Quote for html attributes (field quote).
-
#get_template_text(path, base_path, opts = {}) ⇒ Object
This method should return the template for a given ‘src’ and ‘base_path’.
- #template_url_for_asset(opts) ⇒ Object
- #zafu_context ⇒ Object
Instance Method Details
#fquote(text) ⇒ Object
Quote for html attributes (field quote). There might be a better rails alternative to this.
31 32 33 |
# File 'lib/zafu/controller_methods.rb', line 31 def fquote(text) text.to_s.gsub("'",''') end |
#get_template_text(path, base_path, opts = {}) ⇒ Object
This method should return the template for a given ‘src’ and ‘base_path’.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/zafu/controller_methods.rb', line 37 def get_template_text(path, base_path, opts={}) [path, "#{base_path}/#{path}"].each do |p| begin t = self.view_paths.find_template(p, 'html') # FIXME: format ? rescue ActionView::MissingTemplate t = nil end return [t.source, t.path, t.base_path] if t end nil end |
#template_url_for_asset(opts) ⇒ Object
49 50 51 |
# File 'lib/zafu/controller_methods.rb', line 49 def template_url_for_asset(opts) opts[:src] end |
#zafu_context ⇒ Object
26 27 28 |
# File 'lib/zafu/controller_methods.rb', line 26 def zafu_context @zafu_context ||= {} end |