supporter refactor

This commit is contained in:
Kyle Drake 2014-10-24 18:45:42 -07:00
parent e82e1b4631
commit 5235286d8a
6 changed files with 9 additions and 11 deletions

View file

@ -830,12 +830,10 @@ class Site < Sequel::Model
((total_used_space.to_f / maximum_space) * 100).round(1)
end
# This returns true even if they end their support plan.
def supporter?
!owner.values[:stripe_customer_id].nil?
plan_type != 'free'
end
# This will return false if they have ended their plan.
def ended_supporter?
owner.values[:plan_ended]
end

View file

@ -24,7 +24,7 @@
<% if current_site && current_site.id == actioning_site.id %>
<a href="/site/<%= current_site.username %>" class="you">You</a>
<% else %>
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? && !actioning_site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
<% end %>
followed
@ -32,7 +32,7 @@
<% if current_site && event_site.id == current_site.id %>
<a href="/site/<%= current_site.username %>" class="you">you</a>
<% else %>
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? && !event_site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>
<% end %>
<span class="date">
@ -91,7 +91,7 @@
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username, :stripe_customer_id).first %>
<div class="comment" id="comment_<%= comment.id %>">
<img class="avatar" src="<%= comment_actioning_site.screenshot_url('index.html', '50x50') %>">
<a href="/site/<%= comment_actioning_site.username %>" class="user" title="<%= comment_actioning_site.title %>"><i class="fa fa-user"><% if comment_actioning_site.supporter? && !comment_actioning_site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i><%= comment_actioning_site.username %></a>
<a href="/site/<%= comment_actioning_site.username %>" class="user" title="<%= comment_actioning_site.title %>"><i class="fa fa-user"><% if comment_actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= comment_actioning_site.username %></a>
<span class="date">
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
</span>

View file

@ -7,7 +7,7 @@
<% if current_site && current_site.id == actioning_site.id %>
<a href="/site/<%= current_site.username %>" class="you">You</a>
<% else %>
<a href="/site/<%= actioning_site.username %>" class="user"><i class="fa fa-user"><% if actioning_site.supporter? && !actioning_site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
<a href="/site/<%= actioning_site.username %>" class="user"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
<% end %>
<i class="fa fa-chevron-right comment-symbol" title="commented on"></i>
@ -15,7 +15,7 @@
<% if current_site && current_site.id == profile_comment.site_id %>
<a href="/site/<%= current_site.username %>" class="you">You</a>
<% else %>
<a href="/site/<%= profile_comment.site.username %>" class="user"><i class="fa fa-user"><% if profile_comment.site.supporter? && !profile_comment.site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i><%= profile_comment.site.username %></a>
<a href="/site/<%= profile_comment.site.username %>" class="user"><i class="fa fa-user"><% if profile_comment.site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= profile_comment.site.username %></a>
<% end %>
<span class="date">
<a href="?event_id=<%= profile_comment.event.id %>"><%= profile_comment.created_at.ago %></a>

View file

@ -74,7 +74,7 @@
<div class="site-info">
<div class="username">
<a href="/site/<%= site.username %>" title="Profile">
<i class="fa fa-user"><% if site.supporter? && !site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i><%= site.username %>
<i class="fa fa-user"><% if site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= site.username %>
</a>
</div>
<div class="site-stats">

View file

@ -19,7 +19,7 @@
</div>
</div>
<div class="col col-50">
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? && !site.ended_supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
<p class="site-url"><a href="/surf/<%= site.username %>"><%= site.host %></a></p>
<div class="stats">
<div class="stat"><strong><%= site.views_english %></strong> <span>views</span></div>

View file

@ -177,7 +177,7 @@
<% end %>
</ul>
<ul class="site-actions">
<li><a href="/site/<%= @site.username %>"><i class="fa fa-user"><% if @site.supporter? && !@site.ended_supporter? %><i class="fa fa-heart"></i><% end %></i> <strong><%= @site.username %></strong></a></li>
<li><a href="/site/<%= @site.username %>"><i class="fa fa-user"><% if @site.supporter? %><i class="fa fa-heart"></i><% end %></i> <strong><%= @site.username %></strong></a></li>
<% if current_site && current_site != @site %>
<li>