diff --git a/app/activity.rb b/app/activity.rb new file mode 100644 index 00000000..4270f719 --- /dev/null +++ b/app/activity.rb @@ -0,0 +1,6 @@ +get '/activity' do + expires 14400, :public, :must_revalidate if self.class.production? # 4 hours + params[:activity] = 'global' # FIXME this is a bad hack + @events = Event.global_dataset.all + erb :'activity' +end diff --git a/models/event.rb b/models/event.rb index 21350da6..a86eb6bb 100644 --- a/models/event.rb +++ b/models/event.rb @@ -15,7 +15,7 @@ class Event < Sequel::Model DEFAULT_GLOBAL_LIMIT = 100 GLOBAL_VIEWS_MINIMUM = 500 - def self.global_dataset(current_page, limit=DEFAULT_GLOBAL_LIMIT) + def self.global_dataset(current_page=1, limit=DEFAULT_GLOBAL_LIMIT) select_all(:events). order(:created_at.desc). paginate(current_page, 100). diff --git a/views/_header.erb b/views/_header.erb index 6e8e609a..c8777baf 100644 --- a/views/_header.erb +++ b/views/_header.erb @@ -1,29 +1,15 @@
\ No newline at end of file + diff --git a/views/_header_links.erb b/views/_header_links.erb new file mode 100644 index 00000000..2c34489a --- /dev/null +++ b/views/_header_links.erb @@ -0,0 +1,23 @@ +<% if request.path == '/' %> +
  • + Neocities +
  • +<% end %> +
  • + Websites +
  • +
  • + Activity +
  • +
  • + About +
  • +
  • + Tutorials +
  • +
  • + API +
  • +
  • + Support Us +
  • diff --git a/views/activity.erb b/views/activity.erb new file mode 100644 index 00000000..31522a3f --- /dev/null +++ b/views/activity.erb @@ -0,0 +1,26 @@ +
    +
    +
    +

    Latest Activity on Neocities

    +
    +
    +
    + +
    +
    +
    +
    + <% if !signed_in? %> +
    +

    All the latest Neocities site news!

    +

    + Neocities allows everyone create a free web site to express themselves. Want to create your own websome site? Join us! +

    +
    + <% end %> + + <%== erb :'_news', locals: {current_site: nil, events: @events} %> +
    +
    +
    +
    diff --git a/views/home.erb b/views/home.erb index d612daad..14430a4d 100644 --- a/views/home.erb +++ b/views/home.erb @@ -1,22 +1,14 @@
    -

    - <% if params[:activity] == 'global' %> - Global Feed - <% else %> - Your Feed - <% end %> -

    +

    Your Feed

    diff --git a/views/index.erb b/views/index.erb index 9b575028..62113bc8 100644 --- a/views/index.erb +++ b/views/index.erb @@ -51,24 +51,7 @@ navigation icon