Merge branch 'master' of bitbucket.org:signum/debshots

Conflicts:
	app/views/packages/details.slim
This commit is contained in:
Christoph Haas 2015-04-25 20:09:28 +02:00
commit ce5f99887d
28 changed files with 656 additions and 352 deletions

View file

@ -1,7 +1,7 @@
// -------------- debshots ---------------------------
$page-background: #f2f2f2;
$page-background: #e8e8e8;
$footer-background: #333333;
$footer-text-color: #b3b3b3;
@ -148,6 +148,11 @@ html, body {
{
width: 100%;
}
img
{
box-shadow: 3px 3px 10px 0px #888888;
}
}
.row .gridview
@ -228,6 +233,7 @@ a.black
.imgcaption
{
text-align: center;
font-variant: italic;
}
/* Status of a screenshot (e.g. if it has to be moderated) */

View file

@ -1,39 +1,12 @@
class PackagesController < ApplicationController
def index
@packages = Package.includes(:screenshots)
if params[:query]
@packages = @packages.text_search(params[:query])
end
unless params[:search].blank?
logger.debug "Searching for #{params[:search]}"
@packages = @packages.general_search(params[:search])
end
# Limit the packages to those that have approved screenshots.
# Also eager-load the screenshots.
if params[:show]=='onlywith'
@packages = @packages.where("screenshots.approved"=>true)
end
if params[:show]=='with'
@packages = @packages.with_screenshots
logger.debug 'Limiting packages to those with screenshots'
elsif params[:show]=='without'
@packages = @packages.without_screenshots
logger.debug 'Limiting packages to those without screenshots'
end
end
def list
index
@packages = query_packages
@packages = @packages.paginate(page: params[:page], per_page: 6)
render 'packages/index-list.slim'
end
def grid
index
@packages = query_packages
@packages = @packages.paginate(page: params[:page], per_page: 24)
render 'packages/index-grid.slim'
end
@ -93,10 +66,33 @@ class PackagesController < ApplicationController
private
# Send a dummy thumbnail reading "No screenshot available. Sorry."
# TODO: Make sure it uses X-Sendfile correctly in production
def thumbnail404
send_file Rails.root.join('public/images/dummy/no-screenshots-available.png'),
type: "image/png",
disposition: 'inline',
status: 404
end
# Return packages matching the criteria given by parameters
def query_packages
packages = Package.includes(:screenshots)
# text search
if params[:search].present?
logger.debug "Searching for #{params[:search]}"
packages = packages.general_search(params[:search])
end
case params[:show]
when 'with'
packages = packages.with_screenshots
logger.debug 'Limiting packages to those with screenshots'
when 'without'
packages = packages.without_screenshots
logger.debug 'Limiting packages to those without screenshots'
end
return packages
end
end

View file

@ -4,20 +4,20 @@
.small-7.medium-7.columns
p.subtitle = @package.description
- @package.screenshots.each do |screenshot|
.row.listview
.small-12.columns
a.black.fancybox href=screenshot.image.url(:large, timestamp: false) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)
.imgcaption =screenshot.caption
.imgstatus =screenshot.status
// TODO: Enable button only if admin or uploader
a.button.tiny.alert[
href=delete_screenshot_path(@package.name, screenshot.id)
onclick="return confirm('Really delete the screenshot?');"
] Delete screenshot
- if @package.screenshots.count > 0
- @package.screenshots.each do |screenshot|
.row.listview
.small-12.columns
a.black.fancybox href=screenshot.image.url(:large, timestamp: false) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)
.imgcaption =screenshot.caption
// TODO: Enable button only if admin or uploader
a.button.tiny.alert[
href=delete_screenshot_path(@package.name, screenshot.id)
onclick="return confirm('Really delete the screenshot?');"
] Delete screenshot
- else
img src='/images/dummy/no-screenshots-upload-one.svg' width='100%'
// TODO: Enable comments in a later version
// = partial '/package/comments'
@ -26,15 +26,9 @@
.bigpanel
// Use action long description
// TODO: Use actual description instead of placeholder text
p
' Mail client suitable for free distribution. It supports different mail
' accounts (POP, IMAP, Gmail), has an integrated learning Spam filter, and
' offers easy organization of mails with tagging and virtual folders. Also,
' more features can be added by installing extensions.
p
' The goal of Icedove is to produce a cross platform standalone mail
' application using the XUL user interface language.
// TODO: split long_description by <p> tags
// TODO: What to do if long description is missing?
p =@package.long_description
a.button.round.expand data-reveal-id="upload-modal" Upload more screenshots for #{@package.name}

View file

@ -86,6 +86,16 @@
' If you would like to get a complete list of packages or screenshots in JSON
' format then contact us and we will give you the URL.
h2 Some packages are not found
p
' That's right. We import the package repositories from various Linux
' distributions once a day. However we already filter out packages that
' we think would not be able to have a meaningful screenshot.
' Like libraries or documentation or developer packages. So it may happen
' that you a package is not found on this web sites although it may be
' available in your favorite Linux distribution.
h2 Uploading new screenshots
p

View file

@ -25,37 +25,37 @@
div.row
hr
div.row
div.large-4.medium-12.small-12.columns.text-center
h2 Newest upload
// TODO: load actual newest upload and cache it
// TODO: link to the package page
a.black href=package_path(@newest_uploaded_package.name)
img src=@newest_uploaded_package.screenshots.first.image.url(:large, timestamp: false)
p
strong
=@newest_uploaded_package.name
' :
'
=@newest_uploaded_package.description
div.large-4.medium-12.small-12.columns.text-center
h2 Most popular
// TODO: load actual most popular package and highest-rated screenshot and cache it
// TODO: link to the package page
a.black href=package_path(@most_popular_package.name)
img src=@most_popular_package.screenshots.first.image.url(:large, timestamp: false)
p
strong
=@most_popular_package.name
' :
'
=@most_popular_package.description
div.large-4.medium-12.small-12.columns.text-center
h2 Your help needed
// TODO: load actual most popular package without a screenshot and cache it
a href=upload_package_by_name_path('firefox')
img src="/images/dummy/no-screenshots-upload-one.svg" width="80%"
p
' We lack a screenshot for the Firefox package. Can you
a href=upload_package_by_name_path('firefox') provide one
' ?
/ div.row
/ div.large-4.medium-12.small-12.columns.text-center
/ h2 Newest upload
/ // TODO: load actual newest upload and cache it
/ // TODO: link to the package page
/ a.black href=package_path(@newest_uploaded_package.name)
/ img src=@newest_uploaded_package.screenshots.first.image.url(:large, timestamp: false)
/ p
/ strong
/ =@newest_uploaded_package.name
/ ' :
/ '
/ =@newest_uploaded_package.description
/ div.large-4.medium-12.small-12.columns.text-center
/ h2 Most popular
/ // TODO: load actual most popular package and highest-rated screenshot and cache it
/ // TODO: link to the package page
/ a.black href=package_path(@most_popular_package.name)
/ img src=@most_popular_package.screenshots.first.image.url(:large, timestamp: false)
/ p
/ strong
/ =@most_popular_package.name
/ ' :
/ '
/ =@most_popular_package.description
/ div.large-4.medium-12.small-12.columns.text-center
/ h2 Your help needed
/ // TODO: load actual most popular package without a screenshot and cache it
/ a href=upload_package_by_name_path('firefox')
/ img src="/images/dummy/no-screenshots-upload-one.svg" width="80%"
/ p
/ ' We lack a screenshot for the Firefox package. Can you
/ a href=upload_package_by_name_path('firefox') provide one
/ ' ?