2011-08-07 15:23:44 -07:00
|
|
|
class BrokenImageReportsController < ApplicationController
|
|
|
|
def new
|
|
|
|
ids = params[:asset_ids]
|
|
|
|
assets = SwfAsset.arel_table
|
|
|
|
@swf_assets = SwfAsset.where(:has_image => true).where((
|
2012-01-12 15:17:59 -08:00
|
|
|
assets[:remote_id].in(ids[:biology]).and(assets[:type].eq('biology'))
|
2011-08-07 15:23:44 -07:00
|
|
|
).or(
|
2012-01-12 15:17:59 -08:00
|
|
|
assets[:remote_id].in(ids[:object]).and(assets[:type].eq('object'))
|
2011-08-07 15:23:44 -07:00
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2012-01-12 15:17:59 -08:00
|
|
|
swf_asset = SwfAsset.where(:type => params[:swf_asset_type]).
|
|
|
|
find_by_remote_id(params[:swf_asset_remote_id])
|
2011-08-07 15:23:44 -07:00
|
|
|
|
|
|
|
if swf_asset.report_broken
|
2013-01-01 19:23:25 -08:00
|
|
|
flash[:success] = t('broken_image_reports.create.success')
|
2011-08-07 15:23:44 -07:00
|
|
|
else
|
2013-01-01 19:23:25 -08:00
|
|
|
flash[:alert] = t('broken_image_reports.create.already_reported')
|
2011-08-07 15:23:44 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
redirect_to :back
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|