Sha256: 9ecec9e0f8ea2e00cd2f64f5886d2ba7a72889a264a0aa2200b852fe0f90c8de
Contents?: true
Size: 1.49 KB
Versions: 4
Compression:
Stored size: 1.49 KB
Contents
class Backend::PageTranslationForm < Udongo::Form attr_reader :page, :translation, :seo attribute :title, String attribute :subtitle, String attribute :seo_title, String attribute :seo_keywords, String attribute :seo_description, String attribute :seo_custom, String attribute :seo_slug, String validates :title, :seo_slug, presence: true delegate :id, to: :page def initialize(page, translation, seo) @page = page @translation = translation @seo = seo self.title = @translation.title self.subtitle = @translation.subtitle self.seo_title = @seo.title self.seo_keywords = @seo.keywords self.seo_description = @seo.description self.seo_custom = @seo.custom self.seo_slug = @seo.slug end def self.model_name Page.model_name end def persisted? true end def save(params) self.title = params[:title] self.subtitle = params[:subtitle] self.seo_title = params[:seo_title] self.seo_keywords = params[:seo_keywords] self.seo_description = params[:seo_description] self.seo_custom = params[:seo_custom] self.seo_slug = params[:seo_slug] if valid? save_object true else false end end private def save_object @translation.title = title @translation.subtitle = subtitle @translation.save @seo.title = seo_title @seo.keywords = seo_keywords @seo.description = seo_description @seo.custom = seo_custom @seo.slug = seo_slug @seo.save end end
Version data entries
4 entries across 4 versions & 1 rubygems