Skip to content
Permalink
Browse files

[IMP] all: manually change Font-Awesome v4 icons to use v5

Font-awesome v4 have been supplanted by a v5 in September 2017, it is
about time we migrate our source code to support that new version.

The two version major difference is about icon identification. In FA v4
the icon name only is enough, every icon name had its own character like
'fa-clock' is the only solid clock font, 'fa-clock-o' is the only edge
clock font. In FA v5, every icons can come with up to 5 (in the pro
version) different styles for a same icon name. In FA v5, an icon
identifier is the pair icon style and icon name.

Not all icons could be automatically migrated, this commit manually
upgrades leftover icons.

Task: 2050241
  • Loading branch information
Julien00859 committed Mar 24, 2020
1 parent e4fd203 commit 382d6e23329dbc3cdac365b7e2a6fdf5b09a9330
Showing with 138 additions and 138 deletions.
  1. +2 −2 addons/mail/static/src/xml/thread.xml
  2. +10 −10 addons/mail/static/tests/chatter_tests.js
  3. +3 −3 addons/mail/static/tests/discuss_tests.js
  4. +3 −3 addons/portal_rating/static/src/js/portal_composer.js
  5. +1 −1 addons/survey/views/survey_templates_statistics.xml
  6. +7 −7 addons/web/static/src/js/fields/basic_fields.js
  7. +1 −1 addons/web/static/src/js/views/graph/graph_view.js
  8. +7 −7 addons/web/static/src/js/widgets/switch_company_menu.js
  9. +6 −6 addons/web/static/tests/chrome/action_manager_tests.js
  10. +2 −2 addons/web/static/tests/components/dropdown_menu_tests.js
  11. +1 −1 addons/web/static/tests/control_panel/favorite_menu_tests.js
  12. +1 −1 addons/web/static/tests/control_panel/time_range_menu_tests.js
  13. +55 −55 addons/web/static/tests/fields/basic_fields_tests.js
  14. +1 −1 addons/web/static/tests/helpers/test_utils_control_panel.js
  15. +14 −14 addons/web/static/tests/views/form_tests.js
  16. +1 −1 addons/web/static/tests/views/kanban_tests.js
  17. +1 −1 addons/web/static/tests/views/list_tests.js
  18. +3 −3 addons/web/static/tests/widgets/company_switcher_tests.js
  19. +1 −1 addons/web_editor/static/src/js/editor/snippets.options.js
  20. +1 −1 addons/web_editor/static/tests/field_html_tests.js
  21. +7 −7 addons/website/static/src/snippets/s_rating/options.js
  22. +1 −1 addons/website/static/tests/tours/rte.js
  23. +7 −7 addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
  24. +1 −1 addons/website_forum/views/website_forum.xml
  25. +1 −1 odoo/addons/base/tests/test_views.py
@@ -292,7 +292,7 @@
<t t-esc="message.getDate().format('hh:mm')"/>
</span>
<i t-if="!displayAuthorMessages[message.getID()] and options.displayStars and message.getType() !== 'notification'"
t-att-class="'fa o_thread_message_star o_thread_icon ' + (message.isStarred() ? 'fa-star' : 'fa-star-o')"
t-att-class="'o_thread_message_star o_thread_icon ' + (message.isStarred() ? 'fas' : 'far') + ' fa-star'"
t-att-data-message-id="message.getID()" title="Mark as Todo" role="img" aria-label="Mark as todo"/>
<t t-if="!displayAuthorMessages[message.getID()] and thread.hasSeenFeature()" t-call="mail.widget.Thread.Message.SeenIcon"/>
</div>
@@ -335,7 +335,7 @@
<span t-attf-class="o_thread_icons">
<t t-if="thread.hasSeenFeature()" t-call="mail.widget.Thread.Message.SeenIcon"/>
<i t-if="options.displayStars and !message.isSystemNotification() and !message.needsModeration()"
t-att-class="'fas fa-lg o_thread_icon o_thread_message_star ' + (message.isStarred() ? 'fa-star' : 'fa-star-o')"
t-att-class="'o_thread_icon o_thread_message_star ' + (message.isStarred() ? 'fas' : 'far') + ' fa-star fa-lg'"
t-att-data-message-id="message.getID()" title="Mark as Todo" role="img" aria-label="Mark as Todo"/>
<i t-if="message.isLinkedToDocumentThread() and options.displayReplyIcons"
class="fas fa-reply o_thread_icon o_thread_message_reply"
@@ -126,7 +126,7 @@ QUnit.module('Chatter', {
{ id: 1, name: "Type 1" },
{ id: 2, name: "Type 2" },
{ id: 3, name: "Type 3", category: 'upload_file' },
{ id: 4, name: "Exception", decoration_type: "warning", icon: "fa-warning"}
{ id: 4, name: "Exception", decoration_type: "warning", icon: "fas fa-exclamation-triangle"}
],
},
'mail.message': {
@@ -754,7 +754,7 @@ QUnit.test('kanban activity widget with an activity', async function (assert) {
this.data.partner.records[0].activity_ids = [1, 2];
this.data.partner.records[0].activity_state = 'today';
this.data.partner.records[0].activity_exception_decoration = 'warning';
this.data.partner.records[0].activity_exception_icon = 'fa-warning';
this.data.partner.records[0].activity_exception_icon = 'fa-exclamation-triangle';
this.data['mail.activity'].records = [{
id: 1,
display_name: "An activity",
@@ -805,8 +805,8 @@ QUnit.test('kanban activity widget with an activity', async function (assert) {
"activity widget should have been rendered correctly");
assert.strictEqual(rpcCount, 1, '1 RPC (search_read) should have been done');

// Check exception activity icon fa-warning
assert.hasClass($record.find('.o_activity_btn span'), "fa-warning", "should display correct exception activity icon");
// Check exception activity icon fa-exclamation-triangle
assert.hasClass($record.find('.o_activity_btn span'), "fa-exclamation-triangle", "should display correct exception activity icon");
// click on the activity button
await testUtils.dom.click($record.find('.o_activity_btn'));
assert.strictEqual(rpcCount, 2, 'a read should have been done to fetch the activity details');
@@ -916,7 +916,7 @@ QUnit.test('list activity exception widget with activity', async function (asser
message_ids: [],
activity_ids: [2],
activity_exception_decoration: 'warning',
activity_exception_icon: 'fa-warning',
activity_exception_icon: 'fas fa-exclamation-triangle',
});
this.data['mail.activity'].records = [{
id: 1,
@@ -949,9 +949,9 @@ QUnit.test('list activity exception widget with activity', async function (asser
});

assert.containsN(list, '.o_data_row', 2, "should have two records");
assert.doesNotHaveClass(list.$('.o_data_row:eq(0) .o_activity_exception_cell div'), 'fa-warning',
assert.doesNotHaveClass(list.$('.o_data_row:eq(0) .o_activity_exception_cell div'), 'fa-exclamation-triangle',
"there is no any exception activity on record");
assert.hasClass(list.$('.o_data_row:eq(1) .o_activity_exception_cell div'), 'fa-warning',
assert.hasClass(list.$('.o_data_row:eq(1) .o_activity_exception_cell div'), 'fa-exclamation-triangle',
"there is an exception on a record");

list.destroy();
@@ -1080,15 +1080,15 @@ QUnit.test('chatter: post, receive and star messages', async function (assert) {
"the message's author should be correct");

// star message 2
assert.ok(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star.fa-star-o').length,
assert.ok(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star.far.fa-star').length,
"message 2 should not be starred");
await testUtils.dom.click(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star'));
assert.ok(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star.fa-star').length,
"message 2 should be starred");

// unstar message 2
await testUtils.dom.click(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star'));
assert.ok(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star.fa-star-o').length,
assert.ok(form.$('.o_thread_message[data-message-id=2] .o_thread_message_star.far.fa-star').length,
"message 2 should not be starred");

// very basic test of mention
@@ -2862,7 +2862,7 @@ QUnit.test('chatter: do not duplicate messages on (un)star message', async funct

assert.containsOnce(form, '.o_thread_message',
"there should be a single message in the chatter");
assert.ok(form.$('.o_thread_message .o_thread_message_star.fa-star-o').length,
assert.ok(form.$('.o_thread_message .o_thread_message_star.far.fa-star').length,
"message should not be starred");

// star message
@@ -260,13 +260,13 @@ QUnit.test('searchview options visibility', async function (assert) {

assert.containsOnce(discuss, '.o_control_panel .o_search_options',
"should have search options");
assert.hasClass(discuss.$('.o_control_panel .o_searchview_more.fa'), 'fa-search-minus',
assert.hasClass(discuss.$('.o_control_panel .o_searchview_more.fas'), 'fa-search-minus',
"should have a button to toggle search options");

assert.isVisible(discuss.$('.o_control_panel .o_search_options'),
"search options should be visible by default");
await testUtils.dom.click(discuss.$('.o_control_panel .o_searchview_more.fa'));
assert.hasClass(discuss.$('.o_control_panel .o_searchview_more.fa'), 'fa-search-plus',
await testUtils.dom.click(discuss.$('.o_control_panel .o_searchview_more.fas'));
assert.hasClass(discuss.$('.o_control_panel .o_searchview_more.fas'), 'fa-search-plus',
"should have a button to toggle search options");
assert.isNotVisible(discuss.$('.o_control_panel .o_search_options'),
"search options should be hidden after clicking on search option toggler");
@@ -82,11 +82,11 @@ PortalComposer.include({
var index = Math.floor(val);
var decimal = val - index;
// reset the stars
this.$star_list.removeClass('fa-star fa-star-half-o').addClass('fa-star-o');
this.$star_list.removeClass('far fas fa-star fa-star-half-o').addClass('far fa-star');

this.$('.stars').find("i:lt(" + index + ")").removeClass('fa-star-o fa-star-half-o').addClass('fa-star');
this.$('.stars').find("i:lt(" + index + ")").removeClass('fas fas fa-star-o fa-star-half-o').addClass('fas fa-star');
if (decimal) {
this.$('.stars').find("i:eq(" + index + ")").removeClass('fa-star-o fa-star fa-star-half-o').addClass('fa-star-half-o');
this.$('.stars').find("i:eq(" + index + ")").removeClass('far fas fa-star-o fa-star fa-star-half-o').addClass('far fa-star-half');
}
this.$('.rate_text .badge').text(this.labels[index]);
},
@@ -17,7 +17,7 @@
<h1>
<span t-field="survey.title"/>
<span style="font-size:1.5em;"
t-attf-class="far fa-chart-bar #{'fa-bar-chart-o' if survey.scoring_type == 'no_scoring' else 'fa-trophy' if survey.certification else 'fa-question-circle-o'} float-right " role="img" aria-label="Chart" title="Chart"/>
t-attf-class="#{'far chart-bar' if survey.scoring_type == 'no_scoring' else 'fas fa-trophy' if survey.certification else 'far fa-question-circle'} float-right " role="img" aria-label="Chart" title="Chart"/>
</h1>
<div t-field="survey.description" class="oe_no_empty"/>
<h2 t-if="not question_and_page_data">
@@ -2226,9 +2226,9 @@ var PriorityWidget = AbstractField.extend({
.attr('title', tip)
.attr('aria-label', tip)
.attr('data-index', index)
.addClass('o_priority_star fa')
.toggleClass('fa-star', isFull)
.toggleClass('fa-star-o', !isFull);
.addClass('o_priority_star fa-star')
.toggleClass('fas', isFull)
.toggleClass('far', !isFull);
},

//--------------------------------------------------------------------------
@@ -2273,8 +2273,8 @@ var PriorityWidget = AbstractField.extend({
*/
_onMouseOver: function (event) {
clearTimeout(this.hoverTimer);
this.$('.o_priority_star').removeClass('fa-star-o').addClass('fa-star');
$(event.currentTarget).nextAll().removeClass('fa-star').addClass('fa-star-o');
this.$('.o_priority_star').removeClass('far fa-star').addClass('fas fa-star');
$(event.currentTarget).nextAll().removeClass('fas fa-star').addClass('far fa-star');
},
});

@@ -2430,8 +2430,8 @@ var FavoriteWidget = AbstractField.extend({
*/
_render: function () {
var tip = this.value ? _t('Remove from Favorites') : _t('Add to Favorites');
var template = this.attrs.nolabel ? '<a href="#"><i class="fa %s" title="%s" aria-label="%s" role="img"></i></a>' : '<a href="#"><i class="fa %s" role="img" aria-label="%s"></i> %s</a>';
this.$el.empty().append(_.str.sprintf(template, this.value ? 'fa-star' : 'fa-star-o', tip, tip));
var template = this.attrs.nolabel ? '<a href="#"><i class="%s" title="%s" aria-label="%s" role="img"></i></a>' : '<a href="#"><i class="%s" role="img" aria-label="%s"></i> %s</a>';
this.$el.empty().append(_.str.sprintf(template, this.value ? 'fas fa-star' : 'far fa-star', tip, tip));
},

//--------------------------------------------------------------------------
@@ -21,7 +21,7 @@ var GROUPABLE_TYPES = searchUtils.GROUPABLE_TYPES;

var GraphView = AbstractView.extend({
display_name: _lt('Graph'),
icon: 'fa-bar-chart',
icon: 'fa-chart-bar',
jsLibs: [
'/web/static/lib/Chart/Chart.js',
],
@@ -62,18 +62,18 @@ var SwitchCompanyMenu = Widget.extend({
var dropdownMenu = dropdownItem.parent();
var companyID = dropdownItem.data('company-id');
var allowed_company_ids = this.allowed_company_ids;
if (dropdownItem.find('.fa-square-o').length) {
if (dropdownItem.find('.far.fa-square').length) {
// 1 enabled company: Stay in single company mode
if (this.allowed_company_ids.length === 1) {
if (this.isMobile) {
dropdownMenu = dropdownMenu.parent();
}
dropdownMenu.find('.fa-check-square').removeClass('fa-check-square').addClass('fa-square-o');
dropdownItem.find('.fa-square-o').removeClass('fa-square-o').addClass('fa-check-square');
dropdownMenu.find('.fas.fa-check-square').removeClass('fas fa-check-square').addClass('far fa-square');
dropdownItem.find('.far.fa-square').removeClass('far fa-square').addClass('fas fa-check-square');
allowed_company_ids = [companyID];
} else { // Multi company mode
allowed_company_ids.push(companyID);
dropdownItem.find('.fa-square-o').removeClass('fa-square-o').addClass('fa-check-square');
dropdownItem.find('.far.fa-square').removeClass('far fa-square').addClass('fas fa-check-square');
}
}
session.setCompanies(companyID, allowed_company_ids);
@@ -93,12 +93,12 @@ var SwitchCompanyMenu = Widget.extend({
var companyID = dropdownItem.data('company-id');
var allowed_company_ids = this.allowed_company_ids;
var current_company_id = allowed_company_ids[0];
if (dropdownItem.find('.fa-square-o').length) {
if (dropdownItem.find('.far.fa-square').length) {
allowed_company_ids.push(companyID);
dropdownItem.find('.fa-square-o').removeClass('fa-square-o').addClass('fa-check-square');
dropdownItem.find('.far.fa-square').removeClass('far fa-square').addClass('fas fa-check-square');
} else {
allowed_company_ids.splice(allowed_company_ids.indexOf(companyID), 1);
dropdownItem.find('.fa-check-square').addClass('fa-square-o').removeClass('fa-check-square');
dropdownItem.find('.fas.fa-check-square').addClass('far fa-square').removeClass('fas fa-check-square');
}
session.setCompanies(current_company_id, allowed_company_ids);
},
@@ -3038,23 +3038,23 @@ QUnit.module('ActionManager', {
});
await actionManager.doAction(3);

assert.hasClass($('.o_control_panel .fa-bar-chart-o'),'active',
assert.hasClass($('.o_control_panel .far.fa-chart-bar'),'active',
"bar chart button is active");
assert.doesNotHaveClass($('.o_control_panel .fa-area-chart'), 'active',
assert.doesNotHaveClass($('.o_control_panel .fas.fa-chart-area'), 'active',
"line chart button is not active");

// display line chart
await testUtils.dom.click($('.o_control_panel .fa-area-chart'));
assert.hasClass($('.o_control_panel .fa-area-chart'),'active',
await testUtils.dom.click($('.o_control_panel .fas.fa-chart-area'));
assert.hasClass($('.o_control_panel .fas.fa-chart-area'),'active',
"line chart button is now active");

// switch to kanban and back to graph view
await cpHelpers.switchView(actionManager, 'kanban');
assert.strictEqual($('.o_control_panel .fa-area-chart').length, 0,
assert.strictEqual($('.o_control_panel .fas.fa-chart-area').length, 0,
"graph buttons are no longer in control panel");

await cpHelpers.switchView(actionManager, 'graph');
assert.hasClass($('.o_control_panel .fa-area-chart'),'active',
assert.hasClass($('.o_control_panel .fas.fa-chart-area'),'active',
"line chart button is still active");
actionManager.destroy();
});
@@ -42,14 +42,14 @@ odoo.define('web.dropdown_menu_tests', function (require) {
});

assert.strictEqual(dropdown.el.querySelector('button').innerText.trim(), "Dropdown");
assert.containsOnce(dropdown, 'button i.fa.fa-caret-right');
assert.containsOnce(dropdown, 'button i.fas.fa-caret-right');
assert.containsNone(dropdown, 'ul.o_dropdown_menu');

await testUtils.dom.click(dropdown.el.querySelector('button'));

assert.containsN(dropdown, '.dropdown-divider, .dropdown-item', 3,
'should have 3 elements counting the divider');
assert.containsOnce(dropdown, 'button i.fa.fa-caret-down');
assert.containsOnce(dropdown, 'button i.fas.fa-caret-down');
const itemEls = dropdown.el.querySelectorAll('.o_menu_item > .dropdown-item');
assert.strictEqual(itemEls[0].innerText.trim(), 'Some Item');
assert.doesNotHaveClass(itemEls[0], 'selected');
@@ -33,7 +33,7 @@ odoo.define('web.favorite_menu_tests', function (require) {
};
const controlPanel = await createControlPanel(params);

assert.containsOnce(controlPanel, 'div.o_favorite_menu > button i.fa.fa-star');
assert.containsOnce(controlPanel, 'div.o_favorite_menu > button i.fas.fa-star');
assert.strictEqual(controlPanel.el.querySelector('div.o_favorite_menu > button span').innerText.trim(), "Favorites");

await cpHelpers.toggleFavoriteMenu(controlPanel);
@@ -31,7 +31,7 @@ odoo.define('web.time_range_menu_tests', function (require) {
};
const controlPanel = await createControlPanel(params);

assert.containsOnce(controlPanel, 'div.o_time_range_menu > button i.fa.fa-calendar');
assert.containsOnce(controlPanel, 'div.o_time_range_menu > button i.fas.fa-calendar-alt');
assert.strictEqual(controlPanel.el.querySelector('div.o_time_range_menu > button span').innerText.trim(), 'Time Ranges');

await cpHelpers.toggleTimeRangeMenu(controlPanel);

0 comments on commit 382d6e2

Please sign in to comment.
You can’t perform that action at this time.