Add form to assign targets to a record
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<%= header %>
|
||||
|
||||
<%= form_for record, url: update_path do |f| %>
|
||||
<%= f.text_field :sdg_target_list %>
|
||||
|
||||
<%= f.submit %>
|
||||
<% end %>
|
||||
24
app/components/sdg_management/relations/edit_component.rb
Normal file
24
app/components/sdg_management/relations/edit_component.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class SDGManagement::Relations::EditComponent < ApplicationComponent
|
||||
include Header
|
||||
|
||||
attr_reader :record
|
||||
|
||||
def initialize(record)
|
||||
@record = record
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def title
|
||||
@record.title
|
||||
end
|
||||
|
||||
def update_path
|
||||
{
|
||||
controller: "sdg_management/relations",
|
||||
action: :update,
|
||||
relatable_type: record.class.name.tableize,
|
||||
id: record
|
||||
}
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user