This commit is contained in:
Christoph Haas 2021-03-10 01:04:43 +01:00
parent 5d0e4a520e
commit f9130c6972
2 changed files with 0 additions and 33 deletions

View file

@ -56,7 +56,6 @@ class Package < ApplicationRecord
Package.joins(:screenshots).where('screenshots.approved=false').distinct(:name)
end
# Return a query of all packages that do not have screenshots
def self.without_screenshots
# Query for all packages who's ID does not appear in a screenshot's "package_id" field
@ -64,21 +63,6 @@ class Package < ApplicationRecord
where.not(id: subselect)
end
# Return a query of all approved/public screenshots of this package
def screenshots_approved
self.screenshots.where(approved: true)
end
# Return a query of all approved/public screenshots of this package
def screenshots_pending
self.screenshots.where(approved: false)
end
# Return a list of packages that have unapproved screenshots
def self.requiring_moderation
self.joins(:screenshots).where(screenshots: {approved:false}).distinct(:name)
end
# Get all screenshots and have them sorted descendingly by their version number (Debian style).
def screenshots_sorted_by_version
self.screenshots.to_a.sort { |x,y| version_compare(x.version,y.version) }

View file

@ -1,17 +0,0 @@
/ Ask the user to add a description if not yet done
- if screenshot.description.blank?
/ TODO: Allow the user to edit the screenshot's description again?
div
= form_for screenshot, url: update_screenshot_description_path(screenshot) do |f|
label for='description' Please add a short description of this screenshot:
.input-group
span.input-group-label = fa_icon 'edit wobble'
= f.text_field 'description', class: 'input-group-field', maxlength: 80
.input-group-button
= f.submit 'Save', class: 'button success'
/ Offer to delete the screenshot
a.button.small.alert[
href=delete_screenshot_path(screenshot.id)
onclick="return confirm('Really delete your screenshot again?');"
] Delete your screenshot