app/views/thredded/preferences/_form.html.erb
<%# @type preferences [Thredded::UserPreferencesForm] %>
<%= form_for(preferences, method: :patch, url: preferences.update_path, html: {
class: 'thredded--form thredded--notification-preferences-form',
'data-thredded-user-preferences-form' => true
}) do |f| %>
<div class="card-panel">
<ul class="thredded--form-list thredded--user-preferences-global">
<li class="thredded--user-preferences--auto-follow-topics">
<%= f.label :auto_follow_topics do %>
<%= f.check_box :auto_follow_topics,
'data-thredded-update-checkbox-on-change' =>
'user_preferences_form[messageboard_auto_follow_topics]' %>
<%= t 'thredded.preferences.form.auto_follow_topics.label' %>
<p class="thredded--form-list--hint">
<%= t 'thredded.preferences.form.auto_follow_topics.hint' %>
</p>
<% end %>
</li>
<li class="thredded--user-preferences--follow-topics-on-mention">
<%= f.label :follow_topics_on_mention do %>
<%= f.check_box :follow_topics_on_mention, 'data-thredded-bound-messageboard-pref' => 'user_preferences_form[messageboard_follow_topics_on_mention]' %>
<%= t 'thredded.preferences.form.follow_topics_on_mention.label' %>
<p class="thredded--form-list--hint">
<%= t 'thredded.preferences.form.follow_topics_on_mention.hint' %>
</p>
<% end %>
</li>
<% if Thredded.notifiers.present? %>
<li class="thredded--user-preferences--notifications-for-followed-topics">
<label><%= t 'thredded.preferences.form.notifications_for_followed_topics.label' %></label>
<%= f.fields_for :notifications_for_followed_topics, preferences.notifications_for_followed_topics do |fn| %>
<%= fn.label :enabled do %>
<%= fn.hidden_field :notifier_key %>
<%= fn.check_box :enabled,
'data-thredded-bound-messageboard-pref' =>
"user_preferences_form[messageboard_notifications_for_followed_topics_attributes][#{fn.index}][enabled]" %>
<%= fn.object.notifier_human_name %>
<%- end %>
<%- end %>
</li>
<li class="thredded--user-preferences--notifications-for-private-topics">
<label><%= t 'thredded.preferences.form.notifications_for_private_topics.label' %></label>
<%= f.fields_for :notifications_for_private_topics, preferences.notifications_for_private_topics do |fn| %>
<%= fn.label :enabled do %>
<%= fn.hidden_field :notifier_key %>
<%= fn.check_box :enabled %>
<%= fn.object.notifier_human_name %>
<% end %>
<% end %>
</li>
<% end %>
</ul>
</div>
<% if preferences.messageboard %>
<h2 class="thredded--preferences--title">
<%= t 'thredded.preferences.messageboard_preferences_title_html', messageboard: messageboard.name %>
</h2>
<div class="card-panel">
<ul class="thredded--form-list thredded--user-preferences-messageboard" data-thredded-user-preferences-form-messageboard-fields>
<li class="thredded--user-preferences--auto-follow-topics">
<%= f.label :messageboard_auto_follow_topics do %>
<%= f.check_box :messageboard_auto_follow_topics %>
<%= t 'thredded.preferences.form.messageboard_auto_follow_topics.label' %>
<p class="thredded--form-list--hint">
<%= t 'thredded.preferences.form.messageboard_auto_follow_topics.hint' %>
</p>
<% end %>
</li>
<li class="thredded--user-preferences--follow-topics-on-mention">
<%= f.label :messageboard_follow_topics_on_mention do %>
<%= f.check_box :messageboard_follow_topics_on_mention %>
<%= t 'thredded.preferences.form.messageboard_follow_topics_on_mention.label' %>
<p class="thredded--form-list--hint">
<%= t 'thredded.preferences.form.messageboard_follow_topics_on_mention.hint' %>
</p>
<% end %>
</li>
<% if Thredded.notifiers.present? %>
<li class="thredded--user-preferences--notifications-for-followed-topics">
<label><%= t 'thredded.preferences.form.messageboard_notifications_for_followed_topics.label' %></label>
<%= f.fields_for :messageboard_notifications_for_followed_topics,
preferences.messageboard_notifications_for_followed_topics do |fn| %>
<%= fn.label :enabled do %>
<%= fn.hidden_field :notifier_key %>
<%= fn.hidden_field :messageboard_id %>
<%= fn.check_box :enabled %>
<%= fn.object.notifier_human_name %>
<% end %>
<%- end %>
</li>
<% end %>
</ul>
</div>
<% end %>
<button type="submit" class="thredded--form--submit"
data-disable-with="<%= t 'thredded.preferences.form.update_btn_submitting' %>">
<%= t 'thredded.preferences.form.submit_btn' %>
</button>
<% end %>