Class | Page
In: | app/models/page.rb
Parent: | Document

Clase para las páginas de información

### Methods

disable_unnecessary_fields intro_agencia privacy set_and_create_multimedia_path terms_of_service

### Included Modules

DraftUtils::InstanceMethods

### Public Class methods

intro_agencia()

Texto de presentación de la Agencia Multimedia

[Source]

        # File app/models/page.rb, line 72
    72:   def self.intro_agencia
    73:     intros = Page.find_tagged_with("_intro_agencia", :scope => :private, :limit => 1)
    74:     if intros.length > 0
    75:       return intros.first
    76:     else
    77:       return nil
    78:     end
    79:   end

privacy()

Texto de las normas de uso

[Source]

        # File app/models/page.rb, line 82
    82:   def self.privacy
    83:     tos_intros = Page.find_tagged_with("_privacidad", :scope => :private, :limit => 1)
    84:     if tos_intros.length > 0
    85:       return tos_intros.first
    86:     else
    87:       return nil
    88:     end
    89:   end

terms_of_service()

Texto de las normas de uso

[Source]

        # File app/models/page.rb, line 62
    62:   def self.terms_of_service
    63:     tos_intros = Page.find_tagged_with("_normas_de_uso", :scope => :private, :limit => 1)
    64:     if tos_intros.length > 0
    65:       return tos_intros.first
    66:     else
    67:       return nil
    68:     end
    69:   end

### Public Instance methods

disable_unnecessary_fields()

Las páginas comparten tabla con News y Event y algunas de las columnas no son necesarias para las páginas. Aquí se vacían. Se llama desde before_save

[Source]

        # File app/models/page.rb, line 22
    22:   def disable_unnecessary_fields
    23:     self.has_comments = false
    24:     self.comments_closed = true
    25:     self.has_comments_with_photos = false
    26:     self.has_ratings = false
    27:     # self.video_path = nil
    28:     # self.audio_path = nil
    29:     # self.photos_path = nil
    30:     # self.files_path = nil
    31:     self.comments_count = 0
    32:     self.starts_at = nil
    33:     self.ends_at = nil
    34:     self.place = nil
    35:     self.speaker_es = nil
    36:     self.speaker_eu = nil
    37:     self.speaker_en = nil
    38:     self.lat = nil
    39:     self.lng = nil
    40:     self.location_for_gmaps = nil
    41:
    42:     self.show_in_agencia = nil
    43:     self.cover_photo_file_name = nil
    44:     self.cover_photo_content_type = nil
    45:     self.cover_photo_file_size = nil
    46:     self.cover_photo_updated_at = nil
    47:
    48:     self.show_in_irekia = true
    49:     self.stream_flow_id = false
    50:     self.journalist_alert_version = 0
    51:     self.staff_alert_version = 0
    52:   end

set_and_create_multimedia_path()

Crea el directorio donde irán los contenidos multimedia de esta página. Se llama desde before_create

[Source]

        # File app/models/page.rb, line 12
    12:   def set_and_create_multimedia_path
    13:     self.multimedia_path = "paginas/#{self.multimedia_dir}/"
    14:     FileUtils.mkdir_p(Document::MULTIMEDIA_PATH + self.multimedia_path)
    15:   end

[Validate]