mirror of
https://github.com/neocities/neocities.git
synced 2025-06-18 10:24:37 +02:00
Merge branch 'master' of github.com:neocities/neocities
This commit is contained in:
commit
742092cd8b
7 changed files with 9 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
get '/browse/?' do
|
get '/browse/?' do
|
||||||
params.delete 'tag' if params[:tag].nil? || params[:tag].empty?
|
params.delete 'tag' if params[:tag].nil? || params[:tag].strip.empty?
|
||||||
site_dataset = browse_sites_dataset
|
site_dataset = browse_sites_dataset
|
||||||
site_dataset = site_dataset.paginate @current_page, Site::BROWSE_PAGINATION_LENGTH
|
site_dataset = site_dataset.paginate @current_page, Site::BROWSE_PAGINATION_LENGTH
|
||||||
@page_count = site_dataset.page_count || 1
|
@page_count = site_dataset.page_count || 1
|
||||||
|
@ -65,4 +65,4 @@ def browse_sites_dataset
|
||||||
end
|
end
|
||||||
|
|
||||||
site_dataset
|
site_dataset
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,4 +27,4 @@ post '/contact' do
|
||||||
flash[:success] = 'Your contact has been sent.'
|
flash[:success] = 'Your contact has been sent.'
|
||||||
redirect '/'
|
redirect '/'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,7 +41,7 @@ the Neocities Cat
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/password_reset_confirm' do
|
get '/password_reset_confirm' do
|
||||||
if params[:token].nil? || params[:token].empty?
|
if params[:token].nil? || params[:token].strip.empty?
|
||||||
flash[:error] = 'Could not find a site with this token.'
|
flash[:error] = 'Could not find a site with this token.'
|
||||||
redirect '/'
|
redirect '/'
|
||||||
end
|
end
|
||||||
|
@ -67,4 +67,4 @@ get '/password_reset_confirm' do
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect '/'
|
redirect '/'
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ post '/site_files/create_page' do
|
||||||
params[:pagefilename].gsub!(/[^a-zA-Z0-9_\-.]/, '')
|
params[:pagefilename].gsub!(/[^a-zA-Z0-9_\-.]/, '')
|
||||||
params[:pagefilename].gsub!(/\.html$/i, '')
|
params[:pagefilename].gsub!(/\.html$/i, '')
|
||||||
|
|
||||||
if params[:pagefilename].nil? || params[:pagefilename].empty?
|
if params[:pagefilename].nil? || params[:pagefilename].strip.empty?
|
||||||
@errors << 'You must provide a file name.'
|
@errors << 'You must provide a file name.'
|
||||||
halt erb(:'site_files/new_page')
|
halt erb(:'site_files/new_page')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
get '/surf/?' do
|
get '/surf/?' do
|
||||||
params.delete 'tag' if params[:tag].nil? || params[:tag].empty?
|
params.delete 'tag' if params[:tag].nil? || params[:tag].strip.empty?
|
||||||
site_dataset = browse_sites_dataset
|
site_dataset = browse_sites_dataset
|
||||||
site_dataset = site_dataset.paginate @current_page, 1
|
site_dataset = site_dataset.paginate @current_page, 1
|
||||||
@page_count = site_dataset.page_count || 1
|
@page_count = site_dataset.page_count || 1
|
||||||
|
@ -14,4 +14,4 @@ get '/surf/:username' do |username|
|
||||||
@title = @site.title
|
@title = @site.title
|
||||||
not_found if @site.nil?
|
not_found if @site.nil?
|
||||||
erb :'surf', layout: false
|
erb :'surf', layout: false
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
class String
|
class String
|
||||||
def empty?
|
|
||||||
strip == '' ? true : false
|
|
||||||
end
|
|
||||||
|
|
||||||
def shorten(length, usedots=true)
|
def shorten(length, usedots=true)
|
||||||
if usedots
|
if usedots
|
||||||
return self if self.length < length
|
return self if self.length < length
|
||||||
|
@ -15,4 +11,4 @@ class String
|
||||||
def unindent
|
def unindent
|
||||||
gsub /^#{scan(/^\s*/).min_by{|l|l.length}}/, ""
|
gsub /^#{scan(/^\s*/).min_by{|l|l.length}}/, ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,7 +87,6 @@
|
||||||
<% if params[:dir].nil? || params[:dir].empty? || params[:dir] == '/' %>
|
<% if params[:dir].nil? || params[:dir].empty? || params[:dir] == '/' %>
|
||||||
Home
|
Home
|
||||||
<% else %>
|
<% else %>
|
||||||
<% puts params[:dir].inspect %>
|
|
||||||
<a href="/dashboard">Home</a>
|
<a href="/dashboard">Home</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue