mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix for new page create with directories
This commit is contained in:
parent
b446160d6b
commit
20bdd2ac55
4 changed files with 6 additions and 3 deletions
4
app.rb
4
app.rb
|
@ -1037,6 +1037,8 @@ post '/site_files/create_page' do
|
|||
|
||||
name = "#{params[:pagefilename]}.html"
|
||||
|
||||
name = "#{params[:dir]}/#{name}" if params[:dir]
|
||||
|
||||
if current_site.file_exists?(name)
|
||||
@errors << %{Web page "#{name}" already exists! Choose another name.}
|
||||
halt erb(:'site_files/new_page')
|
||||
|
@ -1046,7 +1048,7 @@ post '/site_files/create_page' do
|
|||
|
||||
flash[:success] = %{#{name} was created! <a style="color: #FFFFFF; text-decoration: underline" href="/site_files/text_editor/#{name}">Click here to edit it</a>.}
|
||||
|
||||
redirect '/dashboard'
|
||||
redirect params[:dir] ? "/dashboard?dir=#{Rack::Utils.escape params[:dir]}" : '/dashboard'
|
||||
end
|
||||
|
||||
get '/site_files/new' do
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a href="/site_files/new_page" class="btn-Action"><i class="fa fa-file"></i> New Page</a>
|
||||
<a href="/site_files/new_page?dir=<%= Rack::Utils.escape @dir %>" class="btn-Action"><i class="fa fa-file"></i> New Page</a>
|
||||
<a href="#createDir" class="btn-Action" data-toggle="modal"><i class="fa fa-folder"></i> New Folder</a>
|
||||
<a href="#" class="btn-Action" onclick="clickUploadFiles(); return false"><i class="fa fa-upload"></i> Upload</a>
|
||||
</div>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
<section>
|
||||
<form method="POST" action="/site_files/create_page" enctype="multipart/form-data">
|
||||
<%== csrf_token_input_html %>
|
||||
<input name="dir" type="hidden" value="<%= params[:dir] %>">
|
||||
<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>
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
if(quit === true) {
|
||||
window.location = '/dashboard'
|
||||
} else {
|
||||
$('#editorUpdates span').html('<i class="icon-save icon-2x"></i> <span style="font-size: 14pt">Your file has been saved.</span>')
|
||||
$('#editorUpdates span').html('<i class="fa fa-floppy-o"></i> Your file has been saved.')
|
||||
$('a#saveButton,a#saveAndExitButton').css('opacity', 0.5)
|
||||
setTimeout(function() {
|
||||
$('#editorUpdates').fadeOut(); //.addClass('hidden');
|
||||
|
|
Loading…
Add table
Reference in a new issue