app/controllers/scrivito/objs_controller.rb in scrivito_sdk-1.0.0 vs app/controllers/scrivito/objs_controller.rb in scrivito_sdk-1.1.0.rc1

- old
+ new

@@ -33,12 +33,16 @@ def create params_parser = ObjCreateParamsParser.new(request.host, request.port) @obj = Obj.create(params_parser.parse(params[:obj]), scrivito_user: scrivito_user) render :obj - rescue ObjClassNotFound - head :not_found + rescue ObjClassNotFound => e + raise ClientError.new( + "You've tried to create a CMS object based on the \"#{e.message}\" class, which is "\ + "either missing or not suitable for the object.", + 400 + ) end def details assert_dialog_layout render current_obj.details_view_path, layout: 'scrivito_dialog', formats: :html @@ -46,18 +50,16 @@ def update params_parser = ObjUpdateParamsParser.new(request.host, request.port, current_obj: current_obj, scrivito_user: scrivito_user) current_obj.update(params_parser.parse(params[:obj])) - rescue ObjClassNotFound - head :not_found end def destroy in_selected_workspace do parent = current_obj.parent - @redirect_to = parent ? scrivito_path(parent) : scrivito_root_path + @redirect_to = parent ? scrivito_path(parent) : "/" current_obj.destroy end end def destroy_widget @@ -92,10 +94,17 @@ def is_outdated in_selected_workspace { @is_outdated = current_obj.outdated? } end + def binary_no_cache + in_selected_workspace do + 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 @@ -156,9 +165,10 @@ attribute, options = MultiJson.decode(facet_params).values_at('attribute', 'options') @facets = @enumerator.facet(attribute, options || {}) return render action: 'search/facet' end + @batch = @enumerator.fetch_batch(params[:continuation]) render :search end end private