mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
initial browsing page
This commit is contained in:
parent
b057ecc7a1
commit
d0a359283e
4 changed files with 21 additions and 8 deletions
9
app.rb
9
app.rb
|
@ -34,6 +34,11 @@ get '/?' do
|
|||
slim :index
|
||||
end
|
||||
|
||||
get '/browse' do
|
||||
@sites = Site.order(:id.desc).filter(initial_index_changed: true).all
|
||||
slim :browse
|
||||
end
|
||||
|
||||
get '/new' do
|
||||
dashboard_if_signed_in
|
||||
@site = Site.new
|
||||
|
@ -145,6 +150,8 @@ post '/site_files/upload' do
|
|||
|
||||
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
|
||||
|
||||
flash[:success] = "Successfully uploaded file #{sanitized_filename}."
|
||||
redirect '/dashboard'
|
||||
end
|
||||
|
@ -205,6 +212,8 @@ post '/site_files/save/:filename' do |filename|
|
|||
|
||||
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
|
||||
|
||||
'ok'
|
||||
end
|
||||
|
||||
|
|
|
@ -73,9 +73,12 @@ class Site < Sequel::Model
|
|||
end
|
||||
|
||||
# Check for existing user
|
||||
user = self.class.select(:username).filter(username: values[:username]).first
|
||||
if !user.nil? && (user.id != values[:id])
|
||||
errors.add :username, 'This username is already taken. Try using another one.'
|
||||
|
||||
if new?
|
||||
user = self.class.select(:username).filter(username: values[:username]).first
|
||||
if !user.nil? && (user.id != values[:id])
|
||||
errors.add :username, 'This username is already taken. Try using another one.'
|
||||
end
|
||||
end
|
||||
|
||||
if values[:password].nil? || (@password_length && @password_length < MINIMUM_PASSWORD_LENGTH)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
td Hopefully with donations. If you feel this is a useful service, help us pay the bills to run it. <a href="/donate">Click here to contribute!</a>
|
||||
div.text-center
|
||||
h1: a href="/new" JOIN NOW
|
||||
p or
|
||||
h1: a href="/browse" BROWSE EXISTING SITES
|
||||
|
||||
h5 style="margin-top: 30px" Returning users: <a href="/signin">Sign In</a>
|
||||
|
||||
h5 style="margin-top: 30px" Returning users: <a href="/signin">Sign In</a>
|
|
@ -49,16 +49,16 @@ css:
|
|||
|
||||
.row
|
||||
.span12
|
||||
div id="editor" style="width: 100%; height: 1000px; position: relative;"
|
||||
div id="editor" style="width: 100%; height: 600px; position: relative;"
|
||||
#{@file_data}
|
||||
|
||||
.row.text-center style="margin-top: 10px"
|
||||
.span4
|
||||
a.btn.btn-large.btn-warning href="/dashboard" <i class="icon-remove"></i> Finish Without Saving
|
||||
.span4
|
||||
a.btn.btn-large.btn-success href="#" onclick="saveTextFile(false)" <i class="icon-save"></i> Save Changes
|
||||
a.btn.btn-large.btn-success href="#" onclick="saveTextFile(false); return false" <i class="icon-save"></i> Save Changes
|
||||
.span4
|
||||
a.btn.btn-large.btn-info href="#" onclick="saveTextFile(true);" <i class="icon-save"></i> Save and Finish
|
||||
a.btn.btn-large.btn-info href="#" onclick="saveTextFile(true); return false" <i class="icon-save"></i> Save and Finish
|
||||
|
||||
.row style="margin-top: 20px"
|
||||
.span6.offset3.text-center
|
||||
|
|
Loading…
Add table
Reference in a new issue