mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
follow/followings fixes, general cleanups
This commit is contained in:
parent
ad9ac1e68d
commit
264e4becea
6 changed files with 41 additions and 24 deletions
2
app.rb
2
app.rb
|
@ -76,6 +76,8 @@ end
|
|||
post '/site/:sitename/comment' do |sitename|
|
||||
require_login
|
||||
|
||||
redirect "/site/#{sitename}" if params[:message].empty?
|
||||
|
||||
site = Site[username: sitename]
|
||||
|
||||
DB.transaction do
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
class Tag < Sequel::Model
|
||||
many_to_many :sites
|
||||
|
||||
def before_create
|
||||
super
|
||||
values[:name].downcase!
|
||||
end
|
||||
|
||||
def self.create_unless_exists(name)
|
||||
dataset.filter(name: name).first || create(name: name)
|
||||
end
|
||||
end
|
|
@ -1,11 +1,24 @@
|
|||
<% if (!is_current_site && site.followings_dataset.count > 0) || is_current_site %>
|
||||
<h3>Following</h3>
|
||||
<h3><%= is_current_site ? 'You follow' : 'This site follows' %></h3>
|
||||
<div class="following">
|
||||
<% if site.followings_dataset.count == 0 %>
|
||||
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
|
||||
<% else %>
|
||||
<% site.followings.each do |following| %>
|
||||
<a href="/site/<%= site.username %>"><img src="<%= site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
|
||||
<a href="/site/<%= following.site.username %>"><img src="<%= site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if (!is_current_site && site.follows_dataset.count > 0) || is_current_site %>
|
||||
<h3>Followers</h3>
|
||||
<div class="following">
|
||||
<% if site.follows_dataset.count == 0 %>
|
||||
No followers yet.
|
||||
<% else %>
|
||||
<% site.follows.each do |follow| %>
|
||||
<a href="/site/<%= follow.actioning_site.username %>"><img src="<%= follow.actioning_site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<p>You don't have any tags yet. <a href="#">Add some!</a>
|
||||
<% else %>
|
||||
<% site.tags.each do |tag| %>
|
||||
<a class="tag" href="/tags/<%= tag.name %>"><%= tag.name %></a>
|
||||
<a class="tag" href="/browse?tag=<%== Rack::Utils.escape tag.name %>"><%= tag.name %></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -92,7 +92,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col col-33">
|
||||
<p class="site-url"><a href="//<%= site.username %>.neocities.org" target="_blank"><%= site.username %>.neocities.org</a></p>
|
||||
<p class="site-url"><a href="//<%= current_site.username %>.neocities.org" target="_blank"><%= site.username %>.neocities.org</a></p>
|
||||
<div class="stats">
|
||||
<div class="col col-50">
|
||||
<% if site.updated_at %>
|
||||
|
|
|
@ -69,16 +69,17 @@
|
|||
<span>Last updated</span>
|
||||
<strong>
|
||||
<% if site.updated_at.nil? %>
|
||||
Just Created
|
||||
<%= site.created_at.ago.downcase %>
|
||||
<% else %>
|
||||
<%= site.updated_at.ago.downcase %>
|
||||
<% end %>
|
||||
</strong>
|
||||
</div>
|
||||
<div class="stat"><span>Total updates</span><strong><%= site.changed_count %></strong></div>
|
||||
<div class="stat"><span>Number of updates</span><strong><%= site.changed_count %></strong></div>
|
||||
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%B %-d, %Y') %></strong></div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<h3>Archives</h3>
|
||||
<div class="archives">
|
||||
<a href=""><img src="http://neocities.org/site_screenshots/codeventurer.jpg"></a>
|
||||
|
@ -87,15 +88,7 @@
|
|||
<a href=""><img src="http://neocities.org/site_screenshots/codeventurer.jpg"></a>
|
||||
<a href="" class="more">See all versions</a>
|
||||
</div>
|
||||
|
||||
<% if site.followings_dataset.count < 0 %>
|
||||
<h3>Following</h3>
|
||||
<div class="following">
|
||||
<% site.followings.each do |following| %>
|
||||
<a href="#"><img src="<%= site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
-->
|
||||
|
||||
<%== erb :'_follows', layout: false, locals: {site: site, is_current_site: site == current_site} %>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue