-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue 948 - title tags update #967
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small fix! Thank you.
@@ -1,7 +1,7 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<title>Terrastories</title> | |||
<title>Terrastories - <%= @community.name %></title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set this to Terrastories: <%= @community.name %></title>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed this update!
@@ -1,7 +1,7 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<title>Terrastories</title> | |||
<title>Welcome - Terrastories<%= @community ? ': ' + @community.name : '' %></title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use interpolation rather than string concatenation and check for community name in addition to community existence:
<title>Welcome - Terrastories<%= @community ? ': ' + @community.name : '' %></title> | |
<title>Welcome - Terrastories<%= @community&.name ? ": #{@community.name}": '' %></title> |
In particular, this will ensure that if community exists but name is somehow nil, it won't crash the page.
irb> ': ' + nil
TypeError (no implicit conversion of nil into String)
irb> ": #{nil}"
=> ": "
@rudokemper Do we also want to localize "Welcome" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestions @lauramosher and yes - that would be a welcome 🤦 change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the nil safe and interpolation update, as well as localization!
For issue #948
Open to suggestions on better ways to do this. I'm fairly new to ruby.