Skip to content
Browse files

Merge branch 'master' of github.com:sinefunc/boughtstuff-sinatra-acti…

…verecord
  • Loading branch information...
2 parents 5e13c67 + 9b701a6 commit 12da49e7629f32259192754209ba37b59ef10327 Cyril David committed with cyx Apr 27, 2010
View
7 app/concerns/status_update_concerns.rb
@@ -30,7 +30,8 @@ def initialize( attrs = {} )
attrs.each { |field, value| write(field, value) }
if @item and @body.blank?
- template = render(:url => ItemUrl.make(@item), :username => @item.user.login)
+ template = render(:url => ItemUrl.make(@item), :username => @item.user.login,
+ :content => content)
self.body = sprintf(template, @item.to_s)
end
end
@@ -75,6 +76,10 @@ def item_id=( item_id )
self.item = Item.find(item_id)
end
+ def content
+ ""
+ end
+
private
def render( attrs = {} )
self.class.template.dup.tap do |ret|
View
6 app/models/purchase.rb
@@ -1,12 +1,16 @@
class Purchase
include StatusUpdateConcerns
- template "just bought %.64s :url #boughtstuff"
+ template ":content :url #boughtstuff"
@queue = :twitter
def self.perform( item_id, user_id )
item, user = Item.find(item_id), User.find(user_id)
item.update_attribute :twitter_status_id, post( item, user )
end
+
+ def content
+ item.description? ? item.description[0, 76] : "just bought %.64s"
+ end
end
View
21 app/views/layout.haml
@@ -29,4 +29,25 @@
var pageTracker = _gat._getTracker("UA-15297465-1");
pageTracker._trackPageview();
} catch(err) {}
+
+ <script type="text/javascript">
+ lloogg_clientid = "29000010bb1daf0f";
+ </script>
+ <script type="text/javascript" src="http://lloogg.com/l.js?c=29000010bb1daf0f"></script>
+ <script type="text/javascript" charset="utf-8">
+ var is_ssl = ("https:" == document.location.protocol);
+ var asset_host = is_ssl ? "https://s3.amazonaws.com/getsatisfaction.com/" : "http://s3.amazonaws.com/getsatisfaction.com/";
+ document.write(unescape("%3Cscript src='" + asset_host + "javascripts/feedback-v2.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+
+ <script type="text/javascript" charset="utf-8">
+ var feedback_widget_options = {};
+
+ feedback_widget_options.display = "overlay";
+ feedback_widget_options.company = "boughtstuff";
+ feedback_widget_options.placement = "left";
+ feedback_widget_options.color = "#222";
+ feedback_widget_options.style = "idea";
+ var feedback_widget = new GSFN.feedback_widget(feedback_widget_options);
+ </script>
View
2 public/stylesheets/application.css
@@ -193,4 +193,4 @@ span.tool-tip a {color: #FFF;-moz-border-radius:3px;-webkit-border-radius:3px;bo
.footer .sinefunc-brand a {padding-top: 36px; background: url(../images/sinefunc-brand.png) no-repeat; width: 176px; margin-bottom: 10px;}
.footer .copyright {line-height: 36px;}
-#fdbk_tab {bottom: 55%; top: auto !important;}
+#fdbk_tab {bottom: 25%; top: auto !important;}
View
31 spec/models/purchase_spec.rb
@@ -61,4 +61,35 @@
}
end
+describe Purchase, "with an Item and a description got it in thanks giving" do
+ subject do
+ item = Factory.build(:item, :name => "Magic Mouse",
+ :description => "Got it in thanks giving",
+ :user => Factory(:user, :login => "cyx"))
+
+ item.id = 1001
+ item.save!
+
+ Purchase.new(:item => item, :sender => item.user)
+ end
+
+ its(:body) {
+ should == "Got it in thanks giving http://boughtstuff.com/cyx#1001 #boughtstuff"
+ }
+end
+
+describe Purchase, "with an Item and a description Lorem..." do
+ subject do
+ item = Factory.build(:item, :name => "Magic Mouse",
+ :description => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
+ :user => Factory(:user, :login => "abcdefghijklmno"))
+
+ item.id = 1000000000
+ item.save!
+ Purchase.new(:item => item, :sender => item.user)
+ end
+
+ its(:body) { subject.length.should == 139 }
+ its(:body) { should == "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tem http://boughtstuff.com/abcdefghijklmno#1000000000 #boughtstuff" }
+end

0 comments on commit 12da49e

Please sign in to comment.
Something went wrong with that request. Please try again.