treble37 / rsocialize

A ruby gem that lets you incorporate the jQuery sharrre plugin into your ruby app with one command
MIT License
13 stars 9 forks source link

How do we handle Curl? #2

Closed bemky closed 11 years ago

bemky commented 11 years ago

How do we handle the option in sharrre for urlCurl: 'sharrre.php'?

I'm assuming we do this by adding a route for /sharrre so it goes to the rsocialize controller, so if I'm doing a manual jquery initilization, would it be urlCurl: 'sharrre'?

For example:

$('.social-vote').sharrre({
      share: {
        twitter: true,
        facebook: true,
        googlePlus: true
      },
      template: '<div class="box"><div class="left">Share</div><div class="middle"><a href="#" class="facebook">f</a><a href="#" class="twitter">t</a><a href="#" class="googleplus">+1</a></div><div class="right">{total}</div></div>',
      enableHover: false,
      enableTracking: true,
      **urlCurl: 'sharrre',**
      render: function(api, options){
      $(api.element).attr("data-total", options.total);
      $(api.element).on('click', '.twitter', function() {
        api.openPopup('twitter');
      });
      $(api.element).on('click', '.facebook', function() {
        api.openPopup('facebook');
      });
      $(api.element).on('click', '.googleplus', function() {
        api.openPopup('googlePlus');
      });
    }
    });
treble37 commented 11 years ago

Hi bemky,

Yes, that's it exactly. Good catch. Actually you reminded me: I originally I altered Julien's jQuery sharrre file slightly to change urlCurl to "sharrre" so that would be the default, but I forgot to redo it when I updated to sharrre 1.3.4 from 1.3.2.

The latest gem I just uploaded (0.0.3) now should fix this so you don't have to specify urlCurl - it should be "sharrre" in the minified jQuery sharrre file.

I'm thinking for future versions, I won't alter Julien's sharrre jQuery file but will instead set the urlCurl option in Ruby....Interested to hear any more feedback you have.