Skip to content

Commit

Permalink
allow direct editing of scrubbed content
Browse files Browse the repository at this point in the history
  • Loading branch information
ambtus committed Apr 29, 2016
1 parent aabbc9a commit 17f954d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -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')

Expand Down
4 changes: 4 additions & 0 deletions 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
4 changes: 4 additions & 0 deletions app/controllers/pages_controller.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/views/pages/_links.html.haml
Expand Up @@ -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
Expand Down

0 comments on commit 17f954d

Please sign in to comment.