Module: Zafu::ControllerMethods::Common

Included in:
Zafu::ControllerMethods, ViewMethods
Defined in:
lib/zafu/controller_methods.rb

Instance Method Summary collapse

Instance Method Details

#fquote(text) ⇒ Object

Quote for html attributes (field quote). There might be a better rails alternative to this.



33
34
35
# File 'lib/zafu/controller_methods.rb', line 33

def fquote(text)
  text.to_s.gsub("'",''')
end

#get_template_text(path, base_path) ⇒ Object

This method should return the template for a given ‘src’ and ‘base_path’.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/zafu/controller_methods.rb', line 39

def get_template_text(path, base_path)
  [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



51
52
53
# File 'lib/zafu/controller_methods.rb', line 51

def template_url_for_asset(opts)
  opts[:src]
end

#zafu_contextObject



28
29
30
# File 'lib/zafu/controller_methods.rb', line 28

def zafu_context
  @zafu_context ||= {}
end