app/controllers/concepts/hierarchical_controller.rb in iqvoc-4.1.1 vs app/controllers/concepts/hierarchical_controller.rb in iqvoc-4.1.2
- old
+ new
@@ -52,10 +52,21 @@
a.pref_label.to_s <=> b.pref_label.to_s
end
respond_to do |format|
format.html
- format.json # Treeview data
+ format.json do # Treeview data
+ concepts = @concepts.select {|c| can? :read, c }.map do |c|
+ {
+ :id => c.id,
+ :url => concept_path(:id => c, :format => :html),
+ :text => CGI.escapeHTML(c.pref_label.to_s),
+ :hasChildren => (params[:broader] ? c.broader_relations.any? : c.narrower_relations.any?),
+ :additionalText => (" (#{c.additional_info})" if c.additional_info.present?)
+ }
+ end
+ render :json => concepts
+ end
end
end
end