- if signed_in?
  ul.right
    li class=active_class('dunlop#changelog')
      = link_to Rails.application.config.git_version, dunlop.changelog_path, title: 'Current version, click for changelog'
    li class=active_class('dunlop/users#profile', 'dunlop/users#edit_profile') = link_to current_user.email.to_s.sub(/\@.*/, ''), dunlop.profile_users_path
    li= link_to 'Sign out', main_app.destroy_user_session_path, method: :delete
  ul.left
    - if can? :index, WorkflowInstance
      li.has-dropdown class=active_class('workflow_instance')
        = link_to WorkflowInstance.model_name.human_plural, '#'
        ul.dropdown
          - WorkflowInstance.scenario_classes.each do |scenario|
            - if can? :read, scenario
              li class=active_class("workflow_instance/#{scenario.process_name.pluralize}") = link_to scenario.model_name.human_plural, [main_app, scenario]
    - if can? :index, WorkflowInstanceBatch
      li.has-dropdown class=active_class('workflow_instance_batch')
        = link_to WorkflowInstanceBatch.model_name.human_plural, '#'
        ul.dropdown
          - WorkflowInstance.scenario_classes.each do |scenario|
            - if can? :read, scenario.batch_class
              li class=active_class("workflow_instance_batch/#{scenario.batch_class.process_name.pluralize}") = link_to scenario.batch_class.model_name.human_plural, [main_app, scenario.batch_class]
    /- if can? :index, SourceFile or can? :index, TargetFile
      li.has-dropdown class=active_class('dunlop/source_files', 'dunlop/target_files')
        = link_to 'Files', '#'
        ul.dropdown
    - if can? :index, SourceFile
      li class=active_class('dunlop/source_files') = link_to SourceFile.model_name.human_plural, dunlop.source_files_path
    - if can? :index, TargetFile
      li class=active_class('dunlop/target_files') = link_to TargetFile.model_name.human_plural, dunlop.target_files_path
    - if can? :index, User
      li.has-dropdown class=active_class("dunlop/users", except: /profile$/)
        = link_to 'Admin', '#'
        ul.dropdown
          li class=active_class('dunlop/users', except: /profile$/) = link_to User.model_name.human_plural, dunlop.users_path
    /li{ class: active_class('manual') }= link_to 'Manual', manual_root_path
- else
  ul.right
    li= link_to 'Sign In', main_app.new_user_session_path

