Skip to content
Snippets Groups Projects
Commit 54035b0a authored by Arnaud Levy's avatar Arnaud Levy
Browse files

refactor

parent c635faca
No related branches found
No related tags found
No related merge requests found
......@@ -91,6 +91,15 @@ module Admin::ApplicationHelper
''
end
def collection(list)
list.ordered.map do |e|
{
label: e.to_s,
id: e.id
}
end
end
def collection_tree(list, except = nil)
collection = []
list.root.ordered.each do |object|
......
......@@ -21,27 +21,19 @@
<%
if item.has_about?
if item.kind_page?
about_collection = collection_tree(@website.pages)
about_collection = collection_tree @website.pages
elsif item.kind_diploma?
about_collection = @website.education_diplomas
.ordered
.map { |e| { label: e.to_s, id: e.id } }
about_collection = collection @website.education_diplomas
elsif item.kind_program?
about_collection = collection_tree(@website.education_programs)
about_collection = collection_tree @website.education_programs
elsif item.kind_news_category?
about_collection = collection_tree(@website.categories)
about_collection = collection_tree @website.categories
elsif item.kind_news_article?
about_collection = @website.posts
.ordered
.map { |e| { label: e.to_s, id: e.id } }
about_collection = collection @website.posts
elsif item.kind_research_volume?
about_collection = @website.research_volumes
.ordered
.map { |e| { label: e.to_s, id: e.id } }
about_collection = collection @website.research_volumes
elsif item.kind_research_article?
about_collection = @website.research_articles
.ordered
.map { |e| { label: e.to_s, id: e.id } }
about_collection = collection @website.research_articles
end
else
about_collection = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment