I am surprised I couldn't find it on google, what's the best way to add a "tweet" this link to post a url and a description to the user's twitter account?
The 'tweet this link' feature is extremly simple and does not require additional Rails features. It is as simple as:
<a href=http://twitter.com/home?status=Name_and_Address_of_the_twitter_post_that_you_want_everyone to_see_on_twitter>Add to Twitter</a>
To use Rails code, it would be something like:
= link_to "tweet me", "http://twitter.com/home?status=#{#post.short_name} #{post_url(#post)}"
Some remarks:
the status should not be bigger than 140 chars (you can use either an external service as bit.ly or you can write your own controller that answers to small addresses and that redirects to the post)
you can also implement a tracking mechanism that could detect how many users clicked on the 'tweet this' link
The accepted answer used to work for me, but it stopped at some point. A link like this is now working for me:
https://twitter.com/intent/tweet?text=Some%20description&url=https://example.com/someurl
Related
Is it possible to post a link to Reddit via URL?
For example for Facebook you can do
<a href="https://www.facebook.com/sharer/sharer.php?u=http://stackoverflow.com">
Share Stackoverflow on your profile!
</a>
Does Reddit have an equivalent endpoint I can hit to share a URL?
There are several ways to do this, depending on exactly what kind of application you have.
If you're making something interactive, you can take a user to the submit page with a URL and title already filled in. The following URL will open the reddit submit form with a link to this question:
http://www.reddit.com/submit?url=https://stackoverflow.com/questions/24823114/post-to-reddit-via-url&title=Post%20to%20Reddit%20via%20URL
If you just want people to be able to submit your site or blog post to reddit, you can use a reddit button on your page instead.
If you're writing an app or a script where you need to post a URL to reddit, you can use the /api/submit route in the reddit API. If the user that is submitting the link has less than 2 link karma, then a CAPTCHA will probably be given.
I have a huge link. I want to share this link when a user in my app posts to facebook from within the app. However my link is too large so I'd like to shorten it. Is there anyway (natively) I could have something like "Download the app HERE" where HERE redirects to my super long link?
What you're looking to do really can't be done with UIActivityViewController since each service has a completely different mechanism for encoding/representing links. Your best is probably to use some kind of URL shortening service such as Google's
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');
}
I finished Ruby on Rails tutorial where I can follow other users and others may follow me like twitter. Now I wonder how to implement notification system if someone starts to follow me, for example, as in stackexchange or facebook in which come and display a notification (eg red 1). How to go about it? Are there any examples of ready solutions you or MVC?
I'd add a before_filter to relevant controller actions that checks for new followers in the database and sets flash[:notice] to something useful like 'X new followers' and links to your followers page. There's a quick overview of how flash works in the docs: http://api.rubyonrails.org/classes/ActionDispatch/Flash.html
Have a look at those 2 railscasts:
http://railscasts.com/episodes/407-activity-feed-from-scratch
http://railscasts.com/episodes/406-public-activity.