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