Skip to content

Commit

Permalink
Add routes to toolbar tabs. (#56)
Browse files Browse the repository at this point in the history
* Add routes to toolbar links.

* Move toolbar to application level.

* Move toolbar to application level.

* Route to index pages.
  • Loading branch information
neb417 authored Nov 7, 2024
1 parent bcb75eb commit 8d9b281
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
5 changes: 0 additions & 5 deletions app/controllers/incomes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ class IncomesController < ApplicationController
# GET /incomes or /incomes.json
def index
@incomes = Income.all

respond_to do |format|
format.html { render :index }
format.json { render json: @incomes }
end
end

# GET /incomes/1 or /incomes/1.json
Expand Down
7 changes: 2 additions & 5 deletions app/views/components/_toolbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
<%= link_to "Federal Tax Brackets", federal_tax_brackets_path, data: { turbo_stream: true }, class: active_tab == :federal_tax_brackets ? "active-toolbar-tab" : "inactive-toolbar-tab" %>
</li>
<li class="mx-auto">
<a href="#" class="inline-block p-4 rounded-t-lg hover:text-gray-600 hover:bg-gray-50">State Income Tax</a>
<%= link_to "Incomes", incomes_path, data: { turbo: false }, class: active_tab == :incomes ? "active-toolbar-tab" : "inactive-toolbar-tab" %>
</li>
<li class="mx-auto">
<a href="#" class="inline-block p-4 rounded-t-lg hover:text-gray-600 hover:bg-gray-50">Incomes</a>
</li>
<li class="mx-auto">
<a href="#" class="inline-block p-4 rounded-t-lg hover:text-gray-600 hover:bg-gray-50">Fixed Expenses</a>
<%= link_to "Fixed Expenses", fixed_expenses_path, data: { turbo: false }, class: active_tab == :fixed_expenses ? "active-toolbar-tab" : "inactive-toolbar-tab" %>
</li>
</ul>
<% end %>
1 change: 0 additions & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<%= render partial: "components/toolbar", locals: { active_tab: :budget_calculator } %>
<%= render partial: "dashboard/index" %>
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<body class="bg-gray-200">
<main class="mx-auto px-9 flex flex-container">
<%= render partial: "components/toolbar", locals: { active_tab: :budget_calculator } %>
<%= yield %>
</main>
</body>
Expand Down

0 comments on commit 8d9b281

Please sign in to comment.