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
|
|
@ -18,6 +18,12 @@ class PackagesController < ApplicationController
|
|||
def details
|
||||
@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?
|
||||
@packagename = params[:name]
|
||||
render 'notfound', status: 404
|
||||
|
|
@ -177,7 +183,7 @@ class PackagesController < ApplicationController
|
|||
# Check if the user is allowed to change this screenshot
|
||||
# - Is this the user's own screenshot? (anonymous)
|
||||
if (@screenshot.user == current_user) || (can? :destroy, @screenshot)
|
||||
auditlog "Screenshot #{@screenshot} deleted",
|
||||
auditlog "Screenshot #{@screenshot.id} deleted",
|
||||
package: @screenshot.package
|
||||
@screenshot.destroy
|
||||
flash['notice'] = "Screenshot deleted."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue