app/controllers/scrivito/objs_controller.rb in scrivito_sdk-1.4.3 vs app/controllers/scrivito/objs_controller.rb in scrivito_sdk-1.5.0.rc1
- old
+ new
@@ -1,24 +1,19 @@
module Scrivito
class ObjsController < WebserviceController
around_action :require_selected_workspace_write_authorization, only: [
- :copy,
:create,
:destroy,
- :duplicate,
- :mark_resolved,
:restore,
:restore_widget,
:revert,
:revert_widget,
:update,
]
before_filter :require_identical_selected_and_visible_workspace, only: [
- :copy,
:create,
- :duplicate,
:page_class_selection,
:update,
:widget_class_selection,
]
@@ -90,20 +85,10 @@
binary = current_obj[params[:attribute_name]]
@no_cache_url = binary.no_cache_url
end
end
- def mark_resolved
- in_selected_workspace { current_obj.mark_resolved }
- render_empty_json
- end
-
- def copy
- @obj = copy_obj(current_obj, params[:parent_path])
- render :obj
- end
-
def transfer_modifications
in_selected_workspace do
begin
obj = Obj.find_including_deleted(params[:id])
workspace = Workspace.find(params[:workspace_id])
@@ -116,15 +101,10 @@
@error_reason = :conflict
end
end
end
- def duplicate
- @obj = copy_obj(current_obj, current_obj.parent_path)
- render :obj
- end
-
def page_class_selection
@page_class_markup = valid_page_classes.map do |page_class_name|
build_selection_option(page_class_name)
end
end
@@ -199,14 +179,9 @@
raise ScrivitoError, 'no widget_id param specified' if params[:widget_id].blank?
unless @widget = current_obj.widget_from_pool(params[:widget_id])
raise ResourceNotFound, "widget with ID '#{params[:widget_id]}' not found"
end
@widget
- end
-
- def copy_obj(obj, parent_path)
- id = SecureRandom.hex(8)
- obj.copy(_id: id, _path: parent_path && "#{parent_path}/#{id}")
end
def fetch_formatter(name)
name ? Configuration.obj_formats[name] : proc { |obj, _| obj.id }
end