lib/avo/fields/has_base_field.rb in avo-2.9.2.pre1 vs lib/avo/fields/has_base_field.rb in avo-2.10.0
- old
+ new
@@ -27,11 +27,14 @@
def turbo_frame
"#{self.class.name.demodulize.to_s.underscore}_#{display}_#{id}"
end
def frame_url
- "#{@resource.record_path}/#{id}?turbo_frame=#{turbo_frame}"
+ Avo::Services::URIService.parse(@resource.record_path)
+ .append_path(id.to_s)
+ .append_query(turbo_frame: turbo_frame.to_s)
+ .to_s
end
# The value
def field_value
value.send(database_value)
@@ -56,9 +59,25 @@
end
end
def placeholder
@placeholder || I18n.t("avo.choose_an_option")
+ end
+
+ def has_own_panel?
+ true
+ end
+
+ def visible_in_reflection?
+ false
+ end
+
+ # Adds the view override component
+ # has_one, has_many, has_and_belongs_to_many fields don't have edit views
+ def component_for_view(view = :index)
+ view = :show if view.in? [:new, :create, :update, :edit]
+
+ super view
end
end
end
end