mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42: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
|
||||||
|
|
|
@ -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">
|
||||||
|
|
Loading…
Add table
Reference in a new issue