class Humpyard::Element

Humpyard::Element is a model of an element to display on a Humpyard::Page.

Constants

SHARED_STATES

Elements can be shared on other pages. this adds unshared?, shared_on_siblings?, shared_on_children? getters plus to_unshared, to_shared_on_siblings, to_shared_on_children “setters”

Public Instance Methods

last_modified() click to toggle source

Return the logical modification time for the element.

# File app/models/humpyard/element.rb, line 48
def last_modified
  rails_root_mtime = Time.zone.at(::File.new("#{Rails.root}").mtime)
  timestamps = [rails_root_mtime, self.updated_at]
  timestamps.sort.last
end
stamp_page_modified_now() click to toggle source
# File app/models/humpyard/element.rb, line 22
def stamp_page_modified_now
  # Set page's modified_at to now without changing it's last_updated_at column
  Page.update_all ['modified_at = ?', Time.now], ['id = ?', page.id]
  
  # TODO: set other pages' modified_at if element is shared
end