diff options
| -rw-r--r-- | app/controllers/pages_controller.rb | 12 | ||||
| -rw-r--r-- | config/initializers/xmlparser.rb | 9 |
2 files changed, 12 insertions, 9 deletions
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index a40bf10..2d08dea 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb | |||
| @@ -3,21 +3,19 @@ class PagesController < ApplicationController | |||
| 3 | # Private | 3 | # Private |
| 4 | 4 | ||
| 5 | before_action :login_required | 5 | before_action :login_required |
| 6 | 6 | ||
| 7 | def preview | 7 | def preview |
| 8 | @page = Page.find(params[:id]) | 8 | @page = Page.find(params[:id]) |
| 9 | 9 | ||
| 10 | if @page | 10 | if @page |
| 11 | template = @page.valid_template | 11 | template = @page.valid_template |
| 12 | render( | 12 | render( |
| 13 | :file => template, | 13 | template: template, |
| 14 | :layout => "application" | 14 | layout: "application" |
| 15 | ) | 15 | ) |
| 16 | end | 16 | end |
| 17 | |||
| 18 | end | 17 | end |
| 19 | 18 | ||
| 20 | |||
| 21 | def sort_images | 19 | def sort_images |
| 22 | page = Page.find(params[:id]) | 20 | page = Page.find(params[:id]) |
| 23 | page.update_assets(params[:images]) | 21 | page.update_assets(params[:images]) |
diff --git a/config/initializers/xmlparser.rb b/config/initializers/xmlparser.rb index 9c3f1c8..1d5e06d 100644 --- a/config/initializers/xmlparser.rb +++ b/config/initializers/xmlparser.rb | |||
| @@ -1,14 +1,19 @@ | |||
| 1 | class XML::Node | 1 | class XML::Node |
| 2 | def replace_with(other) | 2 | def replace_with(other) |
| 3 | self.next = other | 3 | self.next = other |
| 4 | remove! | 4 | remove! |
| 5 | end | 5 | end |
| 6 | end | 6 | end |
| 7 | 7 | ||
| 8 | # Builder 3.x escapes content by default. Override _escape to pass text | ||
| 9 | # through raw, preserving existing behaviour from the Rails 2 era. | ||
| 10 | # Note: require builder first to ensure XmlBase < BasicObject is already | ||
| 11 | # defined before we reopen it. | ||
| 12 | require 'builder' | ||
| 8 | module Builder | 13 | module Builder |
| 9 | class XmlBase | 14 | class XmlBase |
| 10 | def _escape(text) | 15 | def _escape(text) |
| 11 | text | 16 | text |
| 12 | end | 17 | end |
| 13 | end | 18 | end |
| 14 | end \ No newline at end of file | 19 | end |
