mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
global activity feed
This commit is contained in:
parent
8fba5e7a9b
commit
d53b6584d5
3 changed files with 38 additions and 27 deletions
|
@ -13,6 +13,8 @@ get '/?' do
|
||||||
event = Event.select(:id).where(id: params[:event_id]).first
|
event = Event.select(:id).where(id: params[:event_id]).first
|
||||||
not_found if event.nil?
|
not_found if event.nil?
|
||||||
events_dataset = Event.where(id: params[:event_id]).paginate(1, 1)
|
events_dataset = Event.where(id: params[:event_id]).paginate(1, 1)
|
||||||
|
elsif params[:activity] == 'global'
|
||||||
|
events_dataset = Event.select_all(:events).order(:created_at.desc).paginate(@current_page, 100).join_table(:inner, :sites, id: :site_id).where{views > 1500}.or(site_change_id: nil)
|
||||||
else
|
else
|
||||||
events_dataset = current_site.news_feed(@current_page, 10)
|
events_dataset = current_site.news_feed(@current_page, 10)
|
||||||
end
|
end
|
||||||
|
@ -62,4 +64,4 @@ end
|
||||||
|
|
||||||
get '/press' do
|
get '/press' do
|
||||||
erb :'press'
|
erb :'press'
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<% if current_site && event_site.id == current_site.id %>
|
<% if current_site && event_site.id == current_site.id %>
|
||||||
<a href="/site/<%= current_site.username %>" class="you">you</a>
|
<a href="/site/<%= current_site.username %>" class="you">you</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
the <a class="user" href="http://<%= event_site.host %>" title="<%= event_site.title %>">site</a> of
|
the <a class="user" href="http://<%= event_site.host %>" title="<%= event_site.title %>">site</a> of
|
||||||
<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>
|
<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 %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -123,27 +123,29 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="content">
|
<% if params[:activity] != 'global' %>
|
||||||
<% if @page_count > 1 %>
|
<div class="content">
|
||||||
<div class="txt-Center content eps pagination">
|
<% if @page_count > 1 %>
|
||||||
<% if @current_page != 1 %>
|
<div class="txt-Center content eps pagination">
|
||||||
<a href="#" onclick="getPage(<%= @current_page - 1 %>); return false"><i class="fa fa-arrow-left arrow"></i></a>
|
<% if @current_page != 1 %>
|
||||||
<% end %>
|
<a href="#" onclick="getPage(<%= @current_page - 1 %>); return false"><i class="fa fa-arrow-left arrow"></i></a>
|
||||||
|
|
||||||
<% 1.upto(@page_count) do |num| %>
|
|
||||||
<% if num == @current_page %>
|
|
||||||
<%= num %>
|
|
||||||
<% else %>
|
|
||||||
<a href="#" onclick="getPage(<%= num %>); return false"><%= num %></a>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% 1.upto(@page_count) do |num| %>
|
||||||
|
<% if num == @current_page %>
|
||||||
|
<%= num %>
|
||||||
|
<% else %>
|
||||||
|
<a href="#" onclick="getPage(<%= num %>); return false"><%= num %></a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if @current_page != @page_count %>
|
<% end %>
|
||||||
<a href="#" onclick="getPage(<%= @current_page + 1 %>); return false"><i class="fa fa-arrow-right arrow"></i></a>
|
|
||||||
<% end %>
|
<% if @current_page != @page_count %>
|
||||||
</div>
|
<a href="#" onclick="getPage(<%= @current_page + 1 %>); return false"><i class="fa fa-arrow-right arrow"></i></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%== erb :'_news_templates', layout: false %>
|
<%== erb :'_news_templates', layout: false %>
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
<div class="header-Outro with-columns">
|
<div class="header-Outro with-columns">
|
||||||
<div class="row content">
|
<div class="row content">
|
||||||
<div class="col col-66">
|
<div class="col col-66">
|
||||||
<h3>Your Feed</h3>
|
<h3>
|
||||||
|
<% if params[:activity] == 'global' %>
|
||||||
|
Global Feed
|
||||||
|
<% else %>
|
||||||
|
Your Feed
|
||||||
|
<% end %>
|
||||||
|
</h3>
|
||||||
<div class="feed-filter">
|
<div class="feed-filter">
|
||||||
<% if !@events.empty? && (site.followings_dataset.count > 0) %>
|
<% if !@events.empty? && (site.followings_dataset.count > 0) %>
|
||||||
<a href="/" <% if params[:activity] != 'mine' %>class="selected"<% end %>>All Activity</a>
|
<a href="/" <% if params[:activity].nil? %>class="selected"<% end %>>All Activity</a>
|
||||||
|
|
||||||
<a href="/?activity=mine" <% if params[:activity] == 'mine' %>class="selected"<% end %>>
|
<a href="/?activity=mine" <% if params[:activity] == 'mine' %>class="selected"<% end %>>
|
||||||
Activity on your profile
|
Activity on your profile
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<a href="/?activity=global" <% if params[:activity] == 'global' %>class="selected"<% end %>>Global Activity</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-32">
|
<div class="col col-32">
|
||||||
|
@ -33,7 +40,7 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !site.site_changed && site.followings_dataset.count > 0 %>
|
<% if !site.site_changed && site.followings_dataset.count > 0 %>
|
||||||
<div class="welcome">
|
<div class="welcome">
|
||||||
<h4>Thanks for joining the Neocities community!</h4>
|
<h4>Thanks for joining the Neocities community!</h4>
|
||||||
|
@ -45,7 +52,7 @@
|
||||||
<% if !@events.empty? %>
|
<% if !@events.empty? %>
|
||||||
<%== erb :'_news', layout: false, locals: {site: current_site, events: @events} %>
|
<%== erb :'_news', layout: false, locals: {site: current_site, events: @events} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if site.followings_dataset.count == 0 %>
|
<% if site.followings_dataset.count == 0 %>
|
||||||
<% if !@events.empty? %><h2>Sites to Follow</h2><% end %>
|
<% if !@events.empty? %><h2>Sites to Follow</h2><% end %>
|
||||||
<ul class="row website-Gallery content int-Gall suggestions">
|
<ul class="row website-Gallery content int-Gall suggestions">
|
||||||
|
@ -72,9 +79,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="site-tags">
|
<div class="site-tags">
|
||||||
<% if suggested_site.tags.count > 0 %>
|
<% if suggested_site.tags.count > 0 %>
|
||||||
<i class="fa fa-tag"></i>
|
<i class="fa fa-tag"></i>
|
||||||
<% suggested_site.tags.each_with_index do |tag, index| %>
|
<% suggested_site.tags.each_with_index do |tag, index| %>
|
||||||
<a class="" href="/browse?tag=<%= Rack::Utils.escape tag.name %>"><%= tag.name %></a><% if index != suggested_site.tags.length - 1 %>,<% end %>
|
<a class="" href="/browse?tag=<%= Rack::Utils.escape tag.name %>"><%= tag.name %></a><% if index != suggested_site.tags.length - 1 %>,<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue