Class: Optimacms::TemplateTranslation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Optimacms::TemplateTranslation
- Defined in:
- app/models/optimacms/template_translation.rb
Instance Method Summary collapse
-
#content ⇒ Object
content.
- #content=(v) ⇒ Object
-
#filename_base ⇒ Object
base filename depending on type for page = name for partial = _name.
- #fullpath ⇒ Object
- #path ⇒ Object
Instance Method Details
#content ⇒ Object
content
11 12 13 14 15 16 |
# File 'app/models/optimacms/template_translation.rb', line 11 def content filename = fullpath return nil if filename.nil? return '' if !File.exists? filename File.read(filename) end |
#content=(v) ⇒ Object
18 19 20 21 22 |
# File 'app/models/optimacms/template_translation.rb', line 18 def content=(v) File.open(self.fullpath, "w+") do |f| f.write(v) end end |
#filename_base ⇒ Object
base filename depending on type for page = name for partial = _name
30 31 32 33 |
# File 'app/models/optimacms/template_translation.rb', line 30 def filename_base return '_'+basename if is_type_partial? basename end |
#fullpath ⇒ Object
41 42 43 44 45 |
# File 'app/models/optimacms/template_translation.rb', line 41 def fullpath f = path return nil if f.nil? Template.base_dir + f end |
#path ⇒ Object
36 37 38 39 |
# File 'app/models/optimacms/template_translation.rb', line 36 def path return nil if basename.nil? basedirpath + filename_base + Template.filename_lang_postfix(lang) + Template.filename_ext_with_dot(self.tpl_format) end |