Skip to content

Commit

Permalink
Add helper method for favorite path icon
Browse files Browse the repository at this point in the history
Use folder icon for normal favorite paths, which previously had no icon.
  • Loading branch information
robinkar committed Sep 28, 2023
1 parent 5140353 commit e887f21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions apps/dashboard/app/apps/favorite_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ def remote?
filesystem != "fs"
end

# FontAwesome icon to use for links
def icon
remote? ? 'cloud' : 'folder'
end

def to_s
path.to_s
end
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/apps/ood_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def links
subtitle: favorite_path.title ? favorite_path.path.to_s : nil,
description: manifest.description,
url: OodAppkit::Urls::Files.new(base_url: url).url(path: favorite_path.path.to_s, fs: favorite_path.filesystem),
icon_uri: favorite_path.remote? ? "fas://cloud" : "fas://folder",
icon_uri: "fas://#{favorite_path.icon}",
caption: caption,
new_tab: open_in_new_window?,
tile: tile
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/views/files/_favorites.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% OodFilesApp.new.favorite_paths.each do |p| %>
<li class="nav-item">
<%= link_to files_path(p.filesystem, p.path.to_s), class: "nav-link d bg-light" do %>
<%= fa_icon "cloud", classes: '' if p.remote? %>
<%= fa_icon p.icon, classes: '' %>
<%= p.title || p.path.to_s %>
<% end %>
</li>
Expand Down

0 comments on commit e887f21

Please sign in to comment.