15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/decidim/assemblies/assemblies_controller.rb', line 15
def index
enforce_permission_to :list, :assembly
respond_to do |format|
format.html do
raise ActionController::RoutingError, "Not Found" if published_assemblies.none?
render "index"
end
format.js do
raise ActionController::RoutingError, "Not Found" if published_assemblies.none?
render "index"
end
format.json do
render json: published_assemblies.query.includes(:children).where(parent: nil).collect { |assembly|
{
name: assembly.title[I18n.locale.to_s],
children: assembly.children.collect do |child|
{
name: child.title[I18n.locale.to_s],
children: child.children.collect { |child_of_child| { name: child_of_child.title[I18n.locale.to_s] } }
}
end
}
}
end
end
end
|