mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 17:18:02 +02:00
Code to display tips submitted on news feed
This commit is contained in:
parent
621e45b6a2
commit
cc07e90b44
11 changed files with 131 additions and 12 deletions
|
@ -14,6 +14,49 @@
|
|||
<% if event.profile_comment_id %>
|
||||
<div class="news-item comment" id="event_<%= event.id %>">
|
||||
<%== erb :'_news_profile_comment', layout: false, locals: {profile_comment: event.profile_comment, event: event} %>
|
||||
<% elsif event.tip_id %>
|
||||
|
||||
<div class="news-item tip">
|
||||
<div class="title">
|
||||
<% actioning_site = event.actioning_site_dataset.select(:id, :username, :title, :domain, :stripe_customer_id).first %>
|
||||
<% event_site = event.site_dataset.select(:id, :username, :title, :domain, :stripe_customer_id).first %>
|
||||
<% tip = event.tip %>
|
||||
|
||||
<div class="icon">
|
||||
<% if actioning_site %>
|
||||
<a href="/site/<%= actioning_site.username %>" title="<%= actioning_site.username %>" class="avatar" style="background-image: url(<%= actioning_site.screenshot_url 'index.html', '50x50' %>);"></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="text">
|
||||
<div class="headline">
|
||||
<% if actioning_site %>
|
||||
<% 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? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
|
||||
<% end %>
|
||||
<% else %>
|
||||
An anonymous donor
|
||||
<% end %>
|
||||
|
||||
sent a <strong><%= tip.amount_string %></strong> tip to
|
||||
|
||||
<% 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? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>!
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<span class="comment"><%= tip.message %></span>
|
||||
</div>
|
||||
|
||||
<span class="date">
|
||||
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<% elsif event.follow_id %>
|
||||
<div class="news-item follow">
|
||||
<div class="title">
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<% follows_count = site.follows_dataset.count %>
|
||||
<div class="stat"><strong><%= follows_count.format_large_number %></strong> <span>follower<%= follows_count == 1 ? '' : 's' %></span></div>
|
||||
<div class="stat"><strong><%= site.changed_count.format_large_number %></strong> <span>update<%= site.changed_count == 1 ? '' : 's' %></span></div>
|
||||
<!-- <div class="stat"><strong><%= site.tips_dataset.count %></strong> <span>tips</span></div> -->
|
||||
<div class="stat"><strong><%= site.tips_dataset.count %></strong> <span>tips</span></div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<% if current_site == site %>
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
<input type="hidden" name="no_note" value="0">
|
||||
<input type="hidden" name="currency_code" value="USD">
|
||||
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
|
||||
<input type="hidden" name="notify_url" value="https://neocities.org/webhooks/paypal/tipping_notify">
|
||||
<input type="hidden" name="cancel_return" value="<%= request.url %>">
|
||||
<input type="hidden" name="return" value="<%= request.url %>">
|
||||
<input type="hidden" name="custom" value="<%= Base64.strict_encode64({site_id: site.id, actioning_site_id: (current_site ? current_site.id : nil)}.to_json) %>">
|
||||
<a href="#" onclick="parentNode.submit()">Credit Card</a>
|
||||
<br>
|
||||
<a href="#" onclick="parentNode.submit()">PayPal</a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue