Link to packages and screenshots (highlighted) from logs view
This commit is contained in:
parent
9a16bad007
commit
330536cb7e
4 changed files with 17 additions and 4 deletions
|
|
@ -598,3 +598,7 @@ a.black
|
||||||
#f0f0f0 10px
|
#f0f0f0 10px
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pkgcard.highlight {
|
||||||
|
border: 5px solid red;
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,12 @@ class PackagesController < ApplicationController
|
||||||
def details
|
def details
|
||||||
@package = Package.find_by(name: params[:name])
|
@package = Package.find_by(name: params[:name])
|
||||||
|
|
||||||
|
# Highlight a certain screenshot (by ID). This is used by the logs.slim
|
||||||
|
# view to link to a certain screenshot of a package.
|
||||||
|
if params[:highlight]
|
||||||
|
@highlight_id = params[:highlight].to_i
|
||||||
|
end
|
||||||
|
|
||||||
if @package.nil?
|
if @package.nil?
|
||||||
@packagename = params[:name]
|
@packagename = params[:name]
|
||||||
render 'notfound', status: 404
|
render 'notfound', status: 404
|
||||||
|
|
@ -177,7 +183,7 @@ class PackagesController < ApplicationController
|
||||||
# Check if the user is allowed to change this screenshot
|
# Check if the user is allowed to change this screenshot
|
||||||
# - Is this the user's own screenshot? (anonymous)
|
# - Is this the user's own screenshot? (anonymous)
|
||||||
if (@screenshot.user == current_user) || (can? :destroy, @screenshot)
|
if (@screenshot.user == current_user) || (can? :destroy, @screenshot)
|
||||||
auditlog "Screenshot #{@screenshot} deleted",
|
auditlog "Screenshot #{@screenshot.id} deleted",
|
||||||
package: @screenshot.package
|
package: @screenshot.package
|
||||||
@screenshot.destroy
|
@screenshot.destroy
|
||||||
flash['notice'] = "Screenshot deleted."
|
flash['notice'] = "Screenshot deleted."
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@
|
||||||
td #{log.section}
|
td #{log.section}
|
||||||
td
|
td
|
||||||
- if log.package
|
- if log.package
|
||||||
= log.package.name
|
= link_to log.package.name, log.package
|
||||||
- else
|
- else
|
||||||
' -
|
' -
|
||||||
td
|
td
|
||||||
- if log.screenshot
|
- if log.screenshot
|
||||||
= log.screenshot.id
|
= link_to log.screenshot.id, package_path(log.package, highlight: log.screenshot.id)
|
||||||
- else
|
- else
|
||||||
' -
|
' -
|
||||||
td
|
td
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@
|
||||||
= render(partial: 'packages/paginator', locals: {items: @screenshots})
|
= render(partial: 'packages/paginator', locals: {items: @screenshots})
|
||||||
.grid-x.grid-margin-x.medium-up-1.large-up-2 data-equalizer=true data-equalize-on="medium"
|
.grid-x.grid-margin-x.medium-up-1.large-up-2 data-equalizer=true data-equalize-on="medium"
|
||||||
- @screenshots.each do |screenshot|
|
- @screenshots.each do |screenshot|
|
||||||
div class=("cell pkgcard" + (screenshot.approved ? " approved" : " unapproved")) data-equalizer-watch=true
|
- @divclasses = %W(cell pkgcard)
|
||||||
|
- @divclasses << (screenshot.approved ? "approved" : "unapproved")
|
||||||
|
- @divclasses << 'highlight' if screenshot.id == @highlight_id
|
||||||
|
div class=(@divclasses.join(' ')) data-equalizer-watch=true
|
||||||
a.black href =url_for(screenshot.simage_url(:large)) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
|
a.black href =url_for(screenshot.simage_url(:large)) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
|
||||||
.image.image-with-zoom-icon
|
.image.image-with-zoom-icon
|
||||||
= small_img(screenshot, cls: '')
|
= small_img(screenshot, cls: '')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue