Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
grvsachdeva wants to merge 4 commits into rubyforgood:master
base: master
Choose a base branch
Loading
from grvsachdeva:Facebook_share_button
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
*.swp

.env
.idea/*
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

@leesharma leesharma Nov 6, 2017

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.


private

def current_user_pronouns(user, perspectives, capitalize: true)
Expand Down
2 changes: 1 addition & 1 deletion app/views/wishlists/new.html.erb
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="container">
<div class="header">
<h2>Create a New Wishlist</h1>
Copy link
Collaborator

@leesharma leesharma Oct 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 👍

<h2>Create a New Wishlist</h2>

<%= render 'form', wishlist: @wishlist %>

Expand Down
4 changes: 3 additions & 1 deletion app/views/wishlists/show.html.erb
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<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: wishlist_url(@wishlist),
desc: "Are you a hero of play? #{@wishlist.name} needs your help!") %>
</h2>

<% if current_user.can_manage?(@wishlist) %>
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/social_share_button.rb
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SocialShareButton.configure do |config|
config.allow_sites = %w(twitter email)
config.allow_sites = %w(facebook twitter email)
end

AltStyle によって変換されたページ (->オリジナル) /