FormTag

Inherits:
Liquid::Block
  • Object
show all
Includes:
RenderView
Defined in:
app/tags/form_tag.rb

Constant Summary

ORGANIZATION_DEPENDENTS =
%w(login register password_request password_reset)

Instance Method Summary (collapse)

Constructor Details

- (FormTag) initialize(tag_name, markup, options)

Returns a new instance of FormTag



6
7
8
9
10
11
12
13
14
15
16
# File 'app/tags/form_tag.rb', line 6

def initialize(tag_name, markup, options)
  super

  @form_html_options = {}
  @form_type         = markup.split(',')[0].strip

  markup.scan(Liquid::TagAttributes) do |key, value|
    # FIXME: Possivel falha de seguranca aqui por permitir simbolizar dados vindos do usuario
    @form_html_options[key.to_sym] = value
  end
end

Instance Method Details

- (Object) render(context)



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/tags/form_tag.rb', line 18

def render(context)
  @context    = context
  @form_type  = @context[@form_type]
  @form       = initialize_form
  @resource   = @context[@form[:resource_key]]
  @school     = @context['current_school']
  @form_token = @context['authenticity_token']

  @context.stack do
    @context['form'] = {
      'notice' => @context['notice'],
      'errors' => @resource ? @resource['errors'] : @context['alert']
    }
    @html_block = render_all(@nodelist, @context)
  end

  render_view('form')
end