From 49055145f12c8ccecea92b93dbd7241f84cb99de Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Fri, 1 Aug 2014 20:30:06 -0700 Subject: [PATCH] new page -> erb --- app.rb | 13 ++---- views/site_files/new.slim | 39 ----------------- views/site_files/new_page.erb | 32 ++++++++++++++ views/site_files/new_page.slim | 23 ---------- views/site_files/upload.slim | 78 ---------------------------------- 5 files changed, 36 insertions(+), 149 deletions(-) delete mode 100644 views/site_files/new.slim create mode 100644 views/site_files/new_page.erb delete mode 100644 views/site_files/new_page.slim delete mode 100644 views/site_files/upload.slim diff --git a/app.rb b/app.rb index 2b781b19..5311909c 100644 --- a/app.rb +++ b/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) diff --git a/views/site_files/new.slim b/views/site_files/new.slim deleted file mode 100644 index 94ff7293..00000000 --- a/views/site_files/new.slim +++ /dev/null @@ -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, it will be overwritten without warning. - h4 It has to be legal to share this content in the United States. - 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 _ - . diff --git a/views/site_files/new_page.erb b/views/site_files/new_page.erb new file mode 100644 index 00000000..af6e4b77 --- /dev/null +++ b/views/site_files/new_page.erb @@ -0,0 +1,32 @@ +
+
+

New Page

+

Create a new HTML page

+
+
+ +
+
+

+
+ <% if @errors %> +
+ <% @errors.each do |error| %> + <%= error %> + <% end %> +
+ <% end %> +
+
+
+ <%== csrf_token_input_html %> +

What's the name of your page?

+

.html

+

+ +

Note: We will automatically scrub any characters not matching: a-z A-Z 0-9 _ - .

+

Page must not already exist.

+

If you want to make this the index page (and an index page doesn't exist), name it index.html.

+
+
+
\ No newline at end of file diff --git a/views/site_files/new_page.slim b/views/site_files/new_page.slim deleted file mode 100644 index fdb0a4a3..00000000 --- a/views/site_files/new_page.slim +++ /dev/null @@ -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 index.html. \ No newline at end of file diff --git a/views/site_files/upload.slim b/views/site_files/upload.slim deleted file mode 100644 index 0fa4d007..00000000 --- a/views/site_files/upload.slim +++ /dev/null @@ -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, it will be overwritten without warning. - p It has to be legal to share this content in the United States. - 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 _ - . -