Although most Consul Democracy installations will only have a few available languages using `config.i18n.available_locales`, there's a chance some installation will keep every language as available and will enable the desired ones using the admin interface. In these cases, enabling (or disabling) every language would be tedious, particularly when casually experimenting in a staging environment or while using the official Consul Democracy demo. So we're adding buttons to simplify the process. Since some installations might have only a couple of available languages, and in this case these buttons would be pretty much useless, we're only showing them when there are many languages available.
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
<%= form_for locales_settings, url: admin_locales_path, html: { class: "locales-form" } do |f| %>
|
|
<% if many_available_locales? %>
|
|
<%= f.select :default, locales_options, hint: sanitize(t("admin.locales.default_help_text")) %>
|
|
<% else %>
|
|
<fieldset>
|
|
<legend><%= attribute_name(:default) %></legend>
|
|
<p class="help-text"><%= sanitize(t("admin.locales.default_help_text")) %></p>
|
|
|
|
<div class="collection-radio-buttons">
|
|
<%= f.collection_radio_buttons(
|
|
:default,
|
|
available_locales,
|
|
:to_sym,
|
|
->(locale) { name_for_locale(locale) }
|
|
) do |b| %>
|
|
<%= b.label { b.radio_button + b.text } %>
|
|
<% end %>
|
|
</div>
|
|
</fieldset>
|
|
<% end %>
|
|
|
|
<fieldset>
|
|
<legend><%= attribute_name(:enabled) %></legend>
|
|
<p class="help-text"><%= t("admin.locales.enabled_help_text") %></p>
|
|
|
|
<% if many_available_locales? %>
|
|
<%= render Shared::CheckAllNoneComponent.new %>
|
|
<% end %>
|
|
|
|
<div class="collection-check-boxes">
|
|
<%= f.collection_check_boxes(
|
|
:enabled,
|
|
available_locales,
|
|
:to_sym,
|
|
->(locale) { name_for_locale(locale) }
|
|
) do |b| %>
|
|
<%= b.label { b.check_box + b.text } %>
|
|
<% end %>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<%= submit_tag %>
|
|
<% end %>
|