mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
new page -> erb
This commit is contained in:
parent
363147b96d
commit
49055145f1
5 changed files with 36 additions and 149 deletions
13
app.rb
13
app.rb
|
@ -463,7 +463,7 @@ end
|
|||
|
||||
get '/site_files/new_page' do
|
||||
require_login
|
||||
slim :'site_files/new_page'
|
||||
erb :'site_files/new_page'
|
||||
end
|
||||
|
||||
post '/change_password' do
|
||||
|
@ -535,14 +535,14 @@ post '/site_files/create_page' do
|
|||
|
||||
if params[:pagefilename].nil? || params[:pagefilename].empty?
|
||||
@errors << 'You must provide a file name.'
|
||||
halt slim(:'site_files/new_page')
|
||||
halt erb(:'site_files/new_page')
|
||||
end
|
||||
|
||||
name = "#{params[:pagefilename]}.html"
|
||||
|
||||
if current_site.file_exists?(name)
|
||||
@errors << %{Web page "#{name}" already exists! Choose another name.}
|
||||
halt slim(:'site_files/new_page')
|
||||
halt erb(:'site_files/new_page')
|
||||
end
|
||||
|
||||
current_site.install_new_html_file name
|
||||
|
@ -554,12 +554,7 @@ end
|
|||
|
||||
get '/site_files/new' do
|
||||
require_login
|
||||
slim :'site_files/new'
|
||||
end
|
||||
|
||||
get '/site_files/upload' do
|
||||
require_login
|
||||
slim :'site_files/upload'
|
||||
erb :'site_files/new'
|
||||
end
|
||||
|
||||
def file_upload_response(error=nil)
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
- if @errors
|
||||
.row
|
||||
.span8.offset2
|
||||
div.alert.alert-error
|
||||
h3 There were errors, please correct:
|
||||
- @errors.each do |error|
|
||||
h5 = error
|
||||
|
||||
.row
|
||||
.span12.text-center
|
||||
h1 Upload a new file
|
||||
|
||||
.row
|
||||
.span12.text-center
|
||||
form method="POST" action="/site_files/upload" enctype="multipart/form-data"
|
||||
input name="csrf_token" type="hidden" value="#{csrf_token}"
|
||||
h4 Select a file from your computer:
|
||||
h4: input type="file" name="newfile"
|
||||
p: input.btn-Action type="submit" value="Upload File"
|
||||
|
||||
.row
|
||||
.span8.offset2
|
||||
h4 Here you can upload a new file for your home page.
|
||||
h4 It has to be one of the following file types
|
||||
h5
|
||||
ul id="file_criteria"
|
||||
li HTML (.html, .htm)
|
||||
li Image (.jpg, .png, .gif, .svg)
|
||||
li Markdown (.md, .markdown)
|
||||
li JavaScript (.js, .json, .geojson)
|
||||
li CSS (.css)
|
||||
li Text (.txt, .text, .csv, .tsv)
|
||||
li Web Fonts (.eot, .ttf, .woff, .svg)
|
||||
li MIDI Files (.mid, .midi)
|
||||
|
||||
h4 If the file already exists, <u><b>it will be overwritten without warning</b></u>.
|
||||
h4 It has to be <u>legal to share this content in the United States</u>.
|
||||
h4 It must fit into your home page space (#{current_site.available_space_in_megabytes}MB remaining).
|
||||
h4 The file uploader will automatically scrub any characters not matching: a-z A-Z 0-9 _ - .
|
32
views/site_files/new_page.erb
Normal file
32
views/site_files/new_page.erb
Normal file
|
@ -0,0 +1,32 @@
|
|||
<div class="header-Outro">
|
||||
<div class="row content single-Col">
|
||||
<h1>New Page</h1>
|
||||
<h3 class="subtitle">Create a new HTML page</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content single-Col misc-page txt-Center">
|
||||
<article>
|
||||
<h3></h3>
|
||||
<section>
|
||||
<% if @errors %>
|
||||
<div class="alert alert-error alert-block">
|
||||
<% @errors.each do |error| %>
|
||||
<%= error %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</section>
|
||||
<section>
|
||||
<form method="POST" action="/site_files/create_page" enctype="multipart/form-data">
|
||||
<%== csrf_token_input_html %>
|
||||
<h2>What's the name of your page?</h2>
|
||||
<p><input type="text" name="pagefilename" autocapitalize="off" autocorrect="off">.html</p>
|
||||
<p><input class="btn-Action" type="submit" value="Create Page"></p>
|
||||
|
||||
<p>Note: We will automatically scrub any characters not matching: a-z A-Z 0-9 _ - .</p>
|
||||
<p>Page must not already exist.</p>
|
||||
<p>If you want to make this the index page (and an index page doesn't exist), name it <strong>index.html</strong>.</p>
|
||||
</section>
|
||||
</article>
|
||||
</div>
|
|
@ -1,23 +0,0 @@
|
|||
.content-Base
|
||||
.content
|
||||
|
||||
- if @errors
|
||||
div.alert.alert-error
|
||||
h3 There were errors, please correct:
|
||||
- @errors.each do |error|
|
||||
h5 = error
|
||||
|
||||
h1.txt-Center.beta Create new HTML page
|
||||
|
||||
.txt-Center
|
||||
form method="POST" action="/site_files/create_page" enctype="multipart/form-data"
|
||||
input name="csrf_token" type="hidden" value="#{csrf_token}"
|
||||
p.eps What's the name of your page?
|
||||
p.eps: input type="text" name="pagefilename" autocapitalize="off" autocorrect="off".html
|
||||
p: input.btn-Action type="submit" value="Create Page"
|
||||
|
||||
.row style="padding-top:30px"
|
||||
.col.col-40 style="float:none; margin:0 auto;"
|
||||
p.eps Note: We will automatically scrub any characters not matching: a-z A-Z 0-9 _ - .
|
||||
p.zeta Page must not already exist.
|
||||
p.zeta If you want to make this the index page (and an index page doesn't exist), name it <strong>index.html</strong>.
|
|
@ -1,78 +0,0 @@
|
|||
css:
|
||||
.dz-default {
|
||||
font-size: 30pt;
|
||||
}
|
||||
|
||||
.dz-success-mark {
|
||||
display: none;
|
||||
}
|
||||
.dz-error-mark {
|
||||
display: none;
|
||||
}
|
||||
.dz-details img {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
script src="/js/dropzone.min.js"
|
||||
javascript:
|
||||
Dropzone.options.uploads = {
|
||||
paramName: 'newfile',
|
||||
maxFilesize: #{current_site.available_space_in_megabytes},
|
||||
clickable: true,
|
||||
init: function() {
|
||||
this.on("success", function(file) {
|
||||
$('#upload_status').html('File upload of '+file.name+' was successful!');
|
||||
});
|
||||
|
||||
this.on("error", function(file) {
|
||||
$('#upload_status').html('File upload of '+file.name+' failed. Ensure that it was a valid file type.');
|
||||
});
|
||||
|
||||
this.on("uploadprogress", function(file, progress) {
|
||||
$('#upload_progress_bar').css('width', progress+'%');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
.row style="margin-top: 20px"
|
||||
.span12.text-center
|
||||
h1 Upload New Files
|
||||
|
||||
.row
|
||||
.span5.text-center
|
||||
h5 Neocities uses a "drag and drop" file upload. Simply take files and drop them from your computer on the white box (or click it) and they are uploaded.
|
||||
div style="background-color: #FFFFFF;"
|
||||
form action="/site_files/upload" class="dropzone" id="uploads"
|
||||
input name="csrf_token" type="hidden" value="#{csrf_token}"
|
||||
|
||||
div id="upload_progress"
|
||||
.progress.progress-info.progress-striped
|
||||
.bar id="upload_progress_bar" style="width: 0%"
|
||||
|
||||
div id="upload_status" style="font-size: 16pt"
|
||||
|
||||
div style="margin-top: 20px"
|
||||
a.btn-Action href="/dashboard" Finish
|
||||
|
||||
.span6.text-center
|
||||
|
||||
p Files has to be one of the following types:
|
||||
ul id="file_criteria"
|
||||
li HTML (.html, .htm, .mf)
|
||||
li Image (.jpg, .png, .gif, .svg)
|
||||
li Markdown (.md, .markdown)
|
||||
li JavaScript (.js, .json, .geojson)
|
||||
li CSS (.css)
|
||||
li Text (.txt, .text, .csv, .tsv)
|
||||
li Web Fonts (.eot, .ttf, .woff, .svg)
|
||||
li XML (.xml)
|
||||
li PGP Keys (.asc, .key)
|
||||
|
||||
p If the file already exists, <u><b>it will be overwritten without warning</b></u>.
|
||||
p It has to be <u>legal to share this content in the United States</u>.
|
||||
p It must fit into your home page space (#{current_site.available_space_in_megabytes}MB remaining).
|
||||
p The file uploader will automatically scrub any characters not matching: a-z A-Z 0-9 _ - .
|
||||
|
Loading…
Add table
Reference in a new issue