application_helper.rb revision 00c175adc24043fbcd4cd5e3769c9d13e31ff831
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi elsif params[:controller] == 'categories' && params[:action] == 'show'
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi elsif %w(categories logics mappings ontologies).include? params[:controller]
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi 'shared/user_ontologies' unless in_repository?
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi elsif params[:controller] == 'repositories'
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi params[:controller] == 'home' && !user_signed_in?
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi params[:repository_id] || params[:controller] == 'repositories'
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi if !params[:repository_id] && !(params[:controller] == 'repositories' && params[:id])
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi @resource_chain = [ Repository.find_by_path!( controller_name=='repositories' ? params[:id] : params[:repository_id] )]
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi if id = (controller_name=='ontologies' ? params[:id] : params[:ontology_id])
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi @resource_chain << Ontology.find(id)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi @resource_chain
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi def display_commit?
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi !! Settings.display_head_commit
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi def display_commit
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # try to read the HEAD from the Git repository
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $commit_oid ||= begin
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi path = Rails.root.join(".git")
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi Subprocess.run(*%w(git rev-parse --short HEAD), GIT_DIR: path.to_s).strip if path.exist?
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi # try to read the revision from file
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $commit_oid ||= begin
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi path = Rails.root.join("REVISION")
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi path.read.strip if path.exist?
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi $commit_oid ||= 'unknown'
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi def to_name(sym)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi sym.to_s.gsub('_', ' ')
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi def determine_label_type(state)
d14abf155341d55053c76eeec58b787a456b753bRobert Mustacchi State::STATE_LABEL[state.to_sym]