No commit activity in last 3 years
No release in over 3 years
A Refinery CMS engine to add Twitter functionality.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Tweets for Refinery CMS Build Status

About

Tweets allows you add a Twitter feed to your site in minuites. This version of refinerycms-tweets supports Refinery 3.x and Rails 4.1.x. To use Rails 3.x / Refinery 2.1.x use the refinerycms-tweets "Refinery CMS 2-1 stable branch".

Features

  • Use either a Twitter widget or a jQuery implementation using the Public API
  • JQuery implementation accepts an optional callback to override the default response rendering
  • Twitter widget can be fully customised

Note: The Twitter widget doesn't require jQuery however if you choose to use the Public API jQuery is required. I do plan to add a vanilla javascript implementation in future but pull requests are welcome!

Installation

Add this line to your application's Gemfile:

gem 'refinerycms-tweets', git: 'https://github.com/cih/refinerycms-tweets', branch: 'master'

Next run:

bundle
rails generate refinery:tweets
rake db:migrate

Now when you start up your Refinery application, there should be a new "Twitter" tab to manage the account.

Usage

Just add an account and put the following into your view.

<%= tweets %>

Note: If you do not have a view template already then you will need to override one, here is an example of how to do that.

rake refinery:override view=refinery/_footer

Configuration

By default the Twitter widget will be used if the twitter account has a username and widget_id. If there is a username but no widget_id then it will fallback to use the jQuery list. This behaviour can be changed in the initializer as required.

# config/initializers/refinery/tweets.rb

Refinery::Tweets.use_twitter_widget = true
Refinery::Tweets.fallback_to_jquery_tweet_list = true

Customising

Just pass in you options as a hash. Here is an example using the twitter widget. You can see a fill list of options in the docs

<%= tweets("data-chrome"=> "noheader", "data-theme" => "dark", :callback => "testalert") %>

<%= content_for :javascripts do %>
  <script>
    function testalert(response){
      alert(response);
    }
  </script>
<% end %>

In this case the callback will only be triggered if there is no widget_id.

Screenshot

Admin view of the Twitter account

Testing

The refinerycms-testing gem allows you to generate a dummy app within the engine to run the tests against.

rake refinery:testing:dummy_app
rake spec

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request