Class: Views::Resources::Form

Inherits:
Base
  • Object
show all
Defined in:
app/views/resources/form.rb

Direct Known Subclasses

Edit, New

Instance Method Summary collapse

Instance Method Details

#available_fieldsObject



21
22
23
24
25
# File 'app/views/resources/form.rb', line 21

def available_fields
  resource.fields.reject do |key, value|
    key.starts_with?("_")
  end
end

#body_contentObject



2
3
4
5
6
7
# File 'app/views/resources/form.rb', line 2

def body_content
  form do |form|
    fields(form)
    buttons(form)
  end
end

#buttons(form) ⇒ Object



15
16
17
18
19
# File 'app/views/resources/form.rb', line 15

def buttons(form)
  div class: 'buttons' do
    form.submit
  end    
end

#fields(form) ⇒ Object



9
10
11
12
13
# File 'app/views/resources/form.rb', line 9

def fields(form)
  available_fields.each do |key, value|
    input(form, key, :text_field)
  end
end