Customizing Files app favorites

Hi, I’m trying to follow the customization instructions for the Files app found here:
https://osc.github.io/ood-documentation/latest/customization.html

Specifically this:

OodFilesApp.candidate_favorite_paths.tap do |paths|
  # add project space directories
  projects = User.new.groups.map(&:name).grep(/^P./)
  paths.concat projects.map { |p| FavoritePath.new("/fs/project/#{p}")  }

  # add User scratch space directory
  paths << FavoritePath.new("/fs/scratch/#{User.new.name}")

  # Project scratch is given an optional title field
  paths.concat projects.map { |p| FavoritePath.new("/fs/scratch/#{p}", title: "Scratch")  }
end

So, I don’t understand how this does what it does.

  1. What is the “tap” attribute of OodFilesApp.candidate_favorite_paths? This is a method? So nothing will happen in this initializer without doing something with method “tap?”
  2. I don’t need anything this complicated w/r/t building a dynamic list of favorites every time the user opens the dashboard. It only needs exactly one path (/mnt/data) – in fact, I don’t even want the user’s home. How can this be accomplished?

Thanks!

tap, and the way we’re using it here, is sort of a ruby idiom. Sort of a ‘give me this thing (paths) and let me operate on that thing’ - without having to keep it as a variable or similar.

In any case - this should work for you.

OodFilesApp.candidate_favorite_paths.tap do |paths|
  paths << FavoritePath.new("/mnt/data")
end

This much simpler form may actually work for you, but I’m only like 80% sure without actually trying it out.

OodFilesApp.candidate_favorite_paths << FavoritePath.new("/mnt/data")

Close, but “Home” is still there.

In my /etc/ood/config/apps/dashboard/initializers/ood.rb file I have:

OodFilesApp.candidate_favorite_paths.tap do |paths|
   # add scratch space directories
   paths << Pathname.new("/fs/scratch/#{User.new.name}")
end

But I don’t have access to my /scratch directory in Files:
Am I missing something?

image

It maybe an issue with the Pathname. Try FavoritePath instead.

OodFilesApp.candidate_favorite_paths.tap do |paths|
   # add scratch space directories
   paths << FavoritePath.new("/fs/scratch/#{User.new.name}")
end

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.