mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
39 lines
674 B
Ruby
39 lines
674 B
Ruby
class Timeline < ApplicationRecord
|
|
acts_as_paranoid
|
|
|
|
include IsContentPage
|
|
include Authority::Abilities
|
|
self.authorizer_name = 'ExtendedContentAuthorizer'
|
|
|
|
validates :user_id, presence: true
|
|
|
|
belongs_to :universe, optional: true
|
|
belongs_to :user
|
|
|
|
has_many :timeline_events, -> { order(position: :asc) }, dependent: :destroy
|
|
|
|
include HasImageUploads
|
|
|
|
after_create :initialize_first_event
|
|
|
|
def self.content_name
|
|
'timeline'
|
|
end
|
|
|
|
def self.color
|
|
'green'
|
|
end
|
|
|
|
def self.hex_color
|
|
'#4CAF50'
|
|
end
|
|
|
|
def self.icon
|
|
'timeline'
|
|
end
|
|
|
|
def initialize_first_event
|
|
timeline_events.create(title: "Untitled Event", position: 1)
|
|
end
|
|
end
|