diff --git a/app/controllers/api/settings_controller.rb b/app/controllers/api/settings_controller.rb index 0fcdf81..a681c76 100644 --- a/app/controllers/api/settings_controller.rb +++ b/app/controllers/api/settings_controller.rb @@ -25,13 +25,19 @@ class Api::SettingsController < ApplicationController end def destroy - unless @config.elements.index(@section) - render_404 - return + if params[:label] == "ROOT" + name = params[:pluginType] + arg = params[:arg] + else + name = "label" + arg = params[:label] + end + if @config.delete_element(name, arg, @target_element) + @config.write_to_file + head :no_content # 204 + else + render_404 end - @config.elements.delete @section - @config.write_to_file - head :no_content # 204 end private