Skip to content
This repository
Browse code

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...
commit 4d4ab458b9c633ce756ce1445915ac5f9307a712 1 parent 8aba2e7
Daniel Martin authored
50 app/controllers/json_controller.rb
... ... @@ -1,50 +0,0 @@
1   -# This soon-to-be-depreacted controller exposes a series of functions to
2   -# operate with different models using JSON.
3   -#
4   -# It was created before proper REST controllers were implemented for the
5   -# majority of the models and as such it duplicates funcionality that should
6   -# be implemented in them.
7   -#
8   -# This controller will be removed in Dradis 3.0
9   -class JsonController < ApplicationController
10   - before_filter :login_required
11   -
12   - # Create a new Node from its :label and :parent_id
13   - def node_create
14   - node = Node.new({
15   - :label => params[:label],
16   - :parent_id => params[:parent_id]
17   - })
18   - node.save
19   - render :text => node.id
20   - end
21   -
22   - # Update the attributes of a Node from the values submitted in a non-standard
23   - # POST request
24   - def node_update
25   - begin
26   - node = Node.find(params[:id].to_i)
27   - rescue
28   - render :text => 'node not found'
29   - return
30   - end
31   - node.update_attributes({
32   - :label => params[:label],
33   - :parent_id => params[:parent_id]
34   - })
35   - render :text => 'noerror'
36   - end
37   -
38   - # Delete a Node given its :id
39   - def node_delete
40   - begin
41   - node = Node.find(params[:id].to_i)
42   - node.destroy
43   - render :text => 'noerror'
44   - rescue
45   - render :text => 'node not found'
46   - return
47   - end
48   - end
49   -
50   -end
2  app/helpers/json_helper.rb
... ... @@ -1,2 +0,0 @@
1   -module JsonHelper # :nodoc:
2   -end
2  app/views/json/nodes.html.erb
... ... @@ -1,2 +0,0 @@
1   -<h1>Json#nodes</h1>
2   -<p>Find me in app/views/json/nodes.html.erb</p>
8 test/functional/json_controller_test.rb
... ... @@ -1,8 +0,0 @@
1   -require File.dirname(__FILE__) + '/../test_helper'
2   -
3   -class JsonControllerTest < ActionController::TestCase
4   - # Replace this with your real tests.
5   - def test_truth
6   - assert true
7   - end
8   -end

0 comments on commit 4d4ab45

Please sign in to comment.
Something went wrong with that request. Please try again.