app/forms/tramway/landing/block_form.rb in tramway-landing-1.4.7.4 vs app/forms/tramway/landing/block_form.rb in tramway-landing-1.5
- old
+ new
@@ -1,7 +1,7 @@
class Tramway::Landing::BlockForm < ::Tramway::Core::ApplicationForm
- properties :title, :background, :view_state, :block_type, :position, :navbar_link, :anchor, :description, :link_object_type, :link_object_id
+ properties :title, :background, :view_state, :block_type, :position, :navbar_link, :anchor, :description, :link_object_type, :link_object_id, :button
def initialize(object = nil)
form_object = super object
form_properties title: :string,
background: :file,
@@ -9,9 +9,29 @@
block_type: :default,
navbar_link: :default,
anchor: :string,
description: :ckeditor,
link_object_type: :default,
- link_object_id: :numeric
+ link_object_id: :numeric,
+ button_title: :string,
+ button_link: :string
form_object
+ end
+
+ def button_title
+ model.button&.require(:title) || ""
+ end
+
+ def button_link
+ model.button&.require(:link) || ""
+ end
+
+ def button_title=(value)
+ model.button[:title] = value
+ model.save
+ end
+
+ def button_link=(value)
+ model.button[:link] = value
+ model.save
end
end