From b0cbb37d4f16b98480628605d92fbcf022eb303e Mon Sep 17 00:00:00 2001 From: Benjamin FAURE Date: Tue, 18 Jul 2023 14:45:41 +0200 Subject: [PATCH] Updated fontawesome to V6 --- CHANGELOG.md | 4 + .../stylesheets/blocks/_font_awesomes.scss | 4 +- app/helpers/notifications_helper.rb | 6 +- app/helpers/template_helper.rb | 2 +- app/javascript/src/answers/rdaMetadata.js | 10 +- app/javascript/src/orgAdmin/phases/show.js | 2 +- app/javascript/src/plans/index.js | 29 ++++ .../src/utils/notificationHelper.js | 4 +- .../_external_identifier.html.erb | 2 +- app/views/devise/registrations/new.html.erb | 134 +++++++++--------- app/views/layouts/_notifications.html.erb | 2 +- app/views/layouts/_signin_signout.html.erb | 6 +- app/views/layouts/application.html.erb | 2 +- app/views/org_admin/phases/container.html.erb | 2 +- .../org_admin/sections/_section.html.erb | 4 +- app/views/orgs/_profile_form.html.erb | 4 +- app/views/shared/_links.html.erb | 4 +- app/views/shared/_popover.html.erb | 2 +- app/views/shared/_search.html.erb | 2 +- .../super_admin/users/_confirm_merge.html.erb | 2 +- app/views/super_admin/users/edit.html.erb | 2 +- package.json | 2 +- spec/support/helpers/links_helper.rb | 2 +- yarn.lock | 8 +- 24 files changed, 137 insertions(+), 104 deletions(-) create mode 100644 app/javascript/src/plans/index.js diff --git a/CHANGELOG.md b/CHANGELOG.md index b28bcbab00..b4d7f6f9c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v4.2.0 + +- Updated fontawesome to V6 + ## v4.1.0 **Note this upgrade is a migration from Ruby v2.7.6 to v3.0.5.** Note that this could have an impact on any customizations you may have made to your fork of this project. Please see https://www.fastruby.io/blog/ruby/upgrades/upgrade-ruby-from-2.7-to-3.0.html for further information on what to check. In particular, please note the changes to the way [Ruby 3 handles keyword arguments](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/) diff --git a/app/assets/stylesheets/blocks/_font_awesomes.scss b/app/assets/stylesheets/blocks/_font_awesomes.scss index 80cd437774..ddfc9d197d 100644 --- a/app/assets/stylesheets/blocks/_font_awesomes.scss +++ b/app/assets/stylesheets/blocks/_font_awesomes.scss @@ -15,12 +15,12 @@ } /* change color of search icon */ -.fa-search { +.fa-magnifying-glass { color: $color-primary-text; } /* adjust the position of the 'remove - X' button for links */ -.link .fa-times-circle { +.link .fa-circle-xmark { margin-top: $grid-gutter-width; } diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index feebd82668..98a51f3781 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -8,11 +8,11 @@ module NotificationsHelper def fa_classes(notification) case notification.level when 'warning' - 'fa-exclamation-circle' + 'fa-circle-exclamation' when 'danger' - 'fa-times-circle' + 'fa-circle-xmark' else - 'fa-info-circle' + 'fa-circle-info' end end end diff --git a/app/helpers/template_helper.rb b/app/helpers/template_helper.rb index 807e6c4559..7e0cdc7917 100644 --- a/app/helpers/template_helper.rb +++ b/app/helpers/template_helper.rb @@ -48,7 +48,7 @@ def direct_link(template, hidden = false, text = nil, id = nil) link_to(plans_url(plan: params), method: :post, title: _('Create plan'), class: cls, id: id, style: style) do if text.nil? - ''.html_safe + ''.html_safe else text.html_safe end diff --git a/app/javascript/src/answers/rdaMetadata.js b/app/javascript/src/answers/rdaMetadata.js index f0c8746813..0cb96bc10c 100644 --- a/app/javascript/src/answers/rdaMetadata.js +++ b/app/javascript/src/answers/rdaMetadata.js @@ -129,9 +129,9 @@ $(() => { Object.keys(standardsArray).forEach((key) => { // add the standard to list if (key === standardsArray[key]) { - selectedStandards.append(`
  • ${key}${key}${descriptions[key].title}
  • `); + selectedStandards.append(`
  • ${descriptions[key].title}
  • `); } }); }); @@ -240,7 +240,7 @@ $(() => { standard = standardId; } }); - selectedStandards.append(`
  • ${descriptions[standard].title}
  • `); + selectedStandards.append(`
  • ${descriptions[standard].title}
  • `); const formStandards = group.next('form').find('#standards'); // get the data for selected standards from the data attribute 'standard' // of the hidden field #standards within the answer form @@ -271,7 +271,7 @@ $(() => { // the identifier for the standard which was selected const standard = target.data('standard'); // append the standard to the displayed list of selected standards - selectedStandards.append(`
  • ${descriptions[standard].title}
  • `); + selectedStandards.append(`
  • ${descriptions[standard].title}
  • `); const formStandards = group.next('form').find('#standards'); // get the data for selected standards from the data attribute 'standard' // of the hidden field #standards within the answer form @@ -327,7 +327,7 @@ $(() => { const group = target.closest('.rda_metadata'); const selectedStandards = group.find('.selected_standards .list'); const standardName = group.find('.custom-standard-name').val(); - selectedStandards.append(`
  • ${standardName}
  • `); + selectedStandards.append(`
  • ${standardName}
  • `); const formStandards = group.next('form').find('#standards'); // get the data for selected standards from the data attribute 'standard' // of the hidden field #standards within the answer form diff --git a/app/javascript/src/orgAdmin/phases/show.js b/app/javascript/src/orgAdmin/phases/show.js index 57af3b2634..f7f7f96095 100644 --- a/app/javascript/src/orgAdmin/phases/show.js +++ b/app/javascript/src/orgAdmin/phases/show.js @@ -29,7 +29,7 @@ $(() => { // Initialize the draggable-sections element as a jQuery sortable. // Read the docs here for more info: http://api.jqueryui.com/sortable/ $('.draggable-sections').sortable({ - handle: 'i.fa-arrows-alt', + handle: 'i.fa-up-down-left-right', axis: 'y', cursor: 'move', // Remove the placeholder object from the DOM once the item has been placed diff --git a/app/javascript/src/plans/index.js b/app/javascript/src/plans/index.js new file mode 100644 index 0000000000..81a696393a --- /dev/null +++ b/app/javascript/src/plans/index.js @@ -0,0 +1,29 @@ +import * as notifier from '../utils/notificationHelper'; +import getConstant from '../utils/constants'; +import { paginableSelector } from '../utils/paginable'; + +$(() => { + $(paginableSelector).on('ajax:success', 'input.set_test_plan', (e) => { + const checkbox = $(e.target); + const data = e.detail[0]; + if (data.code === 1 && data.msg && data.msg !== '') { + notifier.renderNotice(data.msg); + } else { + notifier.renderAlert(data.msg); + } + + if (checkbox.is(':checked')) { + checkbox.parent().siblings('.plan-visibility').html(getConstant('PLAN_VISIBILITY_WHEN_TEST')) + .attr('title', ''); + } else { + checkbox.parent().siblings('.plan-visibility').html(getConstant('PLAN_VISIBILITY_WHEN_NOT_TEST')) + .attr('title', getConstant('PLAN_VISIBILITY_WHEN_NOT_TEST_TOOLTIP')); + } + }); + $(paginableSelector).on('ajax:error', 'input.set_test_plan', (e) => { + const xhr = e.detail(2); + notifier.renderAlert(xhr.responseText); + }); + + $('#create-modal').modal('show'); +}); diff --git a/app/javascript/src/utils/notificationHelper.js b/app/javascript/src/utils/notificationHelper.js index 7e1647ac8e..cba147a8c9 100644 --- a/app/javascript/src/utils/notificationHelper.js +++ b/app/javascript/src/utils/notificationHelper.js @@ -40,7 +40,7 @@ function renderMessage(options = {}) { export function renderNotice(msg, options = {}) { renderMessage({ message: msg, - icon: 'check-circle', + icon: 'circle-check', className: 'alert-info', floating: options.floating === true, autoDismiss: options.autoDismiss === true, @@ -50,7 +50,7 @@ export function renderNotice(msg, options = {}) { export function renderAlert(msg, options = {}) { renderMessage({ message: msg, - icon: 'times-circle', + icon: 'circle-xmark', className: 'alert-warning', floating: options.floating === true, autoDismiss: options.autoDismiss === true, diff --git a/app/views/devise/registrations/_external_identifier.html.erb b/app/views/devise/registrations/_external_identifier.html.erb index 884dba3d91..a4fe597bc8 100644 --- a/app/views/devise/registrations/_external_identifier.html.erb +++ b/app/views/devise/registrations/_external_identifier.html.erb @@ -81,7 +81,7 @@ <% unlinktext = _("Unlink your account from #{scheme.description}. You can link again at any time.") %> <% unlinkconf = _("Are you sure you want to unlink #{scheme.description} ID?") %> <% end %> - <%= link_to ''.html_safe, + <%= link_to ''.html_safe, destroy_user_identifier_path(id), method: :delete, title: unlinktext, diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 15ca73dbff..242ede806c 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,67 +1,67 @@ -
    -
    -

    <%= _('Sign in or Create account') %>

    -
    -
    - -
    -
    - <% unless session["devise.shibboleth_data"].nil? %> - <% cookies[:show_shib_link] = { value: 'show_shib_link', - expires: 3.hours.from_now } %> - -
    -

    - <%= _("Do you have a %{application_name} account?") % { - application_name: ApplicationService.application_name} %> -

    -

    - -

    -

    - <%= _("Sign in") %> -

    -

    - <%= _("This will link your existing account to your credentials.") %> -

    -

    <%= render partial: 'shared/sign_in_form' %>

    -
    - -
    - -

    - <%= _("No %{application_name} account?") % { - application_name: ApplicationService.application_name} %> -

    - -

    - -

    - -

    - <%= _("Create account") %> -

    -

    - <%= _("This will create an account and link it to your credentials.") %> -

    -
    -

    - <%= render partial: 'shared/create_account_form', locals: {orgs: @all_orgs, org_partial: @org_partial} %> -
    -

    -
    -
    - <% else %> -
    -

    - <%= _("Create account") %>   - -

    -
    - <%= render partial: 'shared/create_account_form', locals: {orgs: @all_orgs, org_partial: @org_partial} %> -
    -
    - <% end %> -
    -
    +
    +
    +

    <%= _('Sign in or Create account') %>

    +
    +
    + +
    +
    + <% unless session["devise.shibboleth_data"].nil? %> + <% cookies[:show_shib_link] = { value: 'show_shib_link', + expires: 3.hours.from_now } %> + +
    +

    + <%= _("Do you have a %{application_name} account?") % { + application_name: ApplicationService.application_name} %> +

    +

    + +

    +

    + <%= _("Sign in") %> +

    +

    + <%= _("This will link your existing account to your credentials.") %> +

    +

    <%= render partial: 'shared/sign_in_form' %>

    +
    + +
    + +

    + <%= _("No %{application_name} account?") % { + application_name: ApplicationService.application_name} %> +

    + +

    + +

    + +

    + <%= _("Create account") %> +

    +

    + <%= _("This will create an account and link it to your credentials.") %> +

    +
    +

    + <%= render partial: 'shared/create_account_form', locals: {orgs: @all_orgs, org_partial: @org_partial} %> +
    +

    +
    +
    + <% else %> +
    +

    + <%= _("Create account") %>   + +

    +
    + <%= render partial: 'shared/create_account_form', locals: {orgs: @all_orgs, org_partial: @org_partial} %> +
    +
    + <% end %> +
    +
    diff --git a/app/views/layouts/_notifications.html.erb b/app/views/layouts/_notifications.html.erb index 6ed6029f1c..dce4530756 100644 --- a/app/views/layouts/_notifications.html.erb +++ b/app/views/layouts/_notifications.html.erb @@ -6,7 +6,7 @@ <%= sanitize a.body %> <% if a.dismissable? %> <% end %> diff --git a/app/views/layouts/_signin_signout.html.erb b/app/views/layouts/_signin_signout.html.erb index f43d77b87e..56ad183de7 100644 --- a/app/views/layouts/_signin_signout.html.erb +++ b/app/views/layouts/_signin_signout.html.erb @@ -26,10 +26,10 @@ @@ -37,7 +37,7 @@ <% if !active_page?(root_path, true) %>
  • - + <%= _('Sign in') %>
  • diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8b35e5eec6..70cbe4d312 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -88,7 +88,7 @@ class="notification-area alert <%= has_alert ? 'alert-warning ' : 'alert-info ' %> <%= (has_alert or has_notice) ? 'show' : 'hide' %>" role="<%= (has_notice ? 'status' : (has_alert ? 'alert' : '')) %>"> - + <%= has_alert ? _('Error:') : _('Notice:') %> <%= sanitize (has_alert ? alert : notice) %> <%= yield :errors %> diff --git a/app/views/org_admin/phases/container.html.erb b/app/views/org_admin/phases/container.html.erb index a7adaa7c0b..00533e9630 100644 --- a/app/views/org_admin/phases/container.html.erb +++ b/app/views/org_admin/phases/container.html.erb @@ -58,7 +58,7 @@
    <% if template.latest? && (modifiable || template.customization_of.present?) %> - + <%= _("Drag arrows to rearrange sections.") %> <% unless phase.sections.all?(&:modifiable?) %> <%= _("You may place them before or after the main template sections.") %> diff --git a/app/views/org_admin/sections/_section.html.erb b/app/views/org_admin/sections/_section.html.erb index cb56aa07b2..65d4456661 100644 --- a/app/views/org_admin/sections/_section.html.erb +++ b/app/views/org_admin/sections/_section.html.erb @@ -19,7 +19,7 @@ <% plussign = "fa-minus" if current_section.present? && section.id == current_section.id %> <% if local_assigns[:draggable] %> - <% end %> @@ -46,4 +46,4 @@ <% end %>
    - \ No newline at end of file + diff --git a/app/views/orgs/_profile_form.html.erb b/app/views/orgs/_profile_form.html.erb index d42a5bdf2c..06673fecd6 100644 --- a/app/views/orgs/_profile_form.html.erb +++ b/app/views/orgs/_profile_form.html.erb @@ -142,7 +142,7 @@ <%= _('Organisation Types') %>   - + @@ -171,7 +171,7 @@
    <%= _('Organisation type(s)') %>   - +
    diff --git a/app/views/shared/_links.html.erb b/app/views/shared/_links.html.erb index 2dfaa8568d..681af0352a 100644 --- a/app/views/shared/_links.html.erb +++ b/app/views/shared/_links.html.erb @@ -12,7 +12,7 @@   - + <%= tooltip %> @@ -40,7 +40,7 @@
    diff --git a/app/views/shared/_popover.html.erb b/app/views/shared/_popover.html.erb index 3a7519e62f..433b69935f 100644 --- a/app/views/shared/_popover.html.erb +++ b/app/views/shared/_popover.html.erb @@ -2,7 +2,7 @@ <% if message.present? %> - + <%= message %>> <% end %> diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index 7fb8c234c2..ea756ca074 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -4,7 +4,7 @@
    - + <%= text_field_tag(:search, search_term, class: 'form-control', 'aria-labelledby': 'search', spellcheck: true, 'aria-describedby': 'search-addon', 'aria-required': true) %> diff --git a/app/views/super_admin/users/_confirm_merge.html.erb b/app/views/super_admin/users/_confirm_merge.html.erb index 8814a35334..4c0c5d1fc0 100644 --- a/app/views/super_admin/users/_confirm_merge.html.erb +++ b/app/views/super_admin/users/_confirm_merge.html.erb @@ -6,7 +6,7 @@
    - + <%= select_tag(:merge_id, options_from_collection_for_select(@users, "id", "email"), class: "form-control") %>
    diff --git a/app/views/super_admin/users/edit.html.erb b/app/views/super_admin/users/edit.html.erb index 098af7517a..e95e0c89c0 100644 --- a/app/views/super_admin/users/edit.html.erb +++ b/app/views/super_admin/users/edit.html.erb @@ -88,7 +88,7 @@
    - + <%= text_field_tag(:email, nil, class: "form-control", placeholder: _("Email")) %>
    diff --git a/package.json b/package.json index 22c5a89c8b..92908f075d 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@babel/core": "^7.20.12", "@babel/plugin-transform-runtime": "^7.19.6", "@babel/preset-env": "^7.20.2", - "@fortawesome/fontawesome-free": "^5.15.4", + "@fortawesome/fontawesome-free": "^6.4.0", "@hotwired/turbo-rails": "^7.1.3", "@rails/actioncable": "^6.0.3-1", "@rails/activestorage": "^6.0.3-1", diff --git a/spec/support/helpers/links_helper.rb b/spec/support/helpers/links_helper.rb index cdf63ba34e..a4501227d5 100644 --- a/spec/support/helpers/links_helper.rb +++ b/spec/support/helpers/links_helper.rb @@ -6,6 +6,6 @@ def add_link end def remove_link - all('.link a > .fa-times-circle').last.click + all('.link a > .fa-circle-xmark').last.click end end diff --git a/yarn.lock b/yarn.lock index df8db52b32..eec53e3a4e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -964,10 +964,10 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.38.0.tgz#73a8a0d8aa8a8e6fe270431c5e72ae91b5337892" integrity sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g== -"@fortawesome/fontawesome-free@^5.15.4": - version "5.15.4" - resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.4.tgz#ecda5712b61ac852c760d8b3c79c96adca5554e5" - integrity sha512-eYm8vijH/hpzr/6/1CJ/V/Eb1xQFW2nnUKArb3z+yUWv7HTwj6M7SP957oMjfZjAHU6qpoNc2wQvIxBLWYa/Jg== +"@fortawesome/fontawesome-free@^6.4.0": + version "6.4.0" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.4.0.tgz#1ee0c174e472c84b23cb46c995154dc383e3b4fe" + integrity sha512-0NyytTlPJwB/BF5LtRV8rrABDbe3TdTXqNB3PdZ+UUUZAEIrdOJdmABqKjt4AXwIoJNaRVVZEXxpNrqvE1GAYQ== "@hotwired/turbo-rails@^7.1.3": version "7.3.0"