Recoverd methods for Screenshot model
This commit is contained in:
parent
42f9f85a48
commit
19a5ce81a5
1 changed files with 22 additions and 22 deletions
|
|
@ -9,26 +9,26 @@ class Screenshot < ActiveRecord::Base
|
|||
"#{Rails.configuration.images_path_prefix}/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
|
||||
end
|
||||
|
||||
## Get the URL leading to a screenshot of this package
|
||||
#def url(size)
|
||||
# if self.approved
|
||||
# # TODO: Make the path configurable
|
||||
# basepath = "/screenshots/approved/"
|
||||
# else
|
||||
# basepath = "/screenshots/unapproved/"
|
||||
# end
|
||||
#
|
||||
# File.join(basepath, self.package.name[0], self.package.name, "#{self.id}_#{size}.png")
|
||||
#end
|
||||
#
|
||||
## Return caption for full-screen screenshots.
|
||||
## Takes the description of a screenshot if available.
|
||||
## Otherwise it falls back to the general description of its package.
|
||||
#def caption
|
||||
# if self.description != ''
|
||||
# self.description
|
||||
# else
|
||||
# self.package.description
|
||||
# end
|
||||
#end
|
||||
# Get the URL leading to a screenshot of this package
|
||||
def url(size)
|
||||
if self.approved
|
||||
# TODO: Make the path configurable
|
||||
basepath = "/screenshots/approved/"
|
||||
else
|
||||
basepath = "/screenshots/unapproved/"
|
||||
end
|
||||
|
||||
File.join(basepath, self.package.name[0], self.package.name, "#{self.id}_#{size}.png")
|
||||
end
|
||||
|
||||
# Return caption for full-screen screenshots.
|
||||
# Takes the description of a screenshot if available.
|
||||
# Otherwise it falls back to the general description of its package.
|
||||
def caption
|
||||
if self.description != ''
|
||||
self.description
|
||||
else
|
||||
self.package.description
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue