I want to do a simple facebook share button in Ruby on Rails app using koala gem.
The button should be very simple - like this
<a href="https://www.facebook.com/sharer/sharer.php?u=example.org" target="_blank">
Share on Facebook
</a>
I would like to click on it and then should be opened new browser window to put post on my wall (or login to facebook).
I'm beginner in koala gem so I don't know how to do this. Until know I add to controller show method
# part of object_controller.rb
def
#graph = Koala::Facebook::API.
end
and on the view
# part of show.html.erb
<%=graph.put_wall_post("hey, i'm learning koala")%>
but it wants the token access and I think that there is a better (simpler) solution.
The easiest way I have found to add social links from many sites, including the Facebook share button is using the gem 'social-share-buttom'.
Here is a great little tutorial to start using it immediately in your Rails app.
https://richonrails.com/articles/adding-social-sharing-buttons-to-your-rails-app
Koala gem is a realy powerfull tool. If you want just add a share button use more simplest ways: a lot info about share buttons.
But if you want to do some specific just write about it, I will try to help you.
Related
I'm trying to implement Facebook share (not like) and Twitter tweet buttons into my Rails 3 app. I've looked at a couple different gems (shareable, facebook_share, social-buttons, social-share button etc.) but they don't quite fit the bill. I want the button to be a real share button, not a like button. I also want to be able to specify the url. Does anyone know of a good gem to accomplish this?
Alternatively, how tough is it to role your own for something like this?
Koala and Twitter gem fit the bill pretty well.
They are a wrapper on top of their respective API's so you have maximum control over what you want to do.
https://github.com/arsduo/koala
https://github.com/sferik/twitter
I am creating a messaging system for my web app and need help with searching for users to send messages to. So far I have it so that if you type a persons name (who is on the site) you can send a message to them. I want it to be as you start typing a persons name, a drop down appears with users names that the current user is following. Any thoughts on how I can do this?
I am using the gem mailboxer also wondering if anyone has suggestions for a better messaging gem. Thanks in advance.
Use jQuery autocomplete, and just populate the dropdown contents as all users that the user is following... something like current_user.followed_users. It's impossible to give code without seeing how your code works though.
A good alternative to jquery autocomplete is http://loopj.com/jquery-tokeninput/ and github at: https://github.com/loopj/jquery-tokeninput. A facebook like tagging to send message to multiple users. A demo app on https://github.com/railscasts/258-token-fields-revised/tree/master/bookstore-tokeninput-after from Ryan Bates from Railscasts http://railscasts.com/episodes/258-token-fields-revised
Good luck.
I've searched stackoverflow as well as google and can't seem to find a specific enough answer, so I thought I would go ahead and ask it myself!
To provide some background: I am a fairly new rails developer and I've just created a basic app albeit it is lacking some wanted functionality. So far I have integrated Devise, and Omniauth for user login. However, I'd like to have a "pop out window" when users click 'Login' instead of being re-directed to an actual Login page.
If you click on the login button on this website you will see what I am referring to: http://geckodesigns.kinja.com/so-i-bought-a-firetruck-252516685
What sort of Ruby or perhaps Java code would one have to use to implement such functionality?
I look forward to reading your answers!
You could use something like jQuery UI Dialog for this.
Here's the website for jQuery UI. There's also a Rails gem that wraps this library and makes it quite easy to put in your project. You can find that gem on github here.
Suppose you have a login page: html/login.html
In original page:
<a onclick='popupLoginWindow'>Login</a>
JavaScript:
function popupLoginWindow(){
window.open('html/login.html');
}
When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.
How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.
For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?
Kind regards
I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby
You should likely use a gem like http://nokogiri.org/
It allows you to work with a html page just as you would do with jQuery. Very handy.
Whats the best available plugin for add to timeline implementations in rails. I have already implemented fetching friends, I have fb token etc. I used https://github.com/appoxy/mini_fb gem for that.
I want to implement a functionality ie add_to_timeline. Something like pintrest has. Take a look on screenshot.
Whats the best possible Gem/guide for this.
PS: I am not asking for the code, an example is good to have, even guidance for the gem or plugin is even enough :)
This is facebook open graph. You'll have to define actions and objects. Read this:
https://developers.facebook.com/docs/opengraph/keyconcepts/
https://github.com/nov/fb_graph
app = FbGraph::Application.new(APP_ID)
me = FbGraph::User.me(ACCESS_TOKEN)
# Fetch activities
actions = me.og_actions app.og_action(:custom_action)
# Publish an activity
action = me.og_action!(
app.og_action(:custom_action),
:custom_object => 'http://samples.ogp.me/264755040233381')
https://github.com/nov/fb_graph/wiki/OpenGraph
And as kenny said, you'll have to create your own custom actions and objects on Facebook.