<% if Translation.find_by_key('site.twitter.query') %>
  <% content_for :side do %>
    <% content_for :head do %>
      <script type="text/javascript">
        jQuery(function($){
          $("#twitter-query").tweet({
            avatar_size: 32,
            count: 5,
            query: "<%= Translation.find_by_key('site.twitter.query').try(:value) %>",
            loading_text: "searching twitter..."
          }).bind("empty", function() { $(this).append('No matching tweets found. Please<p>Please set your twitter search query <%= link_to "here", translations_path %></p>'); });
        });
    </script>
    <% end %>
    <h3>Latest Tweets</h3>
    <div id="twitter-query"></div>
  <% end %>
<% end %>

<% twitter_username = Translation.find_by_key('site.twitter.username').try(:value) %>
<% twitter_query    = Translation.find_by_key('site.twitter.query').try(:value) %>

<% if twitter_username.present? || twitter_query.present? %>

  <% content_for :head do %>
    <script type="text/javascript">
      jQuery (function ($)
      {
        $ ('#twitter-query').tweet ({

          avatar_size   : 32
        ,  count        : 5
        
        <% if twitter_username.present? %>
        ,  username     : '<%= twitter_username %>'
        <% end %>
        
        <% if twitter_query.present? %>
        ,  query        : '<%= twitter_query %>'
        <% end %>
        
        ,  loading_text : "searching twitter..."
        
        }).bind ('empty', function ()
        {
          $ (this).append ('No matching tweets found.<br>Please set your twitter search query <%= link_to "here", translations_path %>')
        })
      })
    </script>
  <% end %>

  
  <% content_for :side do %>

    <h3>Latest Tweets</h3>
    <div id="twitter-query"></div>

  <% end %>

<% end %>

Allow twitter name to be used with jquery.tweet
Allow twitter name to be used with jquery.tweet
