mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
polish for browsing, add hit counter
This commit is contained in:
parent
e2d19d35ae
commit
d535bee286
5 changed files with 18 additions and 6 deletions
1
Gemfile
1
Gemfile
|
@ -13,6 +13,7 @@ gem 'rack-recaptcha', require: 'rack/recaptcha'
|
||||||
gem 'rmagick', require: nil
|
gem 'rmagick', require: nil
|
||||||
gem 'selenium-webdriver', require: nil
|
gem 'selenium-webdriver', require: nil
|
||||||
gem 'backburner'
|
gem 'backburner'
|
||||||
|
gem 'ago'
|
||||||
|
|
||||||
platform :mri do
|
platform :mri do
|
||||||
gem 'magic' # sudo apt-get install file, For OSX: brew install libmagic
|
gem 'magic' # sudo apt-get install file, For OSX: brew install libmagic
|
||||||
|
|
|
@ -2,6 +2,8 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
addressable (2.3.4)
|
addressable (2.3.4)
|
||||||
|
ago (0.1.5)
|
||||||
|
hoe (>= 1.12.2)
|
||||||
ansi (1.4.3)
|
ansi (1.4.3)
|
||||||
backburner (0.3.4)
|
backburner (0.3.4)
|
||||||
beaneater (~> 0.3.0)
|
beaneater (~> 0.3.0)
|
||||||
|
@ -27,6 +29,8 @@ GEM
|
||||||
ffi (1.4.0)
|
ffi (1.4.0)
|
||||||
hashie (2.0.5)
|
hashie (2.0.5)
|
||||||
hiredis (0.4.5)
|
hiredis (0.4.5)
|
||||||
|
hoe (3.6.3)
|
||||||
|
rake (>= 0.8, < 11.0)
|
||||||
i18n (0.6.4)
|
i18n (0.6.4)
|
||||||
json (1.8.0)
|
json (1.8.0)
|
||||||
kgio (2.8.0)
|
kgio (2.8.0)
|
||||||
|
@ -114,6 +118,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
ago
|
||||||
backburner
|
backburner
|
||||||
bcrypt-ruby
|
bcrypt-ruby
|
||||||
fabrication
|
fabrication
|
||||||
|
|
6
app.rb
6
app.rb
|
@ -35,7 +35,7 @@ get '/?' do
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/browse' do
|
get '/browse' do
|
||||||
@sites = Site.order(:id.desc).filter(initial_index_changed: true).all
|
@sites = Site.order(:id.desc).filter(~{updated_at: nil}).all
|
||||||
slim :browse
|
slim :browse
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ post '/site_files/upload' do
|
||||||
|
|
||||||
Backburner.enqueue(ScreenshotJob, current_site.username) if sanitized_filename =~ /index\.html/
|
Backburner.enqueue(ScreenshotJob, current_site.username) if sanitized_filename =~ /index\.html/
|
||||||
|
|
||||||
current_site.update initial_index_changed: true if current_site.initial_index_changed == false
|
current_site.update updated_at: Time.now
|
||||||
|
|
||||||
flash[:success] = "Successfully uploaded file #{sanitized_filename}."
|
flash[:success] = "Successfully uploaded file #{sanitized_filename}."
|
||||||
redirect '/dashboard'
|
redirect '/dashboard'
|
||||||
|
@ -212,7 +212,7 @@ post '/site_files/save/:filename' do |filename|
|
||||||
|
|
||||||
Backburner.enqueue(ScreenshotJob, current_site.username) if sanitized_filename =~ /index\.html/
|
Backburner.enqueue(ScreenshotJob, current_site.username) if sanitized_filename =~ /index\.html/
|
||||||
|
|
||||||
current_site.update initial_index_changed: true if current_site.initial_index_changed == false
|
current_site.update updated_at: Time.now
|
||||||
|
|
||||||
'ok'
|
'ok'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
.row
|
.row
|
||||||
.span12.text-center
|
.span12.text-center
|
||||||
h1 Home Pages on NeoCities
|
h1 Home Pages on NeoCities
|
||||||
p Want to make your own? <a href="/new">Click here</a>!
|
p If you like a site, don't forget to bookmark it!<br>Want to make your own? <a href="/new">Click here</a>!
|
||||||
|
|
||||||
- @sites.each_with_index do |site,i|
|
- @sites.each_with_index do |site,i|
|
||||||
- if i.even? && i != 0
|
- if i.even? && i != 0
|
||||||
.row
|
.row
|
||||||
|
|
||||||
.span6.text-center
|
.span6 style="background-color: #F8F8F8; margin-bottom: 30px"
|
||||||
h3: a href="http://#{site.username}.neocities.org" target="_blank" #{site.username}
|
|
||||||
|
.row
|
||||||
|
.span3
|
||||||
|
h3 style="margin-left: 20px": a href="http://#{site.username}.neocities.org" target="_blank" #{site.username}
|
||||||
|
.span3.text-right
|
||||||
|
p style="margin-right: 20px; margin-top: 10px" #{site.hits} hits<br>last updated #{site.updated_at.ago}
|
||||||
a href="http://#{site.username}.neocities.org" target="_blank": img src="/site_screenshots/#{ENV['RACK_ENV'] == 'development' ? 'victoria' : site.username}.jpg"
|
a href="http://#{site.username}.neocities.org" target="_blank": img src="/site_screenshots/#{ENV['RACK_ENV'] == 'development' ? 'victoria' : site.username}.jpg"
|
||||||
|
|
|
@ -21,6 +21,7 @@ html
|
||||||
.navbar-inner
|
.navbar-inner
|
||||||
a.brand href="/" NeoCities
|
a.brand href="/" NeoCities
|
||||||
ul.nav.pull-right
|
ul.nav.pull-right
|
||||||
|
li: a href="/browse" <b>Browse</b>
|
||||||
- if signed_in?
|
- if signed_in?
|
||||||
li.navbar-text: strong style="color: #7AB800" #{current_site.username}
|
li.navbar-text: strong style="color: #7AB800" #{current_site.username}
|
||||||
li: a href="/signout" style="color: #B94A48" Signout
|
li: a href="/signout" style="color: #B94A48" Signout
|
||||||
|
|
Loading…
Add table
Reference in a new issue