This commit is contained in:
Toks
2013-05-25 19:26:18 -04:00
parent 7c65598ff0
commit 214582e9fe
2 changed files with 16 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ require "tmpdir"
class Upload < ActiveRecord::Base
class Error < Exception ; end
attr_accessor :file, :image_width, :image_height, :file_ext, :md5, :file_size
attr_accessor :file, :image_width, :image_height, :file_ext, :md5, :file_size, :as_pending
belongs_to :uploader, :class_name => "User"
belongs_to :post
before_validation :initialize_uploader, :on => :create
@@ -62,7 +62,7 @@ class Upload < ActiveRecord::Base
end
module ConversionMethods
def process! force=false
def process!(force = false)
return if !force && status =~ /processing|completed|error/
CurrentUser.scoped(uploader, uploader_ip_addr) do
@@ -113,7 +113,7 @@ class Upload < ActiveRecord::Base
p.uploader_ip_addr = uploader_ip_addr
p.parent_id = parent_id
unless uploader.is_contributor?
if !uploader.is_contributor? || upload_as_pending?
p.is_pending = true
end
end
@@ -424,4 +424,8 @@ class Upload < ActiveRecord::Base
def presenter
@presenter ||= UploadPresenter.new(self)
end
def upload_as_pending?
as_pending == "1"
end
end

View File

@@ -57,6 +57,15 @@
<%= button_tag "Copyrights", :id => "related-copyrights-button", :type => "button" %>
</div>
<% if CurrentUser.is_contributor? %>
<div class="input">
<label for="upload_as_pending">
<%= f.check_box :as_pending %>
Upload as pending
</label>
</div>
<% end %>
<div class="input">
<%= submit_tag "Submit", :class => "large" %>
</div>