Pass action_view to rails cell to correct helpers

pull/6701/head
Oliver Günther 6 years ago
parent 03448e758e
commit 95d2cb54aa
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 7
      app/cells/rails_cell.rb
  2. 9
      app/helpers/cells_helper.rb
  3. 2
      app/views/settings/_authentication.html.erb
  4. 4
      app/views/settings/_notifications.html.erb
  5. 2
      app/views/settings/_users.html.erb

@ -5,6 +5,9 @@ class RailsCell < Cell::ViewModel
include ActionView::Helpers::TranslationHelper
include SecureHeaders::ViewHelpers
# Delegate to action_view
delegates :action_view, :content_for
self.view_paths = ['app/cells/views']
# We don't include ActionView::Helpers wholesale because
@ -46,6 +49,10 @@ class RailsCell < Cell::ViewModel
context[:controller]
end
def action_view
context[:action_view]
end
def protect_against_forgery?
controller.send(:protect_against_forgery?)
end

@ -11,4 +11,13 @@ module CellsHelper
render render_options.merge(text: rendered)
end
def rails_cell(name, model, **args)
args[:context] = {
controller: try(:controller),
action_view: self
}
cell name, model, args
end
end

@ -52,7 +52,7 @@ See docs/COPYRIGHT.rdoc for more details.
<fieldset class="form--fieldset">
<fieldset id="registration_footer" class="form--fieldset">
<legend class="form--fieldset-legend"><%= I18n.t(:setting_registration_footer) %></legend>
<%= cell Settings::TextSettingCell, I18n.locale, name: "registration_footer" %>
<%= rails_cell Settings::TextSettingCell, I18n.locale, name: "registration_footer" %>
</fieldset>
</fieldset>
<% end %>

@ -46,8 +46,8 @@ See docs/COPYRIGHT.rdoc for more details.
<div class="form--field"><%= check_all_links('notified_events') %></div>
</fieldset>
<fieldset id="emails_decorators" class="form--fieldset"><legend class="form--fieldset-legend"><%= t(:setting_emails_header) %> & <%= t(:setting_emails_footer) %></legend>
<%= cell Settings::TextSettingCell, I18n.locale, name: "emails_header" %>
<%= cell Settings::TextSettingCell, I18n.locale, name: "emails_footer" %>
<%= rails_cell Settings::TextSettingCell, I18n.locale, name: "emails_header" %>
<%= rails_cell Settings::TextSettingCell, I18n.locale, name: "emails_footer" %>
</fieldset>
<%= content_tag :fieldset, id: "mail_configuration", class: "form--fieldset" do %>
<legend class="form--fieldset-legend"><%=t(:text_setup_mail_configuration)%></legend>

@ -68,7 +68,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= setting_check_box :consent_required %>
</div>
<%= cell Settings::TextSettingCell, I18n.locale, name: "consent_info" %>
<%= rails_cell Settings::TextSettingCell, I18n.locale, name: "consent_info" %>
<div class="form--field">
<%= setting_block("consent_time") do %>

Loading…
Cancel
Save