How to customize

While Uchi comes with a set of sensible defaults you’ll inevitably find the need to customize things to fit your application.

The default navigation menu renders a sorted list of all the repositories included in Uchi. If you want more control over how this is done, you have a few options:

  1. Override the component
  2. Generate your own navigation partial

Override the component

The navigation is generated by a View Component called Uchi::Ui::Navigation. If you add a component with that name in your application (probably at app/components/uchi/ui/navigation.rb) you can customize how your main navigation menu is rendered:

module Uchi
  module Ui
    class Navigation < ViewComponent::Base
      def call
        "This is my navigation"
      end
    end
  end
end

See ViewComponent docs for more details.

Your own navigation partial

If you want even more control over the navigation menu, including being able to remove it entirely, you can add a partial in your application at app/views/uchi/navigation/_main.html.erb.

Creating your own navigation partial gives you full control over the navigation menu, including the nav element that wraps the navigation area, allowing you to remove the menu entirely by rendering an empty partial.

Routes

Uchi automatically adds routes for each repository and uses whichever repository is defined first as the root route (ie what you’ll get at /uchi).

How to change the root URL

If you want another repository to be displayed at the root URL (ie /uchi), you can add the relevant route to config/routes.rb:

# config/routes.rb
Rails.application.routes.draw do
  Uchi.routes.mount(self)
  namespace :uchi do
    root to: "projects#index"
  end
end