diff --git a/README b/README index 341a85e1..49ffe76c 100644 --- a/README +++ b/README @@ -35,7 +35,7 @@ to get and set the environment variable SECRET_KEY_BASE create user: -rails db production +rails console production User.create(name: 'tester', password: 'secret') diff --git a/app/controllers/htmls_controller.rb b/app/controllers/htmls_controller.rb index ce059d23..6874d5a2 100644 --- a/app/controllers/htmls_controller.rb +++ b/app/controllers/htmls_controller.rb @@ -1,5 +1,9 @@ class HtmlsController < ApplicationController def edit @page = Page.find(params[:id]) + if params[:format] == "scrubbed" + render "scrubbed" and return + end end + end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 99aad890..ff2bad7d 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -95,6 +95,10 @@ def update @page.raw_html = params[:pasted] flash[:notice] = "Raw HTML updated." redirect_to page_path(@page) and return + when "Update Scrubbed HTML" + @page.clean_html = params[:pasted] + flash[:notice] = "Clean HTML updated." + redirect_to page_path(@page) and return when "Scrub" top = params[:top_node] || 0 bottom = params[:bottom_node] || 0 diff --git a/app/views/pages/_links.html.haml b/app/views/pages/_links.html.haml index e4e482c4..c18ef277 100644 --- a/app/views/pages/_links.html.haml +++ b/app/views/pages/_links.html.haml @@ -25,6 +25,7 @@ = link_to "Hiddens", hidden_path(page) %br = link_to "Manage Parts", edit_part_path(page) + = link_to "Edit Scrubbed HTML", edit_html_path(page, format: "scrubbed") unless page.uploaded = link_to "Edit Raw HTML", edit_html_path(page) unless page.uploaded = link_to "Scrub", scrub_path(page) unless page.uploaded = link_to "Refetch", refetch_path(page) unless page.uploaded