Skip to content

Commit

Permalink
feat: breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellberg committed Jul 16, 2024
1 parent 813c102 commit 5cdf127
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class DashboardController < ApplicationController
class DashboardController < KiqrController
def show
add_breadcrumb "Dashboard", dashboard_path
end
end
8 changes: 8 additions & 0 deletions app/controllers/kiqr/accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Kiqr
class AccountsController < KiqrController
before_action :ensure_team_and_setup_account, only: %i[edit update]
before_action :setup_breadcrumbs, only: %i[edit update]

def new
@account = Account.new
Expand All @@ -19,6 +20,7 @@ def create
end

def edit
add_breadcrumb "Team settings", edit_account_path(current_account)
end

def update
Expand Down Expand Up @@ -53,5 +55,11 @@ def form_method
@account.persisted? ? :patch : :post
end
helper_method :form_method

def setup_breadcrumbs
return unless current_account.present?

add_breadcrumb current_account.name, edit_account_path(current_account)
end
end
end
7 changes: 7 additions & 0 deletions app/controllers/kiqr_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
class KiqrController < ApplicationController
before_action :setup_dashboard_breadcrumb

private

# Add the dashboard breadcrumb
def setup_dashboard_breadcrumb
add_breadcrumb helpers.irelia_icon { "fa fa-home" }, dashboard_path
end

# Get the options for the locale form select field
def options_for_locale
I18n.available_locales.map do |locale|
Expand Down
4 changes: 2 additions & 2 deletions config/locales/kiqr/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ en:
title: "Create a new team account"
description: "Complete the form below to create a new team account"
edit:
title: "Profile settings"
description: "Edit your account profile."
title: "Team settings"
description: "Edit your team's profile."
select:
title: "Select account"
description: "Select a team account to manage."
Expand Down

0 comments on commit 5cdf127

Please sign in to comment.