Set order of Interactive Apps menu items?

We would like to set the display order of subcategories on the Interactive Apps menu. We currently put applications into one of two subcategories.

subcategory: Desktops
subcategory: Applications

Right now, that displays in the Interactive Applications menu in alphabetical order, so Applications appear at the top.

Is there an official way to set the order of appearance so that Desktops precedes Applications?

I can get the proper order in a really goofy way by making the sbucategories

subcategory: " Desktops"
subcategory: Applications

but that makes me cringe.

Thanks.

This may work for you. If you drop this file in /etc/ood/config/dasbhoard/initializers/group_by_sub_category.rb.

It’s a re-implementation of the original OodAppGroup#groups_for to just reverse it if you’re grouping by subcategory.

class OodAppGroup
  # given an array of apps, group those apps by app category (or the attribute)
  # specified by 'group_by', sorting both groups and apps arrays by title
  def self.groups_for(apps: [], group_by: :category)
    grouped = apps.group_by { |app|
                app.send(group_by)
              }.map { |k,v|
                OodAppGroup.new(title: k, apps: v.sort_by { |a| a.title })
              }.sort_by { |g| g.title }

    group_by.to_s == "subcategory" ? grouped.reverse : grouped
  end
end

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