Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

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 22bbe34f09..70c04e673d 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 136040ae88..14e7e9ff48 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 ac60583a01..4fbf42688e 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 568f440f07..a02e1c9179 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 b8d5a83647..2a3427fba8 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 dfbe63e441..219a6973ce 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 96ff4c47ff..57f8ee5ff4 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 17ff8fae20..e5b19ff3b8 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 17c1343f24..055f3da8d2 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 92904be5c7..30f07532d5 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 f908b939da..e0fcac5ee7 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 19183c5711..a5b14f7c03 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 9a3ccebfb9..64b4a6e79f 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 482ed9dbb2..55bb810042 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