Merge branch 'master' of git.workaround.org:chaas/debshots
This commit is contained in:
commit
773548afc3
22 changed files with 303 additions and 75 deletions
7
app/views/json/package.json.jbuilder
Normal file
7
app/views/json/package.json.jbuilder
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
json.package @p.name
|
||||
|
||||
json.screenshots @p.screenshots do |s|
|
||||
json.small_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:large, timestamp: false)}"
|
||||
json.version s.version
|
||||
end
|
||||
6
app/views/json/packages.json.jbuilder
Normal file
6
app/views/json/packages.json.jbuilder
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
json.cache! ['json_packages'], expires_in: 1.hour do
|
||||
json.packages @p do |p|
|
||||
json.extract! p, :maintainer, :name, :section, :maintainer_email, :homepage, :description
|
||||
json.url package_url(p.name)
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
json.cache! ['json_packages'], expires_in: 1.hour do
|
||||
json.packages @p do |p|
|
||||
json.extract! p, :name
|
||||
end
|
||||
end
|
||||
10
app/views/json/screenshots.json.jbuilder
Normal file
10
app/views/json/screenshots.json.jbuilder
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
json.cache! ['json_screenshots'], expires_in: 1.hour do
|
||||
json.screenshots @s do |s|
|
||||
p = s.package
|
||||
json.extract! s, :version
|
||||
json.extract! p, :maintainer, :name, :section, :maintainer_email, :homepage, :description
|
||||
json.url package_url(p.name)
|
||||
json.small_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:large, timestamp: false)}"
|
||||
end
|
||||
end
|
||||
19
app/views/packages/_long_description.slim
Normal file
19
app/views/packages/_long_description.slim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/ Converts long descriptions from Debian control files into
|
||||
/ proper HTML.
|
||||
/ See: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
|
||||
|
||||
- text.lines.each do |line|
|
||||
/ pre +++#{line}---
|
||||
- case line.rstrip
|
||||
- when '.'
|
||||
/ Empty line
|
||||
/ TODO: Technically wrong because this creates an empty paragraph:
|
||||
p
|
||||
- when /^(\s+)(.+)/
|
||||
/ Verbatim text
|
||||
div.description-verbatim-lines
|
||||
= (' ' * $1.to_s.length).html_safe
|
||||
= $2
|
||||
- else
|
||||
/ Normal text
|
||||
= line
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
'Manage your screenshot
|
||||
.dropdown-pane data-dropdown=true id="admin-info-#{screenshot.id}"
|
||||
a.button.small.alert[
|
||||
href=delete_screenshot_path(@package.name, screenshot.id)
|
||||
href=delete_screenshot_path(screenshot.id)
|
||||
onclick="return confirm('Really delete the screenshot?');"
|
||||
] Delete screenshot
|
||||
p Write a description for this screenshot:
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@
|
|||
.text-center
|
||||
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)
|
||||
- if screenshot.description
|
||||
.imgcaption =screenshot.description
|
||||
- if screenshot.version.present?
|
||||
.imgcaption
|
||||
em '(from version #{screenshot.version})
|
||||
- if user_signed_in?
|
||||
.imgcaption
|
||||
em =screenshot.adminstatus
|
||||
div
|
||||
- if screenshot.description
|
||||
.imgcaption =screenshot.description
|
||||
- if screenshot.version.present?
|
||||
em.imgcaption
|
||||
'(from version #{screenshot.version})
|
||||
- if user_signed_in?
|
||||
em.imgcaption Admin status: #{screenshot.adminstatus}
|
||||
|
||||
// Is the user an admin?
|
||||
- if user_signed_in?
|
||||
|
|
@ -44,7 +44,8 @@
|
|||
p.subtitle Description
|
||||
// TODO: split long_description by <p> tags
|
||||
- if @package.long_description.present?
|
||||
p =@package.long_description
|
||||
= render(partial: 'long_description', locals: {text: @package.long_description})
|
||||
/ p =@package.long_description
|
||||
- else
|
||||
p Sorry - no more information available.
|
||||
- if @package.homepage.present?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue