diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 102a448..09705d1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,2 @@ class ApplicationController < ActionController::Base - include SetDashboardInstanceVariables end diff --git a/app/controllers/concerns/set_dashboard_instance_variables.rb b/app/controllers/concerns/set_dashboard_instance_variables.rb deleted file mode 100644 index 855860d..0000000 --- a/app/controllers/concerns/set_dashboard_instance_variables.rb +++ /dev/null @@ -1,12 +0,0 @@ -module SetDashboardInstanceVariables - extend ActiveSupport::Concern - - included do - # before_action :set_variables - end - - def set_variables - Rails.logger.debug "**** Dashboard Vars Being Set ****" - @totals = FixedExpense.total_costs - end -end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index dff97de..e4797b4 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,5 +1,4 @@ class DashboardController < ApplicationController - include SetDashboardInstanceVariables def index @incomes = Income.all @fixed_expenses = FixedExpense.get_ordered diff --git a/app/controllers/fixed_expenses_controller.rb b/app/controllers/fixed_expenses_controller.rb index 36d22df..df5ab48 100644 --- a/app/controllers/fixed_expenses_controller.rb +++ b/app/controllers/fixed_expenses_controller.rb @@ -57,7 +57,6 @@ def destroy @fixed_expenses = FixedExpense.get_ordered respond_to do |format| format.html { redirect_to fixed_expenses_path, notice: "Fixed expense was successfully destroyed." } - # format.turbo_stream { render turbo_stream: turbo_stream.remove(@fixed_expense) } format.turbo_stream end end diff --git a/app/javascript/controllers/fixed_expense_controller.js b/app/javascript/controllers/fixed_expense_controller.js index e35e972..a18a9f0 100644 --- a/app/javascript/controllers/fixed_expense_controller.js +++ b/app/javascript/controllers/fixed_expense_controller.js @@ -2,29 +2,5 @@ import { Controller } from "@hotwired/stimulus" // import { get } from "@rails/request.js" export default class extends Controller { - static targets = [ "fixedTotals" ] - updateTotals(event) { - const data = Object.fromEntries(new FormData(event.target).entries()) - console.log(data) - console.log(data["fixed_expense[amount]"]) - console.log(data["fixed_expense[frequency]"]) - console.log(this.fixedTotalsTarget) - let amount = data["fixed_expense[amount]"] - let frequency = data["fixed_expense[frequency]"] - // get(`/fixed_expenses/total_expenses?`) - } -} - - -// export default class extends Controller { -// static targets = ["monthlyPaymentDisplay"] -// -// homeDataUpdate(event){ -// let homeId = event.target.selectedOptions[0].value -// let target = this.monthlyPaymentDisplayTarget.id -// get(`/recurring_payments/monthly_payment?home=${homeId}&target=${target}`,{ -// responseKind: "turbo-stream" -// }) -// } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/spec/requests/fixed_expenses_spec.rb b/spec/requests/fixed_expenses_spec.rb index 4bf6298..60e1224 100644 --- a/spec/requests/fixed_expenses_spec.rb +++ b/spec/requests/fixed_expenses_spec.rb @@ -83,7 +83,7 @@ end end - describe "PATCH /index" do + describe "PATCH /update" do context "with valid parameters" do let(:new_attributes) { skip("Add a hash of attributes valid for your model") diff --git a/spec/routing/fixed_expenses_routing_spec.rb b/spec/routing/fixed_expenses_routing_spec.rb index 991d33a..83c5a26 100644 --- a/spec/routing/fixed_expenses_routing_spec.rb +++ b/spec/routing/fixed_expenses_routing_spec.rb @@ -22,11 +22,11 @@ expect(post: "/fixed_expenses").to route_to("fixed_expenses#create") end - it "routes to #index via PUT" do + it "routes to #update via PUT" do expect(put: "/fixed_expenses/1").to route_to("fixed_expenses#update", id: "1") end - it "routes to #index via PATCH" do + it "routes to #update via PATCH" do expect(patch: "/fixed_expenses/1").to route_to("fixed_expenses#update", id: "1") end diff --git a/spec/routing/incomes_routing_spec.rb b/spec/routing/incomes_routing_spec.rb index 870f01b..d03193f 100644 --- a/spec/routing/incomes_routing_spec.rb +++ b/spec/routing/incomes_routing_spec.rb @@ -22,11 +22,11 @@ expect(post: "/incomes").to route_to("incomes#create") end - it "routes to #index via PUT" do + it "routes to #update via PUT" do expect(put: "/incomes/1").to route_to("incomes#update", id: "1") end - it "routes to #index via PATCH" do + it "routes to #update via PATCH" do expect(patch: "/incomes/1").to route_to("incomes#update", id: "1") end