app/controllers/neofiles/admin_controller.rb in neofiles-1.3.2 vs app/controllers/neofiles/admin_controller.rb in neofiles-2.0.0
- old
+ new
@@ -7,11 +7,11 @@
# mainly form backend for AJAX calls.
#
class Neofiles::AdminController < ApplicationController
# TODO: remove this! it should be controlled on application side
- skip_before_filter :verify_authenticity_token
+ skip_before_action :verify_authenticity_token
# Build AJAX edit/upload form for a single file in compact way: small file thumbnail + misc buttons, like "delete",
# "change options" etc.
#
# It is expected that someday there will be "full" view (hence the prefix "compact" here), with metadata shown
@@ -105,19 +105,18 @@
file_objects << file
end
result = []
file_objects.each_with_index do |file, i|
- append_create_position = Rails.application.config.neofiles.album_append_create_side == :left ? i == 0 : i == file_objects.count - 1
- result << file_compact(data.merge(id: file.id, widget_id: "#{data[:widget_id]}_ap_#{i}", append_create: append_create_position && !old_file && data[:append_create] == '1' ? '1' : '0'))
+ result << file_compact(data.merge(id: file.id, widget_id: "#{data[:widget_id]}_ap_#{i}", append_create: i == file_objects.count - 1 && !old_file && data[:append_create] == '1' ? '1' : '0'))
end
if result.empty?
raise ArgumentError.new(last_exception || (errors.empty? ? I18n.t('neofiles.file_not_passed') : errors.join("\n")))
end
- render text: result.join, layout: false
+ render plain: result.join, layout: false
end
# As we don't actually delete anything, this method only marks file as deleted.
#
# This method uses clean_remove parameter originally passed to #file_compact (stored by JavaScript and sent again
@@ -127,11 +126,11 @@
file, data = find_file_and_data
file.is_deleted = true
file.save!
- return render text: '' if data[:clean_remove].present? && data[:clean_remove] != '0'
+ return render plain: '' if data[:clean_remove].present? && data[:clean_remove] != '0'
redirect_to neofiles_file_compact_path(data.merge(id: nil))
end
# As Neofiles treats files as immutables, this method updates only auxiliary fields: description, no_wm etc.
@@ -139,10 +138,10 @@
# Returns nothing.
#
def file_update
file, data = find_file_and_data
file.update data.slice(:description, :no_wm)
- render text: '', layout: false
+ render plain: '', layout: false
end
# Neofiles knows how to play with Redactor.js and this method persists files uploaded via this WYSIWYG editor.
#
# Redactor.js may know which owner object is edited so we can store owner_type/id for later use.
\ No newline at end of file