Sha256: 26b00d5a8aeb1b3a238b5200528c887537fb74829efd16923255a130dfd7a60b
Contents?: true
Size: 1.01 KB
Versions: 17
Compression:
Stored size: 1.01 KB
Contents
module Optimacms class TemplateTranslation < ActiveRecord::Base self.table_name = 'cms_templates_translation' belongs_to :template, :foreign_key => 'item_id', :class_name => 'Template' delegate :basename, :basedirpath, :tpl_format, :is_type_partial?, to: :template ### content def content filename = fullpath return nil if filename.nil? return '' if !File.exists? filename File.read(filename) end def content=(v) File.open(self.fullpath, "w+") do |f| f.write(v) end end ### path # base filename depending on type # for page = name # for partial = _name def filename_base return '_'+basename if is_type_partial? basename end def path return nil if basename.nil? basedirpath + filename_base + Template.filename_lang_postfix(lang) + Template.filename_ext_with_dot(self.tpl_format) end def fullpath f = path return nil if f.nil? Template.base_dir + f end end end
Version data entries
17 entries across 17 versions & 1 rubygems