Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Fix: Omit layout for turbo frames with custom sidebar layout (#1024)

pranavbabu7ba9830db595
diff --git a/app/controllers/account/entries_controller.rb b/app/controllers/account/entries_controller.rb
index 22bbe34f..70c04e67 100644
--- a/app/controllers/account/entries_controller.rb
+++ b/app/controllers/account/entries_controller.rb
@@ -1,5 +1,5 @@
class Account::EntriesController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_account
before_action :set_entry, only: %i[ edit update show destroy ]
diff --git a/app/controllers/account/holdings_controller.rb b/app/controllers/account/holdings_controller.rb
index 136040ae..14e7e9ff 100644
--- a/app/controllers/account/holdings_controller.rb
+++ b/app/controllers/account/holdings_controller.rb
@@ -1,5 +1,5 @@
class Account::HoldingsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_account
before_action :set_holding, only: :show
diff --git a/app/controllers/account/transfers_controller.rb b/app/controllers/account/transfers_controller.rb
index ac60583a..4fbf4268 100644
--- a/app/controllers/account/transfers_controller.rb
+++ b/app/controllers/account/transfers_controller.rb
@@ -1,5 +1,5 @@
class Account::TransfersController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_transfer, only: :destroy
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 568f440f..a02e1c91 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -1,5 +1,5 @@
class AccountsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
include Filterable
before_action :set_account, only: %i[ edit show destroy sync update ]
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b8d5a836..2a3427fb 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -4,4 +4,12 @@ class ApplicationController < ActionController::Base
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
allow_browser versions: :modern
+
+ private
+
+ def with_sidebar
+ return "turbo_rails/frame" if turbo_frame_request?
+
+ "with_sidebar"
+ end
end
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index dfbe63e4..219a6973 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -1,5 +1,5 @@
class CategoriesController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_category, only: %i[ edit update ]
before_action :set_transaction, only: :create
diff --git a/app/controllers/category/deletions_controller.rb b/app/controllers/category/deletions_controller.rb
index 96ff4c47..57f8ee5f 100644
--- a/app/controllers/category/deletions_controller.rb
+++ b/app/controllers/category/deletions_controller.rb
@@ -1,5 +1,5 @@
class Category::DeletionsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_category
before_action :set_replacement_category, only: :create
diff --git a/app/controllers/help/articles_controller.rb b/app/controllers/help/articles_controller.rb
index 17ff8fae..e5b19ff3 100644
--- a/app/controllers/help/articles_controller.rb
+++ b/app/controllers/help/articles_controller.rb
@@ -1,5 +1,5 @@
class Help::ArticlesController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
def show
@article = Help::Article.find(params[:id])
diff --git a/app/controllers/merchants_controller.rb b/app/controllers/merchants_controller.rb
index 17c1343f..055f3da8 100644
--- a/app/controllers/merchants_controller.rb
+++ b/app/controllers/merchants_controller.rb
@@ -1,5 +1,5 @@
class MerchantsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_merchant, only: %i[ edit update destroy ]
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 92904be5..30f07532 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -1,5 +1,5 @@
class PagesController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
include Filterable
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index f908b939..e0fcac5e 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -1,3 +1,3 @@
class SettingsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
end
diff --git a/app/controllers/tag/deletions_controller.rb b/app/controllers/tag/deletions_controller.rb
index 19183c57..a5b14f7c 100644
--- a/app/controllers/tag/deletions_controller.rb
+++ b/app/controllers/tag/deletions_controller.rb
@@ -1,5 +1,5 @@
class Tag::DeletionsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_tag
before_action :set_replacement_tag, only: :create
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 9a3ccebf..64b4a6e7 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -1,5 +1,5 @@
class TagsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
before_action :set_tag, only: %i[ edit update ]
diff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rb
index 482ed9db..55bb8100 100644
--- a/app/controllers/transactions_controller.rb
+++ b/app/controllers/transactions_controller.rb
@@ -1,5 +1,5 @@
class TransactionsController < ApplicationController
- layout "with_sidebar"
+ layout :with_sidebar
def index
@q = search_params