1
0
Fork 0
forked from OpenNeo/impress

support manually uploaded swf asset images - not the actual uploading, but block them from being reconverted

This commit is contained in:
Emi Matchu 2013-10-16 15:50:48 -05:00
parent 0cb7fc87df
commit 8bd7ad5a1e
6 changed files with 30 additions and 12 deletions

View file

@ -22,3 +22,5 @@ body.broken_image_reports-new
span span
font-size: 85% font-size: 85%
.manual a
display: block

View file

@ -13,10 +13,13 @@ class BrokenImageReportsController < ApplicationController
swf_asset = SwfAsset.where(:type => params[:swf_asset_type]). swf_asset = SwfAsset.where(:type => params[:swf_asset_type]).
find_by_remote_id(params[:swf_asset_remote_id]) find_by_remote_id(params[:swf_asset_remote_id])
if swf_asset.report_broken if swf_asset.image_manual?
flash[:success] = t('broken_image_reports.create.success') flash[:warning] = t('broken_image_reports.create.manual')
else else
flash[:alert] = t('broken_image_reports.create.already_reported') # If the asset is already reported as broken, no need to shout about it.
# Just don't enqueue it, thank the user, and move on.
swf_asset.report_broken
flash[:success] = t('broken_image_reports.create.success')
end end
redirect_to :back redirect_to :back

View file

@ -8,14 +8,17 @@
- @swf_assets.each do |swf_asset| - @swf_assets.each do |swf_asset|
%li %li
= link_to image_tag(swf_asset.image_url([150, 150])), swf_asset.url = link_to image_tag(swf_asset.image_url([150, 150])), swf_asset.url
- unless swf_asset.image_pending_repair? - if swf_asset.image_manual?
= form_tag(:action => :create) do %span.manual
= t '.image_manual.description'
= mail_to contact_email, t('.image_manual.contact')
- elsif swf_asset.image_pending_repair?
%span.reported-broken-at= format_reported_at(swf_asset.reported_broken_at)
- else
= form_tag(action: :create) do
= hidden_field_tag 'swf_asset_remote_id', swf_asset.remote_id = hidden_field_tag 'swf_asset_remote_id', swf_asset.remote_id
= hidden_field_tag 'swf_asset_type', swf_asset.type = hidden_field_tag 'swf_asset_type', swf_asset.type
= submit_tag t('.submit') = submit_tag t('.submit')
- if swf_asset.converted_at? - if swf_asset.converted_at?
%span.converted-at= format_converted_at(swf_asset.converted_at) %span.converted-at= format_converted_at(swf_asset.converted_at)
- else
%span.reported-broken-at= format_reported_at(swf_asset.reported_broken_at)

View file

@ -50,9 +50,10 @@ en:
success: success:
Thanks! This image will be reconverted soon. If it looks the same after Thanks! This image will be reconverted soon. If it looks the same after
conversion, please consider sending a bug report. conversion, please consider sending a bug report.
already_reported: manual:
This image is already in line for reconversion. We'll get to it soon, This image was uploaded manually, so we don't want to run the
don't worry. automatic converters on it. If this manual version is broken, let us
know at webmaster@openneo.net. Thanks!
new: new:
title: Report broken image title: Report broken image
@ -67,6 +68,9 @@ en:
submit: Report as broken submit: Report as broken
converted_at_html: Converted %{converted_at_ago} ago converted_at_html: Converted %{converted_at_ago} ago
reported_at_html: Reported %{reported_at_ago} ago reported_at_html: Reported %{reported_at_ago} ago
image_manual:
description: Uploaded manually.
contact: Send a bug report?
closet_hangers: closet_hangers:
closet_hanger: closet_hanger:

View file

@ -0,0 +1,5 @@
class AddImageManualToSwfAssets < ActiveRecord::Migration
def change
add_column :swf_assets, :image_manual, :boolean, null: false, default: false
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130427151327) do ActiveRecord::Schema.define(:version => 20131016203607) do
create_table "auth_servers", :force => true do |t| create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false t.string "short_name", :limit => 10, :null => false
@ -291,6 +291,7 @@ ActiveRecord::Schema.define(:version => 20130427151327) do
t.boolean "image_requested", :default => false, :null => false t.boolean "image_requested", :default => false, :null => false
t.datetime "reported_broken_at" t.datetime "reported_broken_at"
t.datetime "converted_at" t.datetime "converted_at"
t.boolean "image_manual", :default => false, :null => false
end end
add_index "swf_assets", ["body_id"], :name => "swf_assets_body_id_and_object_id" add_index "swf_assets", ["body_id"], :name => "swf_assets_body_id_and_object_id"