navigation_helper.rb revision f492e3654fb1476c90a63dcaec31ad174c6c4915
# encoding: UTF-8
pages = [
]
end
@top_level_pages = [
['Comments', :comments],
['Metadata', :metadata],
['Versions', :ontology_versions],
['Graphs', :graphs],
['Links', :links]
]
@metadatas = [
['Projects', repository_ontology_projects_path],
['Categories', repository_ontology_categories_path],
['Tasks', repository_ontology_tasks_path],
['License Model', repository_ontology_license_models_path]
]
end
pages = []
else
end
actions = []
# Add counters
pages.each do |row|
counter_key = "#{row[0]}_count"
row << ontology.send(counter_key) if ontology.respond_to?(counter_key)
end
@page_title = ontology.to_s
@page_title = "#{current_page.capitalize} · #{@page_title}" if current_page != pages[0][0]
render :partial => '/ontologies/info', :locals => {
resource: ontology,
current_page: current_page,
pages: pages,
additional_actions: [],
files: ontology.repository.paths_starting_with(ontology.basepath)
}
end
def subnavigation(resource, pages, current_page, additional_actions = [])
# Add counters
pages.each do |row|
counter_key = "#{row[0]}_count"
row << resource.send(counter_key) if resource.respond_to?(counter_key)
end
@page_title = current_page
@page_title = "#{current_page.capitalize} · #{@page_title}" if current_page != pages[0][0]
render :partial => '/shared/subnavigation', :locals => {
resource: resource,
current_page: current_page,
pages: pages,
additional_actions: additional_actions
}
end
def team_nav(team, current_page)
pages = [
[:overview, team],
[:permissions, [team, :permissions]]
]
pages << [:members, [team, :team_users]] if can? :edit, team
subnavigation(team, pages, current_page)
end
def active_navigation(controller)
if params[:repository_id]
if params[:ontology_id]
return 'active' if controller == :ontologies
else
return 'active' if controller == :repositories
end
else
return 'active' if [controller.to_s, controller.to_s.gsub('_', '/')].include? params[:controller]
end
end
def menu_entry(title, controller)
content_tag :li, class: active_navigation(controller) do
link_to title, controller
end
end
end