Skip to content

Commit

Permalink
Backport 'Update the Twitter icons and brand name to X' to v0.27 (#11616
Browse files Browse the repository at this point in the history
)

* Update the Twitter icons and brand name to X

* Update the Twitter icons and brand name to X

* Return the omniauth service name in lowercase as the other services

* Fix the broken specs referring to the old name

* Revert unnecessary change

* Fix the social share button display for the X icon
  • Loading branch information
ahukkanen committed Oct 11, 2023
1 parent 2d0a1fe commit bb08404
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $-zf-bp-value: null;

$brand: #9675ce !default;

$twitter: #55acee !default;
$twitter: #000 !default;
$facebook: #3b5998 !default;
$google: #4285f4 !default;

Expand Down
4 changes: 2 additions & 2 deletions decidim-admin/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ en:
success_color: Success
time_zone: Time Zone
tos_version: Terms of service version
twitter_handler: Twitter handler
twitter_handler: X handler
user_groups_enabled: Enable groups
users_registration_mode: Users registration mode
warning_color: Warning
Expand Down Expand Up @@ -799,7 +799,7 @@ en:
instagram: Instagram
rich_text_editor_in_public_views_help: In some text areas, participants will be able to insert some HTML tags by using the rich text editor.
social_handlers: Social
twitter: Twitter
twitter: X
url: URL
youtube: YouTube
update:
Expand Down
11 changes: 8 additions & 3 deletions decidim-admin/spec/system/admin_manages_organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@

fill_in "Name", with: "My super-uber organization"

%w(Twitter Facebook Instagram YouTube GitHub).each do |network|
click_link network
fill_in "organization_#{network.downcase}_handler", with: "decidim"
%w(X Facebook Instagram YouTube GitHub).each do |network|
within "#organization_social_handlers" do
click_link network
end

field_name = "organization_#{network.downcase}_handler"
field_name = "organization_twitter_handler" if network == "X"
fill_in field_name, with: "decidim"
end

select "Castellano", from: "Default locale"
Expand Down
2 changes: 1 addition & 1 deletion decidim-assemblies/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ en:
subtitle: Subtitle
target: Who participates
title: Title
twitter: Twitter
twitter: X
weight: Order position
youtube: YouTube
assembly_member:
Expand Down
4 changes: 2 additions & 2 deletions decidim-conferences/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ en:
personal_url: Personal URL
position: Position
short_bio: Short bio
twitter_handle: Twitter handle
twitter_handle: X handle
user_id: User
conference_user_role:
email: Email
Expand Down Expand Up @@ -442,7 +442,7 @@ en:
invalid: There was a problem leaving this conference.
success: You have successfully left the conference.
conference_speaker:
go_to_twitter: Go to Twitter
go_to_twitter: Go to X
more_info: more info
personal_website: Personal website
show:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ConferenceSpeakerType < Decidim::Api::Types::BaseObject
field :full_name, GraphQL::Types::String, "Full name of the speaker", null: true
field :position, Decidim::Core::TranslatedFieldType, "Position of the speaker in the conference", null: true
field :affiliation, Decidim::Core::TranslatedFieldType, "Affiliation of the speaker", null: true
field :twitter_handle, GraphQL::Types::String, "Twitter handle", null: true
field :twitter_handle, GraphQL::Types::String, "X handle", null: true
field :short_bio, Decidim::Core::TranslatedFieldType, "Short biography of the speaker", null: true
field :personal_url, GraphQL::Types::String, "Personal URL of the speaker", null: true
field :avatar, GraphQL::Types::String, "Avatar of the speaker", null: true
Expand Down
2 changes: 2 additions & 0 deletions decidim-core/app/helpers/decidim/omniauth_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module OmniauthHelper
# Public: normalize providers names to they can be used for buttons
# and icons.
def normalize_provider_name(provider)
return "x" if provider == :twitter

provider.to_s.split("_").first
end

Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/packs/images/decidim/icons.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion decidim-core/app/packs/stylesheets/decidim/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $actions: #57d685 !default;
$debates: #fa6c96 !default;
$meetings: #fabc6c !default;

$twitter: #55acee !default;
$twitter: #000 !default;
$facebook: #3b5998 !default;
$google: #4285f4 !default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
background-image: url("../images/decidim/vendor/social-share-button/twitter.svg");
}

.social-share-button .ssb-x{
background-image: url("../images/decidim/vendor/social-share-button/x.svg");
}

.social-share-button .ssb-facebook{
background-image: url("../images/decidim/vendor/social-share-button/facebook.svg");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
url: decidim_meta_url,
image: decidim_meta_image_url,
desc: h(decidim_meta_description),
via: decidim_meta_twitter_handler) %>
via: decidim_meta_twitter_handler).sub(%(data-site="x"), %(data-site="twitter")).html_safe %>
<a href="#" class="button" data-open="urlShare">
<%= icon "link-intact", role: "img", "aria-hidden": true %>
<%= t(".share_link") %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<% if current_organization.twitter_handler.present? %>
<li>
<a class="footer-social__icon" target="_blank" rel="noopener" href="https://twitter.com/<%= current_organization.twitter_handler %>">
<span class="show-for-sr"><%= t("layouts.decidim.social_media_links.twitter", organization: translated_attribute(current_organization.name)) %></span>
<%= icon "twitter", role: "img", aria_label: "Twitter" %>
<span class="show-for-sr"><%= t("layouts.decidim.social_media_links.x", organization: translated_attribute(current_organization.name)) %></span>
<%= icon "twitter-x", role: "img", aria_label: "X" %>
</a>
</li>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion decidim-core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ en:
facebook: "%{organization} at Facebook"
github: "%{organization} at GitHub"
instagram: "%{organization} at Instagram"
twitter: "%{organization} at Twitter"
x: "%{organization} at X"
youtube: "%{organization} at YouTube"
timeout_modal:
body: You have been inactive for %{minutes} minutes. If you continue being inactive, you will be automatically signed out for your own security.
Expand Down Expand Up @@ -1871,6 +1871,7 @@ en:
weibo: Sina Weibo
whatsapp_app: WhatsApp
whatsapp_web: WhatsApp
x: X
xing: Xing
time:
formats:
Expand Down
6 changes: 3 additions & 3 deletions decidim-core/spec/system/authentication_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
it "redirects the user to a finish signup page" do
find(".sign-up-link").click

click_link "Sign in with Twitter"
click_link "Sign in with X"

expect(page).to have_content("Successfully")
expect(page).to have_content("Please complete your profile")
Expand All @@ -162,7 +162,7 @@
create(:user, :confirmed, email: "user@from-twitter.com", organization: organization)
find(".sign-up-link").click

click_link "Sign in with Twitter"
click_link "Sign in with X"

expect(page).to have_content("Successfully")
expect(page).to have_content("Please complete your profile")
Expand All @@ -184,7 +184,7 @@
it "creates a new User" do
find(".sign-up-link").click

click_link "Sign in with Twitter"
click_link "Sign in with X"

expect_user_logged
end
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/spec/system/social_share_button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end
end

it "shows the 'Share to Twitter' button" do
it "shows the 'Share to X' button" do
within ".social-share-button" do
expect(page).to have_css('a[data-site="twitter"]')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# found here: https://github.com/huacnlee/social-share-button#configure
#
SocialShareButton.configure do |config|
config.allow_sites = %w(twitter facebook whatsapp_app whatsapp_web telegram)
config.allow_sites = %w(x facebook whatsapp_app whatsapp_web telegram)
end

0 comments on commit bb08404

Please sign in to comment.