Merge branch 'pending-contributor'
This commit is contained in:
@@ -4,7 +4,7 @@ require "tmpdir"
|
|||||||
class Upload < ActiveRecord::Base
|
class Upload < ActiveRecord::Base
|
||||||
class Error < Exception ; end
|
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 :uploader, :class_name => "User"
|
||||||
belongs_to :post
|
belongs_to :post
|
||||||
before_validation :initialize_uploader, :on => :create
|
before_validation :initialize_uploader, :on => :create
|
||||||
@@ -62,7 +62,7 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
module ConversionMethods
|
module ConversionMethods
|
||||||
def process! force=false
|
def process!(force = false)
|
||||||
return if !force && status =~ /processing|completed|error/
|
return if !force && status =~ /processing|completed|error/
|
||||||
|
|
||||||
CurrentUser.scoped(uploader, uploader_ip_addr) do
|
CurrentUser.scoped(uploader, uploader_ip_addr) do
|
||||||
@@ -113,7 +113,7 @@ class Upload < ActiveRecord::Base
|
|||||||
p.uploader_ip_addr = uploader_ip_addr
|
p.uploader_ip_addr = uploader_ip_addr
|
||||||
p.parent_id = parent_id
|
p.parent_id = parent_id
|
||||||
|
|
||||||
unless uploader.is_contributor?
|
if !uploader.is_contributor? || upload_as_pending?
|
||||||
p.is_pending = true
|
p.is_pending = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -429,4 +429,8 @@ class Upload < ActiveRecord::Base
|
|||||||
def presenter
|
def presenter
|
||||||
@presenter ||= UploadPresenter.new(self)
|
@presenter ||= UploadPresenter.new(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def upload_as_pending?
|
||||||
|
as_pending == "1"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,6 +57,15 @@
|
|||||||
<%= button_tag "Copyrights", :id => "related-copyrights-button", :type => "button" %>
|
<%= button_tag "Copyrights", :id => "related-copyrights-button", :type => "button" %>
|
||||||
</div>
|
</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">
|
<div class="input">
|
||||||
<%= submit_tag "Submit", :class => "large" %>
|
<%= submit_tag "Submit", :class => "large" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user