-
Notifications
You must be signed in to change notification settings - Fork 49
Facebook share button working #152
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
base: master
Are you sure you want to change the base?
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.
@Gauravano Thanks for the PR! 🎉
This looks pretty good (especially that html fix–thanks for that!) I've got two requests before merging:
-
It looks like you're using RubyMine/IntelliJ and checked in the config files by accident (the
.idea
directory). Could you please remove those from the commit? Feel free to add.idea
to.gitignore
if it helps. -
It looks like you've hard-coded the staging URL. We'll want this functionality to work locally, on staging, and (especially) in production, and all of those use different URLs. Is there a way to make that work without specifying a URL? If not, could we use environment variables?
Thanks again for the PR, and let me know if you have any questions about the review comments!
.idea/.generators
Outdated
@@ -0,0 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
Could you remove the RubyMine files (.idea/*
) from your PR? If it'd be helpful to add .idea
to .gitignore
, feel free to do that!
@@ -1,6 +1,6 @@ | |||
<div class="container"> | |||
<div class="header"> | |||
<h2>Create a New Wishlist</h1> |
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.
Good catch! 👍
app/views/wishlists/show.html.erb
Outdated
@@ -1,7 +1,7 @@ | |||
<div class="container"> | |||
<h2> | |||
<%= @wishlist.name %> | |||
<%= social_share_button_tag("Are you a hero of play? #{@wishlist.name} needs your help!") %> | |||
<%= social_share_button_tag("Are you a hero of play? #{@wishlist.name} needs your help!",:url => "https://project-playtime-staging.herokuapp.com/wishlists/#{@wishlist.id}",desc: "Are you a hero of play? #{@wishlist.name} needs your help!") %> |
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.
This URL changes. Is there a way to do this without a url attribute? If not, can we get this using environment variables?
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.
Thanks for the update! This is closer, but there are still some issues (details in comments):
- It looks like this changes the ruby version to 2.3.3; we don't want to do that.
- This still hard-codes URLs. Maybe the
#wishlist_url
helper would work here? - I also noted some style issues, but they should be easy fixes.
Again, thanks, and let me know if you have any questions!
app/views/wishlists/show.html.erb
Outdated
<% url_share = "https://project-playtime-staging.herokuapp.com/wishlists/#{@wishlist.id}" %> | ||
<% end %> | ||
|
||
<%= social_share_button_tag("Are you a hero of play? #{@wishlist.name} needs your help!",:url => url_share,desc: "Are you a hero of play? #{@wishlist.name} needs your help!") %> |
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.
Some style nitpicks:
- You're using two different hash formats here (
:url => ...
anddesc: ...
); let's stick to the second one (key: value
). - For readability, either add spaces after the commas or break this up into multiple lines.
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.
i will take care of it
Gemfile.lock
Outdated
@@ -305,7 +305,7 @@ DEPENDENCIES | |||
webmock (~> 3.0) | |||
|
|||
RUBY VERSION | |||
ruby 2.4.1p111 | |||
ruby 2.3.3p222 |
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.
We don't want to change our ruby version.
app/views/wishlists/show.html.erb
Outdated
<% url_share = "https://project-playtime-staging.herokuapp.com/wishlists/#{@wishlist.id}" %> | ||
<% else %> | ||
<% url_share = "https://project-playtime-staging.herokuapp.com/wishlists/#{@wishlist.id}" %> | ||
<% end %> |
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.
This still hard-codes URLs; we want this to work anywhere it's hosted.
Actually, looking at it, the url helpers would probably work: wishlist_url(@wishlist)
. Would that be an easier solution?
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.
Making helper is beneficial if wishlist_url has to be used at many placed otherwise I can optimise this URL generally too
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.
This looks really good! One last change request: rails actually has built-in _url
helpers; could you remove the custom helper method? (more details in comments)
After that's done, I think this is ready to merge. 😄
@@ -11,6 +11,10 @@ def display_date(date) | |||
date.to_formatted_s(:long_ordinal) | |||
end | |||
|
|||
def wishlist_url(wishlist) | |||
request.base_url+"/wishlists/#{wishlist.id}" | |||
end |
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.
This is actually built into Rails, so you can remove this method. As an added bonus, the pre-included method will match your app configuration without extra work (ex. with subdomains, ports, friendly urls/slugs, etc.)
Here's a section of the official Rails Guides talking about _path
and _url
helpers.
app/views/wishlists/show.html.erb
Outdated
<%= social_share_button_tag("Are you a hero of play? #{@wishlist.name} needs your help!",:url => url_share,desc: "Are you a hero of play? #{@wishlist.name} needs your help!") %> | ||
<%= social_share_button_tag("Are you a hero of play? #{@wishlist.name} needs your help!", | ||
url: wishlist_url(@wishlist), | ||
desc: "Are you a hero of play? #{@wishlist.name} needs your help!") %> |
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.
Looks good! 👍 I like how you broke this up into multiple lines. Much easier to read!
Gemfile.lock
Outdated
@@ -305,7 +305,7 @@ DEPENDENCIES | |||
webmock (~> 3.0) | |||
|
|||
RUBY VERSION | |||
ruby 2.3.3p222 | |||
ruby 2.4.1p111 |
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.
👍
Resolves issue #112
Example of the run at localhost
@leesharma please have a look and suggest if any improvements required. Thank You.