You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
would it make sense adding this view helper to this gem?
in hitobito we do have now a view helper for explicit render of a core partial:
core/app/helpers/wagon_helper.rb
# frozen_string_literal: true# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of# hitobito and licensed under the Affero General Public License version 3# or later. See the COPYING file at the top-level directory or at# https://github.com/hitobito/hitobito.moduleWagonHelperdefrender_core_partial(partial_name,locals={})core_view_path=Rails.root.join("app","views")with_view_path(core_view_path)dorender(partial_name,locals)endendprivatedefwith_view_path(path)original_view_paths=view_paths.dupview_paths=ActionView::PathSet.new([path])lookup_context.instance_variable_set(:@view_paths,view_paths)beginyieldensurelookup_context.instance_variable_set(:@view_paths,original_view_paths)endendend
use case
let's say you want to customize a certain partial in a wagon, but then inside this partial want to fallback to the core's definition.
👍 I like the idea. The term core is not established in wagons, I suggest to name the method render_app_partial. If absolute paths could be used with render, I would prefer them instead of messing with instance variables of the lookup context.
would it make sense adding this view helper to this gem?
in hitobito we do have now a view helper for explicit render of a core partial:
core/app/helpers/wagon_helper.rb
use case
let's say you want to customize a certain partial in a wagon, but then inside this partial want to fallback to the core's definition.
$wagon/app/views/roles/_fields.html.haml
The text was updated successfully, but these errors were encountered: