navigation_helper.rb revision 6f254ee6d91f5511136472397615afa6568f3ac0
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano @active_kind = @entities.first.kind if current_page == :entities
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano # action link to new version
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano actions << link_to('New version', [:new, ontology, :ontology_version ]) if can? :edit, ontology
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano # add counters
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano pages.each do |row|
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano counter_key = "#{row[0]}_count"
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano row << ontology.send(counter_key) if ontology.respond_to?(counter_key)
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano @page_title = ontology.to_s
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano @page_title = "#{current_page.capitalize} · #{@page_title}" if current_page != pages[0][0]
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano render :partial => '/ontologies/info', :locals => {
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano resource: ontology,
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano current_page: current_page,
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano pages: pages,
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano additional_actions: []
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano def subnavigation(resource, pages, current_page, additional_actions = [])
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano # add counters
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano pages.each do |row|
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano counter_key = "#{row[0]}_count"
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano row << resource.send(counter_key) if resource.respond_to?(counter_key)
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano @page_title = resource.to_s
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano @page_title = "#{current_page.capitalize} · #{@page_title}" if current_page != pages[0][0]
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano render :partial => '/shared/subnavigation', :locals => {
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano resource: resource,
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano current_page: current_page,
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano pages: pages,
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano additional_actions: additional_actions
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano def team_nav(team, current_page)
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano [:overview, team],
b6d441f289eb03a1a6fe0662a14c26ecc852be21dlezcano [:permissions, [team, :permissions]]
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano pages << [:members, [team, :team_users]] if can? :edit, team
f1d8791c17f7e0f131de20d7bbc8836b992bd4dbdlezcano subnavigation(team, pages, current_page)