
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
= tweet-button
Jeremy McAnally - Intridea
A gem/plugin to generate those nifty new Twitter buttons.
== Usage
First, include +TweetButton+ into your application helper. After that, using it is as simple as adding a single method call to your views:
<%= tweet_button %>
Bam. Done. You'll have a sweet lookin' Tweet button all up in your view.
Of course, you can customize it. The method takes a few options (any default can be overridden universally; read on...):
So, if you wanted to tweet about Hacker News, attribute it to Peter Cooper, and add some custom text, all from a tweet button with a horizontal counter, you'd do this:
<%= tweet_button(:via => "peterc", :url => "http://news.ycombinator.com", :text => "AWESOME.")
Simple enough, eh? Also, this method call will include the Twitter JavaScript into the page (it only does it once, even if you have multiple buttons on the page). To put this wherever you'd like (i.e., your header), then use the +twitter_widgets_js_tag+ method. If you call this method, it will place the tag wherever you call it from (and only place it there; subsequent calls do nothing).
The gem also supports the custom Twitter share links. To generate one, use the +custom_tweet_button+ (aliased to +custom_tweet_link+ also) method:
<%= custom_tweet_button %>
This will generate a link that will link to the share page with the same default options as the standard Tweet Button generator. You can customize your custom link with text as the first argument, the same options as +tweet_button+ (with the exception of the +count+ parameter, which will be ignored) as the second, and HTML options as a third argument. For example:
<%= custom_tweet_button('Tweet it!', {:via => "myself"}, {:class => "tweet-sharey-thing"})
== Setting universal defaults
You can set a new default for any option by setting +default_tweet_button_options+ in your application helper. For example:
module ApplicationHelper
include TweetButton
TweetButton.default_tweet_button_options = {:via => "myself"}
end
Only the options you specify will be overridden; so if you only specify a new default +:via+ (which you should definitely do), then the other defaults will stay intact.
== TODO
Probably add the iframe capability.
== Note on Patches/Pull Requests
== Copyright
Copyright (c) 2010 Jeremy McAnally. See LICENSE for details.
FAQs
Unknown package
We found that tweet-button demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.