From bed484d75e78494b79611c6f4b1ec397d291784b Mon Sep 17 00:00:00 2001 From: Saphron <109723086+denerose@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:46:57 +1100 Subject: [PATCH] AO3-5865 Reorganise 'Edit multiple works' form (#4655) * AO3-5865 Reorganize edit multiple works form * AO3-5865 Update capitalization on related labels * ERBLint autocorrect to resolve style issues * Update relevant tests to match new case format * Correct additional linter errors * Convert related text lines to i18n * Fix unexpected (s) * Appease linter * Update app/views/works/_work_form_associations_language.html.erb Co-authored-by: Brian Austin <13002992+brianjaustin@users.noreply.github.com> * Fix work skin test to reflect updated capitalisation * Prefer single-quoted strings inside interpolations --------- Co-authored-by: Brian Austin <13002992+brianjaustin@users.noreply.github.com> --- .../collectibles/_collectible_form.html.erb | 2 +- app/views/pseuds/_byline.html.erb | 4 +- app/views/works/_standard_form.html.erb | 10 ++-- .../_work_form_associations_language.html.erb | 2 +- app/views/works/_work_form_pseuds.html.erb | 4 +- app/views/works/edit_multiple.html.erb | 58 ++++++++++--------- app/views/works/edit_tags.html.erb | 4 +- config/locales/views/en.yml | 13 ++++- features/works/work_edit.feature | 2 +- features/works/work_edit_multiple.feature | 10 ++-- 10 files changed, 61 insertions(+), 48 deletions(-) diff --git a/app/views/collectibles/_collectible_form.html.erb b/app/views/collectibles/_collectible_form.html.erb index 3a957e23f47..075850a08e6 100644 --- a/app/views/collectibles/_collectible_form.html.erb +++ b/app/views/collectibles/_collectible_form.html.erb @@ -11,7 +11,7 @@ <% end %> -
<%= form.label :collections_to_add, ts("Add To Collections") %> <%= link_to_help "add-collectible-to-collection" %>
+
<%= form.label :collections_to_add, ts("Add to collections") %> <%= link_to_help "add-collectible-to-collection" %>
<%= form.text_field :collections_to_add, autocomplete_options("open_collection_names") %>
diff --git a/app/views/pseuds/_byline.html.erb b/app/views/pseuds/_byline.html.erb index f47d5bf0cdb..896b99da453 100644 --- a/app/views/pseuds/_byline.html.erb +++ b/app/views/pseuds/_byline.html.erb @@ -69,11 +69,11 @@ <% end %>
- <%= label_tag "co-authors-options-show", ts("Add co-creators?") %> + <%= label_tag "co-authors-options-show", t("works.byline.show_co-creator_options") %>
<%= check_box_tag "co-authors-options-show", "1", object.creatorships.any?(&:ambiguous?), class: "toggle_formfield" %> -
"> +
"> <%= creator_form.text_field :byline, autocomplete_options("pseud", size: 50).merge(id: "pseud_byline") %> <% object.creatorships.each do |creatorship| %> <% next unless creatorship.ambiguous? %> diff --git a/app/views/works/_standard_form.html.erb b/app/views/works/_standard_form.html.erb index 2dbcdf2286c..f6d6f753ab9 100644 --- a/app/views/works/_standard_form.html.erb +++ b/app/views/works/_standard_form.html.erb @@ -6,8 +6,8 @@ <%= render "work_form_tags", include_blank: false %>
- <%= ts("Preface") %> -

<%= ts("Preface") %>

+ <%= t("works.preface.title") %> +

<%= ts("work.preface.title") %>

<%= f.label :title, ts("Work Title") + "*" %> @@ -43,8 +43,8 @@
- <%= ts("Associations") %> -

<%= ts("Associations") %>

+ <%= t("works.associations.title") %> +

<%= t("works.associations.title") %>

<% @assignments = get_open_assignments(current_user) %> <% if @assignments.any? || @work.challenge_assignments.any? %> @@ -243,7 +243,7 @@ <%= render "work_form_associations_language", f: f %>
- <%= f.label :work_skin_id, ts("Select Work Skin") %> + <%= f.label :work_skin_id, t("works.skin.select") %> <%= link_to_help "work-skins" %>
diff --git a/app/views/works/_work_form_associations_language.html.erb b/app/views/works/_work_form_associations_language.html.erb index 91597660e15..ae20bacf994 100644 --- a/app/views/works/_work_form_associations_language.html.erb +++ b/app/views/works/_work_form_associations_language.html.erb @@ -1,6 +1,6 @@ <% # expects local variable f %>
- <%= f.label :language_id, ts("Choose a language") + "*" %> + <%= f.label :language_id, "#{t('works.associations.language.choose')} *" %> <%= link_to_help "languages-help" %>
diff --git a/app/views/works/_work_form_pseuds.html.erb b/app/views/works/_work_form_pseuds.html.erb index c3b8e749f78..872ef30b83a 100644 --- a/app/views/works/_work_form_pseuds.html.erb +++ b/app/views/works/_work_form_pseuds.html.erb @@ -13,11 +13,11 @@ <% if has_cocreators %> <%= label_tag :remove_me, class: "action" do %> <%= check_box_tag :remove_me, "1", false %> - <%= ts("Remove Me As Co-Creator") %> + <%= ts("Remove me as co-creator") %> <% end %> <% end %>
<% end %> -
<%= form.label :pseuds_to_add, ts("Add Co-Creators") %>
+
<%= form.label :pseuds_to_add, t("works.byline.add_co-creators") %>
<%= form.text_field :pseuds_to_add, autocomplete_options("pseud", data: { autocomplete_min_chars: 0 }) %>
diff --git a/app/views/works/edit_multiple.html.erb b/app/views/works/edit_multiple.html.erb index 27cab8fba85..1dca1cd72dc 100644 --- a/app/views/works/edit_multiple.html.erb +++ b/app/views/works/edit_multiple.html.erb @@ -11,9 +11,9 @@ <%= ts("Your edits will be applied to") %> <%= ts("all") %> <%= ts("of the following works:") %>

-<%= render "works/work_abbreviated_list", :works => @works %> +<%= render "works/work_abbreviated_list", works: @works %> -<%= form_for :work, :url => update_multiple_user_works_path(@user), method: :patch, :html => { :class => "post" } do |form| %> +<%= form_for :work, url: update_multiple_user_works_path(@user), method: :patch, html: { class: "verbose post" } do |form| %>

<%= ts("* Required information") %> <% @works.each do |work| %> @@ -21,37 +21,42 @@ <% end %>

- <%= render 'work_form_tags', :include_blank => true %> - -
- <%= ts("Associations") %> -

<%= ts("Associations") %>

+ <%= render "work_form_tags", include_blank: true %> +
+ <%= t("works.preface.title") %> +

<%= t("works.preface.title") %>

- <%= render "works/work_form_pseuds", :form => form, :works => @works %> - <%= render "collectibles/collectible_form", :form => form, :collectibles => @works %> + <%= render "works/work_form_pseuds", form: form, works: @works %>
-
- <%= ts("Settings") %> -

<%= ts("Settings") %>

+
+ <%= t("works.associations.title") %> +

<%= t("works.associations.title") %>

-
<%= form.label :language_id, ts("Language") %> <%= link_to_help "languages-help" %>
+ <%= render "collectibles/collectible_form", form: form, collectibles: @works %> +
<%= form.label :language_id, t("works.associations.language.choose") %> <%= link_to_help "languages-help" %>
<%= form.select :language_id, language_options_for_select(sorted_languages, "id"), { include_blank: true } %>
-
<%= form.label :work_skin_id, ts("Select Work Skin") %> <%= link_to_help "work-skins" %>
+
<%= form.label :work_skin_id, t("works.skin.select") %> <%= link_to_help "work-skins" %>
<%= form.collection_select :work_skin_id, WorkSkin.approved_or_owned_by(current_user).order(:title), :id, :title, - {:include_blank => true} %> + { include_blank: true } %>
+
+
+ +
+ <%= t("works.permissions.privacy") %> +

<%= t("works.permissions.privacy") %>

+
<%= t("works.permissions.visibility.label") %> <%= link_to_help "registered-users" %>
- <%= - radio_button_list(form, :restricted, [ + <%= radio_button_list(form, :restricted, [ ["", t("works.permissions.visibility.keep_current")], ["1", t("works.permissions.visibility.multiple_works_restricted")], ["0", t("works.permissions.visibility.unrestricted")] @@ -63,8 +68,7 @@
<%= t("comments.commentable.permissions.moderated_commenting.label") %><%= link_to_help "comments-moderated" %>
- <%= - radio_button_list(form, :moderated_commenting_enabled, [ + <%= radio_button_list(form, :moderated_commenting_enabled, [ ["", t("comments.commentable.permissions.moderated_commenting.keep_current")], ["1", t("comments.commentable.permissions.moderated_commenting.enable")], ["0", t("comments.commentable.permissions.moderated_commenting.disable")] @@ -79,14 +83,12 @@
- <%= - radio_button_list(form, :comment_permissions, [ - ["", t("comments.commentable.permissions.options.keep_current")], - [:enable_all, t("comments.commentable.permissions.options.enable_all")], - [:disable_anon, t("comments.commentable.permissions.options.disable_anon")], - [:disable_all, t("comments.commentable.permissions.options.disable_all")] - ]) - %> + <%= radio_button_list(form, :comment_permissions, [ + ["", t("comments.commentable.permissions.options.keep_current")], + [:enable_all, t("comments.commentable.permissions.options.enable_all")], + [:disable_anon, t("comments.commentable.permissions.options.disable_anon")], + [:disable_all, t("comments.commentable.permissions.options.disable_all")] + ]) %>
@@ -97,7 +99,7 @@ (If you leave a field blank it will remain unchanged.)") %>

-

<%= submit_tag ts("Update All Works"), data: {confirm: ts("Are you sure? Remember this will replace all existing values!")} %>

+

<%= submit_tag ts("Update All Works"), data: { confirm: ts("Are you sure? Remember this will replace all existing values!") } %>

<% end %> diff --git a/app/views/works/edit_tags.html.erb b/app/views/works/edit_tags.html.erb index fccc5513420..264312eaeec 100644 --- a/app/views/works/edit_tags.html.erb +++ b/app/views/works/edit_tags.html.erb @@ -18,8 +18,8 @@ <% if logged_in_as_admin? %>
- <%= ts('Associations') %> -

<%= ts('Associations') %>

+ <%= t("works.associations.title") %> +

<%= t("works.associations.title") %>

<%= render 'work_form_associations_language', f: f %>
diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index 1024efb1b7a..3cc10683728 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -431,7 +431,7 @@ en: disable: Disable comment moderation enable: Enable comment moderation keep_current: Keep current comment moderation settings - label: Comment Moderation + label: Comment moderation options: disable_all: No one can comment disable_anon: Only registered users can comment @@ -901,6 +901,13 @@ en: continue: Yes, Continue preferences: Set your preferences now page_title: Adult Content Warning + associations: + language: + choose: Choose a language + title: Associations + byline: + add_co-creators: Add co-creators + show_co-creator_options: Add co-creators? meta: original_creators: one: 'Original Creator ID:' @@ -914,6 +921,8 @@ en: multiple_works_restricted: Only show to registered users restricted: Only show your work to registered users unrestricted: Show to all + preface: + title: Preface search_box: a11y_label: Work label: Work Search @@ -921,6 +930,8 @@ en: tooltip_label: 'tip:' show: unposted_deletion_notice_html: This work is a draft and has not been posted. The draft will be scheduled for deletion on %{deletion_date}. + skin: + select: Select work skin work_approved_children: inspired_by: restricted_html: "[Restricted Work] by %{creator_link} (Log in to access.)" diff --git a/features/works/work_edit.feature b/features/works/work_edit.feature index e0f52410d6e..1c419e9dd3a 100644 --- a/features/works/work_edit.feature +++ b/features/works/work_edit.feature @@ -175,7 +175,7 @@ Feature: Edit Works Then I should see "Lead Author's Work Skin" within "#work_work_skin_id" And I should see "Coauthor's Work Skin" within "#work_work_skin_id" And I should not see "Random User's Work Skin" within "#work_work_skin_id" - When I select "Coauthor's Work Skin" from "Select Work Skin" + When I select "Coauthor's Work Skin" from "Select work skin" And I press "Post" Then I should see "Work was successfully updated" diff --git a/features/works/work_edit_multiple.feature b/features/works/work_edit_multiple.feature index 6d62aa4e76a..7e66dd8ac3d 100644 --- a/features/works/work_edit_multiple.feature +++ b/features/works/work_edit_multiple.feature @@ -178,7 +178,7 @@ Feature: Edit Multiple Works And the user "coauthor" allows co-creators And I am logged in as "lead_author" And I edit the multiple works "First Shared" and "Second Shared" - When I fill in "Add Co-Creators" with "coauthor" + When I fill in "Add co-creators" with "coauthor" And I press "Update All Works" Then I should see "Your edits were put through" And 2 emails should be delivered to "coauthor" @@ -200,7 +200,7 @@ Feature: Edit Multiple Works And the user "coauthor" allows co-creators And I am logged in as "lead_author" And I edit multiple works coauthored as "lead_author" with "coauthor" - When I check "Remove Me As Co-Creator" + When I check "Remove me as co-creator" And I press "Update All Works" Then I should see "Your edits were put through" When I view the work "Shared Work 1" @@ -218,7 +218,7 @@ Feature: Edit Multiple Works And I select "Solo" for editing And I select "Shared" for editing And I press "Edit" - And I check "Remove Me As Co-Creator" + And I check "Remove me as co-creator" And I press "Update All Works" Then I should see "You cannot remove yourself as co-creator of the work Solo because you are the only listed creator." When I view the work "Solo" @@ -236,7 +236,7 @@ Feature: Edit Multiple Works And I edit multiple works coauthored as "lead_author" with "coauthor" Then I should see "Lead Author's Work Skin" within "#work_work_skin_id" And I should not see "Coauthor's Work Skin" within "#work_work_skin_id" - When I select "Lead Author's Work Skin" from "Select Work Skin" + When I select "Lead Author's Work Skin" from "Select work skin" And I press "Update All Works" Then I should see "Your edits were put through" @@ -244,7 +244,7 @@ Feature: Edit Multiple Works Given I am logged in as "author" And I create the collection "MyCollection" And I edit the multiple works "Glorious" and "Excellent" - When I fill in "Add To Collections" with "MyCollection" + When I fill in "Add to collections" with "MyCollection" And I press "Update All Works" Then I should see "Your edits were put through" When I view the work "Glorious"