Browse files

Remove the JsonController and all associated files

This controller was created back in the day when we didn't have a good
understanding of how to make things RESTful.
  • Loading branch information...
1 parent 8aba2e7 commit 4d4ab458b9c633ce756ce1445915ac5f9307a712 Daniel Martin committed Jul 5, 2011
View
50 app/controllers/json_controller.rb
@@ -1,50 +0,0 @@
-# This soon-to-be-depreacted controller exposes a series of functions to
-# operate with different models using JSON.
-#
-# It was created before proper REST controllers were implemented for the
-# majority of the models and as such it duplicates funcionality that should
-# be implemented in them.
-#
-# This controller will be removed in Dradis 3.0
-class JsonController < ApplicationController
- before_filter :login_required
-
- # Create a new Node from its :label and :parent_id
- def node_create
- node = Node.new({
- :label => params[:label],
- :parent_id => params[:parent_id]
- })
- node.save
- render :text => node.id
- end
-
- # Update the attributes of a Node from the values submitted in a non-standard
- # POST request
- def node_update
- begin
- node = Node.find(params[:id].to_i)
- rescue
- render :text => 'node not found'
- return
- end
- node.update_attributes({
- :label => params[:label],
- :parent_id => params[:parent_id]
- })
- render :text => 'noerror'
- end
-
- # Delete a Node given its :id
- def node_delete
- begin
- node = Node.find(params[:id].to_i)
- node.destroy
- render :text => 'noerror'
- rescue
- render :text => 'node not found'
- return
- end
- end
-
-end
View
2 app/helpers/json_helper.rb
@@ -1,2 +0,0 @@
-module JsonHelper # :nodoc:
-end
View
2 app/views/json/nodes.html.erb
@@ -1,2 +0,0 @@
-<h1>Json#nodes</h1>
-<p>Find me in app/views/json/nodes.html.erb</p>
View
8 test/functional/json_controller_test.rb
@@ -1,8 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class JsonControllerTest < ActionController::TestCase
- # Replace this with your real tests.
- def test_truth
- assert true
- end
-end

0 comments on commit 4d4ab45

Please sign in to comment.