Class: RubyUIAdmin::Views::Form

Inherits:
Base
  • Object
show all
Includes:
StructureRenderer
Defined in:
app/components/ruby_ui_admin/views/form.rb

Instance Method Summary collapse

Methods included from StructureRenderer

#render_structure

Methods inherited from Base

#authorized_to?, #view_template

Methods included from Translation

#rua_t

Methods included from PathHelpers

#attachment_url, #resource_edit_path, #resource_index_path, #resource_new_path, #resource_show_path

Constructor Details

#initialize(resource:, record:, view:) ⇒ Form

Returns a new instance of Form.



8
9
10
11
12
# File 'app/components/ruby_ui_admin/views/form.rb', line 8

def initialize(resource:, record:, view:)
  @resource = resource
  @record = record
  @view = view.to_sym
end

Instance Method Details

#contentObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/components/ruby_ui_admin/views/form.rb', line 18

def content
  render_header
  render_errors_summary

  form(action: form_action, method: "post", enctype: form_enctype, class: "space-y-6") do
    hidden_method_field
    csrf_field

    render_structure(@resource.field_structure(view: @view))

    render_actions
  end
end

#page_titleObject



14
15
16
# File 'app/components/ruby_ui_admin/views/form.rb', line 14

def page_title
  "#{title_prefix} ยท #{RubyUIAdmin.configuration.app_name}"
end