diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index c257498..e20f591 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -123,6 +123,6 @@ def ensure_group_manager end def group_params - params.require(:group).permit(:name, :description, :privacy, :focus, :reading_list) + params.require(:group).permit(:name, :description, :privacy, :plan, :focus, :reading_list) end end diff --git a/app/models/group.rb b/app/models/group.rb index f4e12c6..add064a 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -91,6 +91,21 @@ def starting_location { translation: "kjv", book: first_red.book.downcase, chapter: first_red.number } end + # What the study reads, as the one choice the form offers: "bible", + # "red" (Highlighted in Red, chapter by chapter), or a reading list. + def plan + reading_list.presence || focus + end + + def plan=(value) + if FOCUSES.key?(value.to_s.to_sym) + self.focus = value + self.reading_list = nil + else + self.reading_list = value + end + end + # The passages on the study's list, in the order the list presents # them. Empty for a study with no list. def passages diff --git a/app/views/groups/_form.html.erb b/app/views/groups/_form.html.erb index 1ec6884..4d96325 100644 --- a/app/views/groups/_form.html.erb +++ b/app/views/groups/_form.html.erb @@ -37,28 +37,21 @@ <% end %> -
- <%= t("groups.focus.label") %> - <% Group::FOCUSES.each_key do |key| %> - - <% end %> -

<%= t("groups.focus.hint") %>

-
- + <%# One choice for what the study reads: the whole Bible, Highlighted + in Red chapter by chapter, or one of the lists or themes read a + passage at a time. %>
- <%= f.label :reading_list, t("groups.reading_list.label"), class: label_classes %> - <%= f.select :reading_list, + <%= f.label :plan, t("groups.focus.label"), class: label_classes %> + <%= f.select :plan, + options_for_select([ [ t("groups.plan.bible"), "bible" ], [ t("groups.plan.red"), "red" ] ], group.plan) + grouped_options_for_select( { t("groups.reading_list.lists_group") => Bible::Passages::COLLECTIONS.keys.map { |list| [ t("red.#{list}.title"), list ] }, t("groups.reading_list.themes_group") => Bible::Themes.all.map { |theme| [ theme.name, "#{Group::THEME_PREFIX}#{theme.slug}" ] } }, - group.reading_list + group.plan ), - { include_blank: t("groups.reading_list.none") }, + {}, class: "#{input_classes} [&_option]:bg-surface-50 [&_option]:text-surface-900" %> -

<%= t("groups.reading_list.hint") %>

+

<%= t("groups.plan.hint") %>

diff --git a/app/views/groups/bible/show.html.erb b/app/views/groups/bible/show.html.erb index 8d0e92a..86be44a 100644 --- a/app/views/groups/bible/show.html.erb +++ b/app/views/groups/bible/show.html.erb @@ -22,9 +22,13 @@
-

- <%= @translation.name %> -

+ <%# On a passage page the translation is named beside the + reference, under the title. %> + <% unless @passage %> +

+ <%= @translation.name %> +

+ <% end %> <% if @passage %> <% if @appearances.size > 1 %>