tipping: only show tipping sites with paypal/btc input

This commit is contained in:
Kyle Drake 2017-02-25 10:19:14 -08:00
parent 42b3f25b11
commit 3dc38bfc5a
3 changed files with 6 additions and 1 deletions

View file

@ -85,6 +85,7 @@ def browse_sites_dataset
site_dataset.order!(:site_updated_at.desc, :views.desc)
when 'tipping_enabled'
site_dataset.where! tipping_enabled: true
site_dataset.where!("(tipping_paypal is not null and tipping_paypal != '') or (tipping_bitcoin is not null and tipping_bitcoin != '')")
site_dataset = site_dataset.association_left_join :follows
site_dataset.select_all! :sites
site_dataset.select_append! Sequel.lit("count(follows.site_id) AS follow_count")

View file

@ -1356,6 +1356,10 @@ class Site < Sequel::Model
!site_files_dataset.where(path: /^\/?index.html$/).where(sha1_hash: EMPTY_FILE_HASH).first.nil?
end
def tipping_enabled?
tipping_enabled && (!tipping_paypal.blank? || !tipping_bitcoin.blank?)
end
def classify(path)
return nil unless classification_allowed? path
#$classifier.classify process_for_classification(path)

View file

@ -56,7 +56,7 @@
<a href="#" id="shareButton" class="btn-Action" data-container="body" data-toggle="popover" data-placement="bottom" data-content='<%== erb :'_share', layout: false, locals: {site: site} %>'><i class="fa fa-share-alt"></i> <span>Share</span></a>
<% if site.tipping_enabled && (!site.tipping_paypal.blank? || !site.tipping_bitcoin.blank?) %>
<% if site.tipping_enabled? %>
<a href="#" id="tipButton" class="btn-Action" data-container="body" data-toggle="popover" data-placement="bottom" data-content='<%== erb :'site/_tip', layout: false, locals: {site: site} %>'><i class="fa fa-usd"></i> <span>Send a Tip</span></a>
<% end %>
</div>