Dropdown on details page allows image management for users and admins

This commit is contained in:
Christoph Haas 2016-04-07 17:01:00 +02:00
parent 263f6cd33f
commit 16999260ca
8 changed files with 75 additions and 35 deletions

View file

@ -90,6 +90,15 @@ class PackagesController < ApplicationController
send_file @screenshot.image.path(:thumb), type: "image/png", disposition: 'inline'
end
# Receives a form with a simple text field 'description' so that users can update
# the description of their screenshot.
def update_screenshot_description
@screenshot = Screenshot.find(params[:id])
@screenshot.description = params[:description]
@screenshot.save!
redirect_to package_path
end
private
# Send a dummy thumbnail reading "No screenshot available. Sorry."