Module: Publinator::ActsAsPublishable

Extended by:
ActiveSupport::Concern
Defined in:
lib/publinator.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#asset_files(asset_type_text = nil) ⇒ Object



50
51
52
53
# File 'lib/publinator.rb', line 50

def asset_files(asset_type_text = nil)
  return asset_items if !asset_type_text
  asset_items.where(:asset_type => asset_type_text)
end

#asset_typesObject



46
47
48
# File 'lib/publinator.rb', line 46

def asset_types
  []
end

#editable_fieldsObject



67
68
69
# File 'lib/publinator.rb', line 67

def editable_fields
  attribute_names - (["id", "created_at", "updated_at"] + hidden_fields)
end

#hidden_fieldsObject



63
64
65
# File 'lib/publinator.rb', line 63

def hidden_fields
  []
end

#is_publishable?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/publinator.rb', line 42

def is_publishable?
  true
end


84
85
86
# File 'lib/publinator.rb', line 84

def menu_collection
  nil
end

#my_slugObject



55
56
57
# File 'lib/publinator.rb', line 55

def my_slug
  slug
end

#pathObject



71
72
73
74
75
76
77
78
# File 'lib/publinator.rb', line 71

def path
  raise "publication not found" if !self.publication
  if self.publication.section
    "#{self.publication.section.path}/#{self.publication.slug}"
  else
    "/#{self.class.to_s.tableize}/#{self.publication.slug}"
  end
end


59
60
61
# File 'lib/publinator.rb', line 59

def related_items(scope)
  []
end

#urlObject



80
81
82
# File 'lib/publinator.rb', line 80

def url
  site.url(path)
end

#verify_publicationObject



88
89
90
91
92
93
94
95
# File 'lib/publinator.rb', line 88

def verify_publication
  if publication.nil?
    self.publication = Publinator::Publication.new(:publishable => self)
  end
  self.publication.site     = site unless publication.site.present?
  self.publication.section  = section unless !section
  self.publication.default  = default
end