Class: HierarchyController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hierarchy_controller.rb

Overview

Copyright 2011-2013 innoQ Deutschland GmbH

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Method Summary collapse

Instance Method Details

#indexObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/hierarchy_controller.rb', line 44

def index
  authorize! :read, Iqvoc::Concept.base_class

  # special-casing to avoid confusion, based on user feedback
  if params[:root]
    msg = ['to use a specific concept as hierarchy root, please use',
        url_for(params.merge 'action' => 'show')].join("\n")
    render status: 400, text: msg
    return
  end

  depth = params[:depth] || (unbounded? ? -1 : nil)

  render_hierarchy 'scheme', depth, unbounded?
end

#showObject



93
94
95
96
97
# File 'app/controllers/hierarchy_controller.rb', line 93

def show
  authorize! :read, Iqvoc::Concept.base_class

  render_hierarchy params[:root], params[:depth], unbounded?
end