Skip to content

Instantly share code, notes, and snippets.

@derwiki
Created April 28, 2011 19:05
Show Gist options
  • Save derwiki/947055 to your computer and use it in GitHub Desktop.
Save derwiki/947055 to your computer and use it in GitHub Desktop.
diff --git a/app/controllers/admin/partners_controller.rb b/app/controllers/admin/partners_controller.rb
index 07cb41a..0296210 100644
--- a/app/controllers/admin/partners_controller.rb
+++ b/app/controllers/admin/partners_controller.rb
@@ -44,7 +44,7 @@ class Admin::PartnersController < Admin::ApplicationController
@search = true
if params[:ben_name] && !params[:ben_name].empty?
@query = "beneficiary name \"#{params[:ben_name]}\""
- beneficiaries,count = Beneficiary.search_using_guidestar(params[:ben_name])
+ beneficiaries = Beneficiary.search_using_guidestar(params[:ben_name])
beneficiaries.collect! { |ben|
Partner.find_all_by_beneficiary_id(ben.id)
}
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index 00e5ce3..3393545 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -61,6 +61,7 @@ class ApplicationController < ActionController::Base
before_filter :activate_email
before_filter :set_p3p_header
before_filter :set_ua_compatible
+ before_filter :track_user
before_filter :redirect_non_www
@@ -174,6 +175,17 @@ class ApplicationController < ActionController::Base
protected
+ def track_user
+ if viewer.real? && params["track"]
+ UserTracking.track!(viewer.id,
+ :tags => params["tags"],
+ :source_type => params["track_source_type"],
+ :source_id => params["track_source_id"])
+ UserTracking.track(viewer.id, "clicked")
+
+ end
+ end
+
# Use this method if you need someone to be authenticated with Facebook on a
# connect page
def require_fbconnect_auth
diff --git a/app/controllers/earn_controller.rb b/app/controllers/earn_controller.rb
index 0b53dfb..bb8d4fc 100644
--- a/app/controllers/earn_controller.rb
+++ b/app/controllers/earn_controller.rb
@@ -55,7 +55,7 @@ class EarnController < ApplicationController
# credit came from cause page
funded_by = Cause.find_by_id(cause_id)
if funded_by
- campaign = funded_by.current_fundraising_campaign
+ campaign = funded_by.current_fundraising_campaign
end
elsif !campaign_id.blank?
# credit came from campaign page, including Clickforcharity
diff --git a/app/controllers/fb/campaigns_controller.rb b/app/controllers/fb/campaigns_controller.rb
index 10bca1e..1688d30 100644
--- a/app/controllers/fb/campaigns_controller.rb
+++ b/app/controllers/fb/campaigns_controller.rb
@@ -5,13 +5,8 @@ class Fb::CampaignsController < Fb::ApplicationController
@campaign = Campaign.find(params[:id])
@cause = Cause.find_by_id(params[:cause_id])
- if params[:app_id] && params[:page_id]
- @continuation =
- "http://www.facebook.com/pages/@/#{params[:page_id]}?sk=app_#{params[:app_id]}"
- else
- @continuation =
- fb_inviter_campaign_url(params[:id], :cause_id => params[:cause_id])
- end
+ @continuation =
+ fb_inviter_campaign_url(params[:id], :cause_id => params[:cause_id])
@stream_publish_data = {
:template_name => "campaigns",
diff --git a/app/controllers/fb/donations_controller.rb b/app/controllers/fb/donations_controller.rb
index 33af886..329c078 100644
--- a/app/controllers/fb/donations_controller.rb
+++ b/app/controllers/fb/donations_controller.rb
@@ -339,6 +339,9 @@ class Fb::DonationsController < Fb::ApplicationController
flash[:email] = params[:email] # unnecessary (email on donation object?)
+ UserTracking.track(viewer.id, "donated",
+ :target => donation)
+
kissmetrics_log_donation(donation)
modesty_log_donation_success
diff --git a/app/controllers/fb/profile_controller.rb b/app/controllers/fb/profile_controller.rb
index cd5c66d..3412ac0 100644
--- a/app/controllers/fb/profile_controller.rb
+++ b/app/controllers/fb/profile_controller.rb
@@ -1,13 +1,11 @@
class Fb::ProfileController < Fb::ApplicationController
- layout 'causes_dot_com'
helper 'fb/cause_recruitments'
helper 'fb/activity'
helper 'fb/updates'
helper 'fb/birthdays'
- helper :youtube
- def old_tab
+ def tab
@user = User.find_by_facebook_uid(fb_sig[:profile_user])
if @user.nil?
ensure_facebook_page_exists
@@ -28,112 +26,4 @@ class Fb::ProfileController < Fb::ApplicationController
render :template => "/fb/activists/show", :layout => false
end
end
-
- def tab
- @page_id = fb_sig[:profile_user]
- @app_id = fb_sig[:app_id]
-
- @fb_page = FbPagePreference.find_by_page_id(@page_id)
- @campaign = Campaign.find(@fb_page.campaign_id) unless @fb_page.blank?
-
- @page_admin = true if fb_sig[:is_admin] == "1"
-
- if @campaign
- @recent_donations = @campaign.donations.recent(8)
-
- @media_array = []
- prim_med = @campaign.primary_media
- mediaz = @campaign.campaign_medias
- @video_arr, @photo_arr = mediaz.partition{|m| m.video?}
- @media_array << prim_med if prim_med
- @media_array += @video_arr.compact if @video_arr
- @media_array += @photo_arr.compact if @photo_arr
- @media_array.uniq!
- end
-
- if @campaign && @campaign.specific?
- render :template => "fb/profile/specific_campaign", :layout => false
- elsif @campaign && @campaign.general?
- render :template => "fb/profile/general_campaign", :layout => false
- else
- render :template => "fb/profile/general_giving", :layout => false
- end
-
- end
-
- def ajax_search
- search_term = params[:q]
- page = params[:page]
-
- @results, @count = Beneficiary.search_using_guidestar(
- search_term, :page => page, :page_size => 10)
-
- respond_to do |format|
- format.html { render :layout => false }
- format.js { render :layout => false }
- end
-
- end
-
- #TODO
- # What if there are no app params?
- # Stop all instant dialogs
- def edit_tab
- @page_id = params[:page_id]
- @app_id = params[:app_id]
- @search_q = params[:beneficiary_search]["query"] if params[:beneficiary_search]
-
- @current_sponsor = FbPagePreference.find_by_page_id(@page_id)
-
- if params[:beneficiary_search] && @search_q
- @results, @ben_total = Beneficiary.search_using_guidestar(@search_q, :page_size => 10)
- end
- end
-
- def submit_tab
- beneficiary_id = params[:beneficiary]
- campaign_id = params[:campaign]
-
- if beneficiary_id.blank?
- render :template => "fb/profile/edit_tab"
- return
- end
-
- @page_id = params[:page_id]
- @app_id = params[:app_id]
- @beneficiary = Beneficiary.find(beneficiary_id)
- @hide_search = false
- @campaign = nil
-
- if campaign_id
- @campaign = Campaign.find(campaign_id)
- else
- general_campaigns, fundraising_campaigns = @beneficiary.campaigns.open.partition(&:general?)
- @campaign = general_campaigns.first
-
- # sort fundraising campaigns by recency
- @results = general_campaigns +
- fundraising_campaigns.sort do |a,b|
- a.created_at <=> b.created_at
- end.reverse
- end
-
- if @beneficiary && @campaign
- page_preference = FbPagePreference.find_or_create_by_page_id(@page_id)
- page_preference.attributes = {
- :beneficiary_id => @beneficiary.id,
- :campaign_id => @campaign.id
- }
- page_preference.save
- end
-
- if fundraising_campaigns.blank?
- fb_page = "http://www.facebook.com/pages/@/"+@page_id+"?sk=app_"+@app_id
- redirect_to fb_page
- else
- @hide_search = true
- render :template => "fb/profile/edit_tab"
- end
- end
-
end
diff --git a/app/controllers/public_api/search_controller.rb b/app/controllers/public_api/search_controller.rb
index 533ae4c..df351c8 100644
--- a/app/controllers/public_api/search_controller.rb
+++ b/app/controllers/public_api/search_controller.rb
@@ -7,9 +7,9 @@ class PublicApi::SearchController < PublicApi::ApplicationController
search_options = {:order_by => 'total_raised', :limit => limit}
search_options.merge!(:exclusions => {:beneficiary_id => nil})
- causes, x = FacebookCause.search(query, search_options)
- campns = Campaign.search(query, {:limit => limit})
- benefs,total = Beneficiary.search_using_guidestar(query, {:limit => limit})
+ causes, x = FacebookCause.search(query, search_options)
+ campns = Campaign.search(query, {:limit => limit})
+ benefs = Beneficiary.search_using_guidestar(query, {:limit => limit})
results = {
:cause => causes.select { |c| c.fundraising? }.map(&:id),
diff --git a/app/helpers/youtube_helper.rb b/app/helpers/youtube_helper.rb
index 13f0121..1d08877 100644
--- a/app/helpers/youtube_helper.rb
+++ b/app/helpers/youtube_helper.rb
@@ -1,20 +1,11 @@
module YoutubeHelper
- def youtube_thumbnail_url(video_id)
+ def youtube_thumbnail_url( video_id )
"http://img.youtube.com/vi/#{video_id}/default.jpg"
end
- def youtube_image_url(video_id)
- "http://img.youtube.com/vi/#{video_id}/0.jpg"
- end
-
- def youtube_embed_url(video_id, autoplay = false)
- url = "http://www.youtube.com/v/#{video_id}?fs=1&amp;hl=en_US&amp;rel=0"
- if autoplay
- url + "&amp;autoplay=1"
- else
- url
- end
+ def youtube_embed_url( video_id )
+ "http://www.youtube.com/v/#{video_id}?fs=1&amp;hl=en_US"
end
end
diff --git a/app/models/beneficiary.rb b/app/models/beneficiary.rb
index f5b890f..31f3329 100644
--- a/app/models/beneficiary.rb
+++ b/app/models/beneficiary.rb
@@ -187,24 +187,19 @@ class Beneficiary < ActiveRecord::Base
# returns [results:Array, total:Fixnum]
def self.search_guidestar(params)
page = params.delete(:page).to_i
- results_per_page = (params.key?(:limit)) ? params[:limit].to_i : RESULTS_PER_PAGE
Beneficiary.with_scope(:find => {:conditions =>
"not exists (select * from defunct_beneficiaries db where db.id = " +
"beneficiaries.id)"
}) do
- results, total = GuideStar.search(params[:q], page, results_per_page)
+ results, total = GuideStar.search(params[:q], page, RESULTS_PER_PAGE)
return [results, total]
end
end
def self.search_using_guidestar(query, options={})
options[:limit] ||= 10
- options[:page] ||= 1
- beneficiary_results, count = Beneficiary.search_guidestar({:q => query,
- :page => options[:page], :limit => options[:limit]})
- beneficiaries = Beneficiary.find( :all,
- :conditions => ['ein IN (?)', beneficiary_results.collect{|b| b.ein}])
- return beneficiaries, count
+ beneficiary_results, count = Beneficiary.search_guidestar({:q => query, :limit => options[:limit]})
+ Beneficiary.find(:all, :conditions => ['ein IN (?)', beneficiary_results.collect{|b| b.ein}])
end
def self.browse(params)
diff --git a/app/models/engagement_credit.rb b/app/models/engagement_credit.rb
index 71a8301..e0b4065 100644
--- a/app/models/engagement_credit.rb
+++ b/app/models/engagement_credit.rb
@@ -177,7 +177,9 @@ class EngagementCredit < ActiveRecord::Base
ActionCredit.record_earn( user, nil, self )
end
-
+ UserTracking.track(self.user_id,
+ "gave a minute",
+ :target => self)
end
PROMO_BANNER_NAME = 'socialvibe_alert_banner'
diff --git a/app/models/fb_page_preference.rb b/app/models/fb_page_preference.rb
deleted file mode 100644
index 819be4d..0000000
--- a/app/models/fb_page_preference.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class FbPagePreference < ActiveRecord::Base
-
-end
diff --git a/app/models/user_tracking.rb b/app/models/user_tracking.rb
new file mode 100644
index 0000000..24a8d28
--- /dev/null
+++ b/app/models/user_tracking.rb
@@ -0,0 +1,63 @@
+class UserTracking < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :target, :polymorphic => true
+ belongs_to :source, :polymorphic => true
+
+ validates_presence_of :user_id
+
+ # For activating tracking in outgoing emails
+ def self.track_mails(track=true, options = {})
+ if track
+ options[:track] = 1
+ ActionMailer::Base.default_url_options.merge!(options)
+ else
+ ActionMailer::Base.default_url_options.delete(:track)
+ end
+ end
+
+ TRACK_DURATION = 12.hours
+ def self.track_source(user_id)
+ value = Cacher.get(self.track_key(user_id))
+ end
+ def self.tracked?(user_id, value = nil)
+ value ||= self.track_source(user_id)
+ value && value[:expires] && value[:expires] >= Time.now.to_i
+ end
+ def self.track!(user_id, options = {})
+ expires_in = options[:expires_in]
+ expires_in ||= TRACK_DURATION
+ Cacher.set(self.track_key(user_id), Time.now+expires_in) do
+ result = {:expires => (Time.now+expires_in).to_i}
+
+ [:source_id, :source_type, :tags].each do |key|
+ result[key] = options[key] if options[key]
+ end
+
+ if options[:source]
+ result.merge!({:source_type => options[:source].class.name,
+ :source_id => options[:source].id})
+ end
+ result
+ end
+ end
+ def self.stop_tracking!(user_id)
+ Cacher.delete(self.track_key(user_id))
+ end
+
+ def self.track(user_id, message, options={})
+ value = self.track_source(user_id)
+ return if !self.tracked?(user_id, value)
+
+ logger.info("UserTracking.track user_id: #{user_id} message: #{message}")
+ options.merge!({:user_id => user_id,
+ :source_type => value[:source_type],
+ :source_id => value[:source_id],
+ :message => message})
+ self.create!(options)
+ end
+
+ protected
+ def self.track_key(user_id)
+ "track-user-#{user_id}"
+ end
+end
diff --git a/app/views/causes/search.html.erb b/app/views/causes/search.html.erb
index 69b69e9..fedd1b7 100644
--- a/app/views/causes/search.html.erb
+++ b/app/views/causes/search.html.erb
@@ -16,7 +16,7 @@
<div class="item-list">
<%= collection_of_causes(@cause_results) %>
</div>
- <%= fb_link_to_pages(@total_results) %>
+ <%= fb_link_to_pages(@total_results, :facebook_sub => "/causes") %>
<% else %>
<div class="empty_msg">
<p>No results match your search.</p>
diff --git a/app/views/causes/show/campaigns/_fundraising.html.erb b/app/views/causes/show/campaigns/_fundraising.html.erb
index daf64cb..660d440 100644
--- a/app/views/causes/show/campaigns/_fundraising.html.erb
+++ b/app/views/causes/show/campaigns/_fundraising.html.erb
@@ -57,7 +57,7 @@
<% if campaign.primary_media && campaign.primary_media.video? %>
<p class="vid_holder">
<iframe title="YouTube video player" width="500" height="405"
- src="<%= youtube_embed_url(campaign.primary_media.youtube_url) -%>" frameborder="1" ></iframe>
+ src="<%= youtube_embed_url(campaign.primary_media.youtube_url) -%>" frameborder="1" ></iframe>
</p>
<%= yield :goal_bar %>
<p class="desc">
diff --git a/app/views/fb/fanpage/edit.html.erb b/app/views/fb/fanpage/edit.html.erb
deleted file mode 100644
index c7a10fa..0000000
--- a/app/views/fb/fanpage/edit.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<h1>Add a beneficiary to your fanpage</h1>
diff --git a/app/views/fb/profile/_search_results.html.erb b/app/views/fb/profile/_search_results.html.erb
deleted file mode 100644
index 6a355e5..0000000
--- a/app/views/fb/profile/_search_results.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-<%#<div class="nonnie_results">
- <ul> %>
- <% @results.each do |b| %>
- <li class="<%= cycle('', 'even') %>">
- <input type="radio" id="<%= b.id -%>"
- name="<%= b.is_a?(Campaign) ? "campaign" : "beneficiary" %>"
- value="<%= b.id -%>" />
- <label for="<%= b.id -%>">
- <% if b.is_a?(Beneficiary) && b.photo? %>
- <span class="img_holder">
- <%= photo b, :small -%>
- </span>
- <% elsif b.is_a?(Campaign) && b.displayed_photo %>
- <span class="img_holder">
- <%= photo b, :small -%>
- </span>
- <% end %>
- <span>
- <strong><%= b.name -%></strong>
- </span>
- </label>
- </li>
- <% end %>
-<%# </ul>
-</div><!-- .nonnie_results -->
-%>
diff --git a/app/views/fb/profile/ajax_search.html.erb b/app/views/fb/profile/ajax_search.html.erb
deleted file mode 100644
index 65e6354..0000000
--- a/app/views/fb/profile/ajax_search.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= render :partial => 'fb/profile/search_results', :locals => { :results => @results } %>
diff --git a/app/views/fb/profile/edit_tab.html.erb b/app/views/fb/profile/edit_tab.html.erb
deleted file mode 100644
index 7a7d119..0000000
--- a/app/views/fb/profile/edit_tab.html.erb
+++ /dev/null
@@ -1,168 +0,0 @@
-<style type="text/css">
- .head .logo,
- .get_those_nonnies .text,
- .get_those_nonnies .submit,
- .nonnie_results .submit a {
- background-image: url(
- <%= image_path('facebook/fanpage/fanpage_sprite.png') %>
- );
- }
-</style>
-
-<% @big_header = true %>
-<% add_stylesheet 'fanpage/global' %>
-
-<div class="searcher">
- <div class="head">
- <a href="#" class="logo">Causes</a>
- <p class="sthupport">fanpage settings</p>
- <p>Step <%= @hide_search ? "2" : "1" %> of 2</p>
- </div>
- <% unless @hide_search %>
- <div class="get_those_nonnies">
- <h1><strong>Search</strong> for those nonprofits you would like to support:</h1>
- <% form_for :beneficiary_search,
- :url => { :action => "edit_tab", :params => { :app_id => @app_id, :page_id => @page_id } } do |f| %>
- <%= f.text_field :query -%>
- <span class="examples">Try: Red Cross, Louisville, Animals, EIN</span>
- <input type="hidden" name="page_id" value="<%= @page_id -%>" />
- <input type="hidden" name="app_id" value="<%= @app_id -%>" />
- <%= submit_tag "" -%>
- <% end %>
- </div>
- <% end %>
-
- <% if @hide_search %>
- <div class="beneficiary_details">
- <%= photo @beneficiary, :small if @beneficiary.photo? -%>
- <h2><%= @beneficiary.name -%></h2>
- <p>501c3 Nonprofit | <span class="verified">Verified by Causes</span></p>
- <p>
- Your tab can feature either a <strong>general donation</strong> button for this
- nonprofit OR a <strong>specific fundraising project</strong> they are currently
- trying to promote. If you choose the specific project, it will
- automatically switch to a general fundraising button when the project is over.
- </p>
- </div>
- <% end %>
-
-<% if @results && @results.length > 0 %>
- <div class="nonnie_results">
- <p>Displaying 1 &#45; <span class="results_counter"><%=
- @results.length %></span> of
- <%= @ben_total -%> results for
- <strong>
- <% if @search_q && !@campaign -%>
- <%= @search_q -%>
- <% else %>
- <%= @beneficiary.name if @beneficiary -%>
- <% end %>
- </strong></p>
- <% form_for :chosen_beneficiary,
- :url => { :action => "submit_tab" } do |bf| %>
- <ul>
- <% @results.each do |b| %>
- <li class="<%= cycle('', 'even') %>">
- <input type="radio" id="<%= b.id -%>"
- name="<%= b.is_a?(Campaign) ? "campaign" : "beneficiary" %>"
- value="<%= b.id -%>" />
- <label for="<%= b.id -%>">
- <% if b.is_a?(Beneficiary) && b.photo? %>
- <span class="img_holder">
- <%= photo b, :small -%>
- </span>
- <% elsif b.is_a?(Campaign) && b.displayed_photo %>
- <span class="img_holder">
- <%= photo b, :small -%>
- </span>
- <% end %>
- <span>
- <strong><%= b.name -%></strong>
- <% if b.is_a?(Campaign) && b.general? %>
- <br>
- General Fundraising Project
- <% end %>
- </span>
-
- </label>
- </li>
- <% end %>
- </ul>
- <% unless @hide_search %>
- <a href="#" class="show_more_nonnies">Show more</a>
- <span class="waiting_for_nonnies"><%=
- image_tag(
- 'causes_dot_com/actions/index/loading.gif',
- :class => :nonnie_spinnin) %>
- </span>
- <% end %>
- <div class="submit">
- <input type="hidden" name="page_id" value="<%= @page_id %>" />
- <input type="hidden" name="app_id" value="<%= @app_id %>" />
- <% if @results[0].is_a?(Campaign) %>
- <input type="hidden" name="beneficiary" value="<%= @beneficiary.id -%>" />
- <% end %>
- <a href="#" class="disabled">Continue</a>
- <input type="submit" value="Continue" />
- </div>
- <% end %>
- </div><!-- .nonnie_results -->
-<% elsif @results %>
- <div class="no_results">
- <h1>Oh no!</h1>
- <p>We didn&#39;t find anything. I say give it another go.</p>
- </div>
-<% end %>
- <div class="clearfix"></div>
-</div> <!-- .searcher -->
-
-<script type='text/javascript'>
- $(document).ready(function() {
- var checked = 0;
- var page_at = 1;
- var possibly_reloaded = $('.nonnie_results input:checked').attr('id')
- if (possibly_reloaded != undefined) { checked = 1; $('.submit a').removeClass('disabled'); }
-
- $('.nonnie_results input:radio').live( 'click', function() {
- checked = 1;
- $('.submit a').removeClass('disabled');
- });
-
- $('.submit a').click(function(e) {
- e.stopPropagation();
- e.preventDefault();
-
- if (checked == 0) { alert('Please choose a nonprofit to sponsor'); }
- else { $('.submit input').click(); }
- });
-
- $('.show_more_nonnies').click(function(e) {
- e.stopPropagation();
- e.preventDefault();
-
- $( '.show_more_nonnies' ).hide(0, function(){
- $( '.waiting_for_nonnies' ).show();
- });
-
- $.ajax({
- url: '/fb/profile/ajax_search',
- data: {
- q: '<%= @search_q %>',
- page: ++page_at
- },
- success: function(data) {
- $( '.nonnie_results ul' ).append(data);
- $( '.results_counter' ).html(
- $('.nonnie_results ul').children().length);
- },
- complete: function() {
- $( '.waiting_for_nonnies' ).hide(0, function(){
- $( '.show_more_nonnies' ).show();
- });
- }
- });
- });
-
- });
-
-</script>
diff --git a/app/views/fb/profile/general_campaign.html.erb b/app/views/fb/profile/general_campaign.html.erb
deleted file mode 100644
index 462c01b..0000000
--- a/app/views/fb/profile/general_campaign.html.erb
+++ /dev/null
@@ -1,59 +0,0 @@
-<%= fbcss('fanpage/fanpage') %>
-<div class="causes_head">
- <a href="#" class="logo_bro">Causes.com</a>
- <% if @page_admin %>
- <%= link_to "Edit your cause tab",
- fb_edit_tab_profile_url( :page_id => @page_id, :app_id => @app_id ),
- :class => "head_edit" -%>
- <% end %>
-</div>
-<div class="causes_body general_campaign">
- <h1><%= @campaign.name %></h1>
- <p>501c3 Nonprofit &#124; <span class="verified">Verified by Causes</span>
-
- <div class="desc <%= "no_photo" if (@campaign.photo.blank? &&
- @campaign.beneficiary.photo.blank?) || @campaign.description.blank? %>">
- <span class="img_holder">
- <% if !@campaign.photo.blank? && !@campaign.description.blank? %>
- <%= image_tag(@campaign.photo.url(:medium)) -%>
- <% elsif !@campaign.beneficiary.photo.blank? %>
- <%= image_tag(@campaign.beneficiary.photo.url(:medium)) -%>
- <% end %>
- </span>
- <p><%= @campaign.description -%></p>
- </div>
-
- <div class="contribute_buttons">
- <%= link_to "Give", donation_connect_url(
- :campaign_id => @campaign.id), :class => "give_btn" %>
- <%= link_to "Share", fb_wall_campaign_url(
- @campaign, :app_id => @app_id, :page_id => @page_id ),
- :class => "share_btn" %>
- </div>
-
- <% if @recent_donations.size > 0 %>
- <div class="donorz">
- <h4><%= number_with_delimiter @recent_donations.count -%> Donor<%= "s" if @recent_donations.count > 1 -%></h4>
- <ul>
- <% @recent_donations.each do |rd| %>
- <li>
- <span class="amount">
- <%= dollarize(rd.amount_usd.to_i) -%>
- </span>
- <%= photo_link_to_activist_profile(rd.donor, @campaign) -%>
- <%= link_to_activist_profile(rd.donor) %>
- </li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div class="birthday_wish">
- <span class="birthday_cake"></span>
- <p>This year, instead of asking for gifts, donate your birthday to <%= @campaign.name -%>.<br />
- <%= link_to "Create a Birthday Wish",
- new_wish_url(:campaign_id => @campaign.id, :bws => 'campaign')
- -%>
- </p>
- </div>
-</div>
diff --git a/app/views/fb/profile/general_giving.html.erb b/app/views/fb/profile/general_giving.html.erb
deleted file mode 100644
index 7b8c25c..0000000
--- a/app/views/fb/profile/general_giving.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<%= fbcss("fanpage/fanpage") %>
-
-<% if @page_admin %>
- <div class="unset">
- <p>Your Causes Tab hasn&#39;t been set up yet.</p>
- <%= link_to "Get Started",
- fb_edit_tab_profile_url( :page_id => @page_id, :app_id => @app_id ) -%>
- </div>
-<% end %>
-
-<div class="causes_head">
- <a href="#" class="logo_bro">Causes.com</a>
- <% if @page_admin %>
- <%= link_to "Edit your cause tab",
- fb_edit_tab_profile_url( :page_id => @page_id, :app_id => @app_id ),
- :class => "head_edit" -%>
- <% end %>
-</div>
-
-<div class="causes_body">
- <span class="logo"></span>
- <h1>We&#39;ll help you change the world.</h1>
- <p>
- Causes is the world&#39;s largest platform for activism and philanthropy.
- We empower individuals to create grassroots communities called &ldquo;causes&rdquo;
- that take action on behalf of a specific issue or nonprofit organization.<br />
- </p>
- <p><a href="http://www.causes.com"><span class="arrow"></span>Visit causes.com</a>
-</div>
diff --git a/app/views/fb/profile/specific_campaign.html.erb b/app/views/fb/profile/specific_campaign.html.erb
deleted file mode 100644
index bc092e0..0000000
--- a/app/views/fb/profile/specific_campaign.html.erb
+++ /dev/null
@@ -1,161 +0,0 @@
-<%= fbcss('fanpage/fanpage') %>
-<%= fbjs('fanpage/fanpage') %>
-<div class="causes_head">
- <a href="#" class="logo_bro">Causes.com</a>
- <span>Fundraising Project</span>
- <% if @page_admin %>
- <%= link_to "Edit your cause tab",
- fb_edit_tab_profile_url( :page_id => @page_id, :app_id => @app_id ),
- :class => "head_edit" -%>
- <% end %>
-</div>
-
-<% content_for :goal_bar do %>
- <% unless @campaign.target_amount == nil %>
- <%
- percent = @campaign.percent_raised || 0
- pix_val = 384 * (percent/100.0)
- tip_val = -62 + pix_val.to_i
- %>
- <div class="progress_bar">
- <p class="project_goal">Goal</p>
- <div class="progress_bar_bg">
- <p class="progress" style="width: <%= pix_val.to_i -%>px;">
- <span style="left: <%= tip_val %>px">
- <span class="arrow"></span>
- <%= dollarize(@campaign.total_raised.to_i) -%>
- </span>
- </p>
- </div>
- <p>$<%= @campaign.target_amount %></p>
- </div>
- <% end %>
-<% end %>
-
-<div class="causes_body specific_campaign">
- <h1><%= @campaign.name -%></h1>
- <p class="operated_by">Project Operated by <%= @campaign.beneficiary.name -%></p>
- <% if @media_array.length > 0 %>
- <div id="fb_media_viewer" class="media_viewer">
-
- <% if @media_array[0].video? %>
- <div class="selected">
- <fb:swf
- swfbgcolor="000000"
- waitforclick=false
- swfsrc='<%= youtube_embed_url(@media_array[0].youtube_url, true) -%>'
- imgsrc='<%= youtube_image_url(@media_array[0].youtube_url) -%>'
- width='490' height='270' />
- </div>
- <% else %>
- <span class="selected">
- <%= photo(@media_array[0], :colossal, :alt => @media_array[0].caption) -%>
- </span>
- <% end %>
-
-<!--
-FB does not support our gallery idea right now
-
- <%# @media_array[1..-1].each do |cmb| %>
- <%# if cmb.video? %>
- <div>
- <fb:swf
- swfbgcolor="000000"
- swfsrc='<%#= youtube_embed_url(cmb.youtube_url) -%>'
- imgsrc='<%#= youtube_image_url(cmb.youtube_url) -%>'
- width='490' height='270' />
- </div>
- <%# else %>
- <span><%#= photo(cmb, :colossal, :alt => cmb.caption) -%></span>
- <%# end %>
- <%# end %>
--->
- </div>
-<!--
-Photo gallery navigation.
-No Fanpage support for js yet.
- <ul id="fb_media_items" class="media_options">
- <li class="selected">
- <%# if @media_array[0].video? %>
- <%#= image_tag youtube_thumbnail_url(@media_array[0].youtube_url) -%>
- <%# else %>
- <%#= photo(@media_array[0], :thumb) -%>
- <%# end %>
- </li>
- <%# @media_array[1..-1].each do |cm| %>
- <li>
- <%# if cm.video? %>
- <%#= image_tag youtube_thumbnail_url(cm.youtube_url) -%>
- <%# else %>
- <%#= photo(cm, :thumb, :alt => cm.caption) -%>
- <%# end %>
- </li>
- <%# end %>
- </ul>
--->
- <% end %>
-
- <p class="desc">
- <%= ellipsize(strip_tags(@campaign.description).brize, 250) -%>
- <%= link_to "Read More", campaign_url(@campaign.id) if @campaign.description if @campaign.description.length > 250 -%>
- </p>
- <%= yield :goal_bar %>
-
- <% if @campaign.donor_choices.length > 1 -%>
- <div class="whatchyouwannagive">
- <span class="top"></span>
- <div class="body">
- <h4>Where the Money Goes</h4>
- <ul>
- <% @campaign.donor_choices.each do |dc| %>
- <li>
- <p class="don_the_img">
- <span><%= dollarize(dc.amount) -%></span>
- <%= image_tag(dc.photo.url(:small)) -%>
- </p>
- <p class="dochoi_title"><%= dc.title -%></p>
- <%= link_to "Give #{dollarize(dc.amount)}",
- donation_connect_url(:campaign_id => @campaign.id,
- :amount => dc.amount),
- :class => "don_btn" -%>
- </li>
- <% end %>
- </ul>
- </div>
- <span class="btm"></span>
- </div>
- <% end %>
-
- <div class="contribute_buttons_small">
- <%= link_to "Give", donation_connect_url(
- :campaign_id => @campaign.id), :class => "give_btn" %>
- <%= link_to "Share", fb_wall_campaign_url(
- @campaign, :app_id => @app_id, :page_id => @page_id ),
- :class => "share_btn" %>
- </div>
-
- <% if @recent_donations.size > 0 %>
- <div class="donorz">
- <h4><%= number_with_delimiter @recent_donations.count -%> Donor<%= "s" if @recent_donations.count > 1 -%></h4>
- <ul>
- <% @recent_donations.each do |rd| %>
- <li>
- <span class="amount">
- <%= dollarize(rd.amount_usd.to_i) -%>
- </span>
- <%= photo_link_to_activist_profile(rd.donor, @campaign) -%>
- <%= link_to_activist_profile(rd.donor) %>
- </li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div class="birthday_wish">
- <span class="birthday_cake"></span>
- <p>This year, instead of asking for gifts, donate your birthday to <%= @campaign.name -%>.<br />
- <%= link_to "Create a Birthday Wish",
- new_wish_url(:campaign_id => @campaign.id, :bws => 'campaign')
- -%>
- </div>
-</div>
diff --git a/app/views/fb/scripts/fanpage/fanpage.js b/app/views/fb/scripts/fanpage/fanpage.js
deleted file mode 100644
index 4d938ac..0000000
--- a/app/views/fb/scripts/fanpage/fanpage.js
+++ /dev/null
@@ -1,6 +0,0 @@
-(function() {
- var photo_gallery = document.getElementById("fb_media_viewer");
- var photo_items = document.getElementById("fb_media_items");
- alert(photo_gallery)
-})();
-
diff --git a/app/views/fb/styles/fanpage/edit_fanpage.css b/app/views/fb/styles/fanpage/edit_fanpage.css
deleted file mode 100644
index dff789c..0000000
--- a/app/views/fb/styles/fanpage/edit_fanpage.css
+++ /dev/null
@@ -1,189 +0,0 @@
-.searcher {
- width: 735px;
- padding: 60px 10px 15px 15px;
- position: relative;
- /*border-radius: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;*/
- background-color: #f2f3f7;
- font: normal 12px "Lucida Grande", tahoma, verdana, sans-serif;
- color: #222;
-}
-.searcher .head {
- display: block;
- width: 848px;
- height: 16px;
- padding: 13px 15px 11px 93px;
- position: absolute;
- top: 0px;
- left: 0px;
- /*border-radius: 5px 5px 0 0;
- -webkit-border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0px;*/
- background-color: #62be3e;
-}
-.head .logo {
- display: block;
- width: 78px;
- height: 22px;
- position: absolute;
- top: 9px;
- left: 12px;
- background: transparent url() no-repeat -10px -10px;
- text-indent: -5000px;
- outline: none;
-}
-.head p {
- float: right;
- color: #FFF;
-}
-.head .sthupport {
- float: left;
- font-size: 11px;
- text-transform: uppercase;
-}
-/* Search form styling */
-.get_those_nonnies {
- float: left;
- width: 100%;
-}
-.get_those_nonnies form {
- float: left;
- width: 352px;
- padding: 15px 0 25px;
- position: relative;
-}
-.get_those_nonnies h1 {
- font-size: 21px;
- font-weight: normal;
- letter-spacing: 0px;
-}
-.get_those_nonnies .text {
- width: 312px;
- height: 37px;
- margin-bottom: 2px;
- padding: 0 35px 0 5px;
- border: none;
- font-size: 16px;
- background: transparent url() no-repeat -100px -50px;
-}
-.get_those_nonnies .submit {
- display: block;
- width: 34px;
- height: 34px;
- position: absolute;
- top: 17px;
- right: 5px;
- background: transparent url() no-repeat -462px -44px;
- border: none;
- cursor: pointer;
-}
-.get_those_nonnies .examples {
- float: left;
- width: 100%;
- padding-top: 3px;
- font-size: 12px;
- color: #888;
-}
-/* end */
-
-/* Results styling */
-.nonnie_results {
- float: left;
- width: 100%;
-}
-.nonnie_results ul {
- list-style: none outside none;
-}
-.nonnie_results li {
- float: left;
- width: 430px;
- height: 70px;
- margin: 0 10px 10px 0;
- padding: 12px;
- border: 1px solid #cbd4e5;
- background-color: #fff;
-}
-.nonnie_results li input {
- float: left;
- margin: 27px 10px 27px 0;
-}
-.nonnie_results li label {
- display: table;
- float: left;
- width: 395px;
- height: 70px;
- overflow: hidden;
-}
-.nonnie_results label img {
- display: table-cell;
- vertical-align: middle;
-}
-.nonnie_results li span {
- width: 306px;
- display: table-cell;
- vertical-align: middle;
- line-height: 20px;
- color: #888;
- *float: left;
- *width: 290px;
- *padding-top: 10px;
-}
-.nonnie_results li span.img_holder {
- width: 100px;
-}
-.nonnie_results li span strong {
- font-size: 14px;
- font-weight: bold;
- color: #222;
-}
-.nonnie_results .submit {
- float: left;
- width: 100%;
- position: relative;
-}
-.nonnie_results .submit input,
-.nonnie_results .submit a {
- display: block;
- float: right;
- width: 141px;
- height: 40px;
- position: relative;
- background: transparent url() no-repeat left -129px;
- text-indent: -5000px;
- outline: none;
- z-index: 20;
-}
-.nonnie_results .submit a {
- left: 1px;
- bottom: 1px;
-}
-.nonnie_results .submit a:hover {
- background-position: left -213px;
-}
-.nonnie_results .submit a:active {
- background-position: left -256px;
-}
-.nonnie_results .submit a.disabled:hover,
-.nonnie_results .submit a.disabled:active,
-.nonnie_results .submit a.disabled {
- background-position: left -170px;
-}
-.nonnie_results .submit input {
- width: 1px;
- height: 1px;
- position: absolute;
- right: 8px;
- z-index: 19;
-}
-/* end */
-/* Image styles */
-.head .logo,
-.get_those_nonnies .text,
-.get_those_nonnies .submit,
-.nonnie_results .submit a {
- background-image: url(
- <%= image_path('facebook/fanpage/fanpage_sprite.png') %>
- );
-}
-/* end */
diff --git a/app/views/fb/styles/fanpage/fanpage.css b/app/views/fb/styles/fanpage/fanpage.css
deleted file mode 100644
index 3d32bfd..0000000
--- a/app/views/fb/styles/fanpage/fanpage.css
+++ /dev/null
@@ -1,515 +0,0 @@
-.causes_head,
-.causes_body .logo,
-.causes_head .head_edit,
-.general_campaign .verified,
-.contribute_buttons,
-.contribute_buttons a,
-.contribute_buttons_small a,
-.birthday_wish .birthday_cake,
-.birthday_wish a,
-.progress_bar_bg,
-.progress_bar_bg span,
-.progress_bar_bg span.arrow,
-.whatchyouwannagive .top,
-.whatchyouwannagive .btm,
-.whatchyouwannagive .don_btn,
-a .arrow,
-.unset a {
- background-image: url(
- <%= image_path("facebook/fanpage/fanpage_sprite.png") %>
- );
-}
-.causes_head {
- float: left;
- width: 518px;
- height: 38px;
- position: relative;
-}
-.causes_head .logo_bro {
- display: block;
- width: 73px;
- height: 16px;
- position: absolute;
- top: 12px;
- left: 13px;
- text-indent: -5000px;
-}
-.causes_head .head_edit {
- display: block;
- width: 49px;
- height: 25px;
- position: absolute;
- right: 0px;
- top: 7px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -556px -40px;
- text-indent: -5000px;
-}
-.causes_head span {
- position: absolute;
- top: 13px;
- left: 100px;
- color: #FFF;
- text-transform: uppercase;
-}
-.causes_body {
- float: left;
- width: 394px;
- padding: 20px 8px 20px 116px;
- position: relative;
- background-color: #f2f3f7;
- font-family: "Lucida Grande", verdana, sans-serif;
- color: #222;
-}
-.causes_body.general_campaign,
-.causes_body.specific_campaign {
- width: 490px;
- padding-left: 14px;
- padding-right: 14px;
-}
-.causes_body .logo {
- display: block;
- width: 89px;
- height: 89px;
- position: absolute;
- top: 20px;
- left: 16px;
- background-position: left -38px;
- background-repeat: no-repeat;
- background-color: transparent;
-}
-.causes_body h1 {
- font-size: 22px;
- font-weight: bold;
-}
-.causes_body p {
- font-size: 12px;
- line-height: 18px;
-}
-a .arrow {
- display: block;
- float: left;
- width: 12px;
- height: 13px;
- background-repeat: no-repeat;
- background-color: transparent;
- background-position: -594px 4px;
-}
-.unset {
- float: left;
- width: 491px;
- margin-bottom: 10px;
- padding: 15px 12px;
- border: 1px solid #ffd963;
- position: relative;
- background-color: #fdfac2;
-}
-.unset p {
- float: left;
- margin: 10px 0 0;
- font: normal 15px "Lucida Grande", tahoma, verdana, sans-serif;
- color: #000;
-}
-.unset a {
- display: block;
- float: right;
- width: 139px;
- height: 39px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -147px -129px;
- text-indent: -5000px;
- outline: none;
-}
-.unset a:hover {
- background-position: -147px -171px;
-}
-.unset a:active {
- background-position: -147px -213px;
-}
-/* General campaign styling */
-.general_campaign *,
-.specific_campaign * {
- margin: 0;
- font-size: 12px;
- color: #222;
-}
-.specific_campaign a,
-.general_campaign a {
- color: #3c5897;
-}
-.general_campaign h1,
-.general_campaign p,
-.specific_campaign h1,
-.specific_campaign p { padding-bottom: 5px; }
-.general_campaign .verified {
- padding-left: 20px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -583px -70px;
-}
-.desc {
- float: left;
- padding: 10px 0 15px 110px;
- position: relative;
-}
-.desc.no_photo { padding-left: 0px; }
-.desc .img_holder {
- width: 100px;
- position: absolute;
- left: 0px;
-}
-.desc.no_photo .img_holder { display: none; }
-.desc p a { color: #3c5897; }
-.contribute_buttons {
- float: left;
- width: 466px;
- height: 58px;
- padding: 17px 15px 13px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: left -300px;
-}
-
-.contribute_buttons a {
- display: block;
- float: left;
- width: 217px;
- height: 52px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -293px -130px;
- text-indent: -5000px;
- outline: none;
-}
-.contribute_buttons a:hover {
- background-position: -293px -184px;
-}
-.contribute_buttons a:active {
- background-position: -293px -238px;
-}
-
-.contribute_buttons a.share_btn {
- float: right;
- background-position: left -390px;
-}
-.contribute_buttons a.share_btn:hover {
- background-position: left -450px;
-}
-.contribute_buttons a.share_btn:active {
- background-position: left -510px;
-}
-.birthday_wish {
- float: left;
- margin-top: 20px;
- padding: 20px 10px 10px 100px;
- border-top: 1px solid #cbcbcf;
- position: relative;
-}
-.birthday_wish .birthday_cake {
- width: 67px;
- height: 72px;
- position: absolute;
- left: 15px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -533px -130px;
-}
-
-.birthday_wish p {
- padding-top: 10px;
- font: bold 14px 'Lucida Grande', tahoma, verdana, sans-serif;
- color: #030303;
- line-height: 20px;
-}
-
-.birthday_wish p a {
- font-size: 12px;
- color: #3d5898;
- padding-left: 15px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -592px 3px;
-}
-/* end */
-
-/* Specific campaign styling */
-.specific_campaign .operated_by {
- font-size: 11px;
-}
-
-.media_viewer {
- float: left;
- width: 100%;
- margin-bottom: 5px;
- border: 1px solid #a3a4a7;
- text-align: center;
- overflow: hidden;
-}
-
-.media_viewer span {
- display: none;
-}
-
-.media_viewer .selected {
- display: block;
-}
-
-.media_viewer img {
- padding-top: 2px;
-}
-
-.media_options {
- float: left;
- width: 100%;
-}
-
-.media_options li {
- float: left;
- height: 31px;
- margin-right: 5px;
-}
-
-.media_options li.selected {
- border: 2px solid #6379ad;
-}
-.media_options li img {
- width: 29px;
- height: 29px;
-}
-.specific_campaign .desc {
- padding-left: 0px;
-}
-.progress_bar {
- float: left;
- width: 510px;
- height: 16px;
- margin: 40px 0 10px;
- padding: 20px 0 10px;
- position: relative;
-}
-.progress_bar p {
- position: absolute;
- top: 18px;
- right: 23px;
- font: bold 16px 'Lucida Grande', verdana, sans-serif;
- color: #444;
- text-transform: uppercase;
-}
-.progress_bar p.project_goal {
- font-size: 12px;
- top: 21px;
- left: 0px;
-}
-.progress_bar .progress_bar_bg {
- width: 394px;
- height: 23px;
- position: absolute;
- top: 17px;
- left: 40px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -160px -600px;
-}
-.progress_bar_bg p.progress {
- width: 100px;
- height: 10px;
- position: absolute;
- top: 3px;
- left: 4px;
- background-color: #ff120b;
-}
-.progress_bar_bg span {
- display: block;
- width: 112px;
- height: 18px;
- padding: 8px 5px;
- position: absolute;
- top: -43px;
- left: 32px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -160px -630px;
- font: 200 16px 'Lucida Grande', verdana, sans-serif;
- color: #FFF;
- text-align: center;
- text-transform: none;
-}
-.progress_bar_bg span.arrow {
- display: block;
- width: 17px;
- height: 9px;
- padding: 0;
- position: absolute;
- top: 32px;
- left: 53px;
- background-position: -584px -90px;
- background-repeat: no-repeat;
- background-color: transparent;
-}
-.whatchyouwannagive {
- float: left;
- width: 453px;
- margin-top: 20px;
- padding: 10px 20px;
- position: relative;
- left: -2px;
- border: 1px solid #cbd4e5;
- background-color: #FFF;
-}
-.whatchyouwannagive .top,
-.whatchyouwannagive .btm {
- width: 496px;
- height: 6px;
- position: absolute;
- bottom: -6px;
- left: -1px;
- background-position: left -580px;
- background-repeat: no-repeat;
- background-color: transparent;
-}
-.whatchyouwannagive .top {
- top: -5px;
- background-position: left -570px;
-}
-.whatchyouwannagive h4 {
- padding-bottom: 12px;
-}
-.whatchyouwannagive li {
- float: left;
- width: 430px;
- height: 70px;
- padding: 7px 10px 4px;
- border-top: 1px dashed #DDD;
-}
-.whatchyouwannagive .don_the_img {
- display: block;
- float: left;
- width: 56px;
- height: 56px;
- position: relative;
- border: 4px solid #e5e9f2;
- overflow: hidden;
-}
-.whatchyouwannagive .don_the_img img {
- float: left;
- margin-bottom: 0px;
- padding-bottom: 0px;
-}
-.whatchyouwannagive .don_the_img span {
- padding: 2px 4px;
- position: absolute;
- background-color: #f7ea15;
- font-weight: bold;
- font-size: 11px;
- color: #000;
-}
-.whatchyouwannagive .dochoi_title {
- display: table-cell;
- float: left;
- width: 225px;
- height: 60px;
- padding: 16px 0 0 15px;
- vertical-align: middle;
- font-weight: bold;
- font-size: 11px;
- line-height: 16px;
-}
-.whatchyouwannagive .don_btn {
- display: block;
- float: right;
- width: 111px;
- height: 18px;
- margin-top: 17px;
- padding: 9px 0;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -230px -390px;
- font: bold 15px 'Helvetica', sans-serif;
- color: #FFF;
- text-align: center;
- text-decoration: none;
-}
-.whatchyouwannagive .don_btn:hover {
- background-position: -230px -430px;
-}
-.whatchyouwannagive .don_btn:active {
- background-position: -230px -470px;
-}
-.contribute_buttons_small {
- float: left;
- width: 325px;
- padding: 30px 15px 13px 85px;
-}
-
-.contribute_buttons_small a {
- display: block;
- float: left;
- width: 152px;
- height: 52px;
- background-color: transparent;
- background-repeat: no-repeat;
- background-position: -350px -391px;
- text-indent: -5000px;
- outline: none;
-}
-.contribute_buttons_small a:hover {
- background-position: -351px -452px;
-}
-.contribute_buttons_small a:active {
- background-position: -351px -511px;
-}
-
-.contribute_buttons_small a.share_btn {
- float: right;
- background-position: left -601px;
-}
-.contribute_buttons_small a.share_btn:hover {
- background-position: left -661px;
-}
-.contribute_buttons_small a.share_btn:active {
- background-position: left -721px;
-}
-.donorz {
- float: left;
- width: 100%;
- padding-top: 10px;
-}
-
-.donorz ul {
- float: left;
- padding-top: 10px;
-}
-
-.donorz li {
- float: left;
- width: 55px;
- height: 90px;
- padding-right: 6px;
- position: relative;
-}
-
-.donorz li .amount {
- display: block;
- float: left;
- padding: 3px 1px;
- border: 1px solid #FFF;
- position: absolute;
- top: 0px;
- left: 0px;
- background-color: #6eae02;
- font-weight: bold;
- font-size: 9px;
- color: #FFF;
-}
-.donorz li a,
-.donorz li a span {
- font-size: 9px;
- color: #3c5897;
-}
-.donorz li a img {
- width: 50px;
- height: 50px;
-}
-/* end */
diff --git a/config/routes.rb b/config/routes.rb
index 14a7217..f90a802 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -549,10 +549,7 @@ ActionController::Routing::Routes.draw do |map|
m.asym_resources :privacy
m.asym_resources :profile,
:collection => {
- :tab => {},
- :edit_tab => {:generation => SITE_FB_COMBO},
- :submit_tab => {:generation => SITE_FB_COMBO},
- :ajax_search => {:generation => SITE_FB_COMBO}
+ :tab => {}
}
m.asym_resources :promotion_preferences,
:collection => {
diff --git a/db/migrate/20110420232047_create_fanpage_preferences_table.rb b/db/migrate/20110420232047_create_fanpage_preferences_table.rb
deleted file mode 100644
index 0e91b40..0000000
--- a/db/migrate/20110420232047_create_fanpage_preferences_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateFanpagePreferencesTable < ActiveRecord::Migration
- def self.up
- create_table :fb_page_preferences do |t|
- t.column :page_id, :bigint
- t.integer :beneficiary_id
- t.integer :campaign_id
- end
-
- add_index :fb_page_preferences, [:page_id], :unique => true
- end
-
- def self.down
- drop_table :fb_page_preferences
- end
-end
diff --git a/db/migrate/20110426201659_create_user_trackings.rb b/db/migrate/20110426201659_create_user_trackings.rb
new file mode 100644
index 0000000..565aca2
--- /dev/null
+++ b/db/migrate/20110426201659_create_user_trackings.rb
@@ -0,0 +1,25 @@
+class CreateUserTrackings < ActiveRecord::Migration
+ def self.up
+ create_table :user_trackings do |t|
+ t.column :user_id, :integer
+
+ t.column :source_id, :integer
+ t.column :source_type, :string
+
+ t.column :target_id, :integer
+ t.column :target_type, :string
+
+ t.column :message, :string
+
+ t.datetime :created_at
+ end
+
+ add_index :user_trackings, :user_id
+ add_index :user_trackings, [:source_id, :source_type]
+ add_index :user_trackings, :target_type
+ end
+
+ def self.down
+ drop_table :user_trackings
+ end
+end
diff --git a/db/migrate/20110427184234_user_tracking_tags.rb b/db/migrate/20110427184234_user_tracking_tags.rb
new file mode 100644
index 0000000..b7aa2ad
--- /dev/null
+++ b/db/migrate/20110427184234_user_tracking_tags.rb
@@ -0,0 +1,9 @@
+class UserTrackingTags < ActiveRecord::Migration
+ def self.up
+ add_column :user_trackings, :tags, :string
+ end
+
+ def self.down
+ remove_column :user_trackings, :tags
+ end
+end
diff --git a/lib/critsend.rb b/lib/critsend.rb
index 4674cad..de7073d 100644
--- a/lib/critsend.rb
+++ b/lib/critsend.rb
@@ -3,16 +3,15 @@ require 'json'
class Critsend
SOAPACTION = 'http://mxmaster.net/campaign/0.1#doCampaign'
USER = 'ops@causes.com'
- #USER = 'preprod@mxm'
+ PERF_USER = 'preprod@mxm'
KEY = 'MU*0RpN2RU/ySf2QCe'
- #KEY = '1tD1=Rsr5aiWNWGizof'
+ PERF_KEY = '1tD1=Rsr5aiWNWGizof'
HOST = 'mail6.messaging-master.com'
FASTHOST = 'fast.critsend.com'
SUCCESS_REGEXP = /<return xsi:type="xsd:boolean">true<\/return>/
- SUBSCRIBER_SEGMENT_SIZE = 300
+ SUBSCRIBER_SEGMENT_SIZE = 250
CONCURRENCY_LIMIT = 250
- #HOSTS = %w(3 4 5 10 12 13 14 15 17 22 23 24 26 27 29 30 31 32 33 34 35 36 37 38 39 40).map do |nr|
- HOSTS = %w(3 4 5 12 13 14 15 17 22 23 24 26 27 29 30 31 32 33 34 35 36 37 38 39 40).map do |nr|
+ HOSTS = %w(3 4 5 10 12 13 14 15 17 22 23 24 26 27 29 30 31 32 33 34 35 36 37 38 39 40).map do |nr|
"http://mail#{nr}.messaging-master.com/api_2.php"
end
@@ -72,9 +71,10 @@ class Critsend
end
def self.build_content_node(content)
- "<content><subject>#{CGI.escapeHTML(content[:subject])}</subject>" <<
- "<html>#{CGI.escapeHTML(content[:html])}</html>" <<
- "<text>#{CGI.escapeHTML(content[:text])}</text></content>"
+ content.keys.each {|key| content[key] = CGI.escapeHTML(content[key])}
+ "<content><subject>#{content[:subject]}</subject>" <<
+ "<html>#{content[:html]}</html>" <<
+ "<text>#{content[:text]}</text></content>"
end
def self.construct_request(payload)
@@ -92,15 +92,13 @@ class Critsend
:api_action => 'sendCampaign',
:payload => payload
}
- view.render(:file => 'critsend/critsend_envelope.xml.erb', :locals => params).split("\n").join
+ view.render(:file => 'critsend/critsend_envelope.xml.erb', :locals => params)
end
def self.em_send_campaign(subscribers_filename, parameters, content)
@errbacks, @errors, @successes = 0, 0, 0
@parameters, @content = parameters, content
@logfile = File.new("em_send_campaign-#{Time.now.to_i}.log", "w")
- @request_logfile = File.new("em_send_campaign-request-#{Time.now.to_i}.log", "w")
- @errback_logfile = File.new("em_send_campaign-errback-#{Time.now.to_i}.log", "w")
@work_queue = Queue.new
File.new(subscribers_filename).each {|line| @work_queue << JSON.parse(line)}
@@ -143,7 +141,6 @@ class Critsend
puts "Retrying failed request"
end
- @request_logfile.puts(request)
http = send_request(request)
http.callback do
@@ -159,11 +156,11 @@ class Critsend
@current_calls += 1
end
http.errback do
- # according to Nico, these are actually succeeding
@current_calls -= 1
@errbacks += 1
- @errback_logfile.puts(http.options[:head]['X-Throwaway'])
- make_request
+ request = http.options[:body]
+ puts "Request failed, re-submitting"
+ make_request request
@current_calls += 1
EM.stop if @current_calls == 0
end
@@ -172,14 +169,12 @@ class Critsend
def self.send_request(request)
soap_url = HOSTS[rand(HOSTS.length)-1]
EM::HttpRequest.new(soap_url).post(
- :inactivity_timeout => 240,
:body => request,
:head => {
'Soapaction' => "\"#{SOAPACTION}\"",
'Accept-Encoding' => 'identity',
'User-Agent' => 'Python-urllib/2.6',
'Connection' => 'close',
- 'X-Throwaway' => soap_url,
'Content-Type' => 'text/xml; charset=utf-8'
}
)
diff --git a/lib/guidestar.rb b/lib/guidestar.rb
index a6f88fa..54d92ee 100644
--- a/lib/guidestar.rb
+++ b/lib/guidestar.rb
@@ -57,7 +57,7 @@ module GuideStar
return [[], 0] if keyword.blank?
offset = page_size * (page.to_i - 1)
- query({:keyword => keyword, :basic => true, :page_size => page_size}, offset)
+ query({:keyword => keyword, :basic => true}, offset)
end
def search_without_restrictions(keyword, page, page_size = PAGE_SIZE)
diff --git a/public/images/facebook/fanpage/fanpage_sprite.png b/public/images/facebook/fanpage/fanpage_sprite.png
deleted file mode 100644
index 0e83ce2..0000000
Binary files a/public/images/facebook/fanpage/fanpage_sprite.png and /dev/null differ
diff --git a/public/images/facebook/fanpage/nofind.jpg b/public/images/facebook/fanpage/nofind.jpg
deleted file mode 100644
index e2ee4b9..0000000
Binary files a/public/images/facebook/fanpage/nofind.jpg and /dev/null differ
diff --git a/public/images/facebook/fanpage/result_fpo.png b/public/images/facebook/fanpage/result_fpo.png
deleted file mode 100644
index d7e584f..0000000
Binary files a/public/images/facebook/fanpage/result_fpo.png and /dev/null differ
diff --git a/public/images/facebook/fanpage/video_overlay.gif b/public/images/facebook/fanpage/video_overlay.gif
deleted file mode 100644
index abe0326..0000000
Binary files a/public/images/facebook/fanpage/video_overlay.gif and /dev/null differ
diff --git a/public/stylesheets/fanpage/global.css b/public/stylesheets/fanpage/global.css
deleted file mode 100644
index f354f4c..0000000
--- a/public/stylesheets/fanpage/global.css
+++ /dev/null
@@ -1,227 +0,0 @@
-.searcher {
- width: 931px;
- padding: 60px 10px 15px 15px;
- position: relative;
- border-radius: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- background-color: #f2f3f7;
- font: normal 12px "Lucida Grande", tahoma, verdana, sans-serif;
- color: #222;
-}
-
-.searcher .head {
- display: block;
- width: 848px;
- height: 16px;
- padding: 13px 15px 11px 93px;
- position: absolute;
- top: 0px;
- left: 0px;
- border-radius: 5px 5px 0 0;
- -webkit-border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0px;
- background-color: #62be3e;
-}
-
-.head .logo {
- display: block;
- width: 78px;
- height: 22px;
- position: absolute;
- top: 9px;
- left: 12px;
- background: transparent url() no-repeat -10px -10px;
- text-indent: -5000px;
- outline: none;
-}
-
-.head p {
- float: right;
- color: #FFF;
-}
-
-.head .sthupport {
- float: left;
- font-size: 11px;
- text-transform: uppercase;
-}
-
-/* Search form styling */
-.get_those_nonnies {
- float: left;
- width: 100%;
-}
-.get_those_nonnies form {
- float: left;
- width: 352px;
- padding: 15px 0 25px;
- position: relative;
-}
-
-.get_those_nonnies h1 {
- font-size: 21px;
- font-weight: normal;
- letter-spacing: 0px;
-}
-
-.get_those_nonnies .text {
- width: 312px;
- height: 37px;
- margin-bottom: 2px;
- padding: 0 35px 0 5px;
- border: none;
- font-size: 16px;
- background: transparent url() no-repeat -100px -50px;
-}
-
-.get_those_nonnies .submit {
- display: block;
- width: 34px;
- height: 34px;
- position: absolute;
- top: 17px;
- right: 5px;
- background: transparent url() no-repeat -462px -44px;
- border: none;
- cursor: pointer;
-}
-
-.get_those_nonnies .examples {
- float: left;
- width: 100%;
- padding-top: 3px;
- font-size: 12px;
- color: #888;
-}
-
-/* end */
-
-/* Results styling */
-.nonnie_results {
- float: left;
- width: 100%;
-}
-
-.nonnie_results ul {
- list-style: none outside none;
-}
-
-.nonnie_results li {
- float: left;
- width: 430px;
- height: 70px;
- margin: 0 10px 10px 0;
- padding: 12px;
- border: 1px solid #cbd4e5;
- background-color: #fff;
-}
-
-.nonnie_results li.even {
- margin-right: 0px;
-}
-
-.nonnie_results li input {
- float: left;
- margin: 27px 10px 27px 0;
-}
-
-.nonnie_results li label {
- display: table;
- float: left;
- width: 395px;
- height: 70px;
- overflow: hidden;
-}
-
-.nonnie_results label img {
- display: table-cell;
- vertical-align: middle;
-}
-
-.nonnie_results li span {
- width: 306px;
- display: table-cell;
- vertical-align: middle;
- line-height: 20px;
- color: #888;
- *float: left;
- *width: 290px;
- *padding-top: 10px;
-}
-
-.nonnie_results li span.img_holder {
- width: 100px;
-}
-
-.nonnie_results li span strong {
- font-size: 14px;
- font-weight: bold;
- color: #222;
-}
-
-.nonnie_results .submit {
- float: left;
- width: 100%;
- position: relative;
-}
-
-.nonnie_results .submit input,
-.nonnie_results .submit a {
- display: block;
- float: right;
- width: 141px;
- height: 40px;
- position: relative;
- background: transparent url() no-repeat left -129px;
- text-indent: -5000px;
- outline: none;
- z-index: 20;
-}
-
-.nonnie_results .submit a {
- left: 1px;
- bottom: 1px;
-}
-
-.nonnie_results .submit a:hover {
- background-position: left -213px;
-}
-.nonnie_results .submit a:active {
- background-position: left -256px;
-}
-.nonnie_results .submit a.disabled:hover,
-.nonnie_results .submit a.disabled:active,
-.nonnie_results .submit a.disabled {
- background-position: left -170px;
-}
-.nonnie_results .submit input {
- width: 1px;
- height: 1px;
- position: absolute;
- right: 8px;
- z-index: 19;
-}
-
-.show_more_nonnies {
- float: left;
- height: 22px;
- width: 100%;
- outline: none;
-}
-
-.waiting_for_nonnies {
- display: none;
- float: left;
- height: 22px;
- width: 100%;
-}
-
-.nonnie_spinnin {
- width: 20px;
-}
-.no_results h1 {
- padding-bottom: 5px;
- font-size: 44px;
-}
-/* end */
diff --git a/test/functional/controllers/earn_controller_testspec.rb b/test/functional/controllers/earn_controller_testspec.rb
index 94793f8..df98f34 100644
--- a/test/functional/controllers/earn_controller_testspec.rb
+++ b/test/functional/controllers/earn_controller_testspec.rb
@@ -67,6 +67,61 @@ context "The earn controller" do
cause.destroy
end
+ specify "should track the user" do
+ Cacher.cache = CACHE
+
+ advertiser = a.EarnAdvertiser.appears
+ advertiser.name = "Supersonic"
+ advertiser.save
+
+ user = a.User.appears
+ cause = a.Cause.appears
+
+ advertiser = EarnAdvertiser.const_get(advertiser.name).find(advertiser.id)
+
+ params = {
+ "activity_id" => "11",
+ "campaign_id" => cause.current_fundraising_campaign.id.to_s,
+ "cause_id" => cause.id.to_s,
+ "network_user_id" => user.anonymous_id,
+ "partner_key" => advertiser.partner_key,
+ "revenue" => "0.077"
+ }
+
+ sig = advertiser.generate_callback_sig(params)
+ params[:sig] = sig
+
+ UserTracking.track!(user.id,
+ :source_type => "Foo",
+ :source_id => 15)
+
+ assert_difference("UserTracking.count") do
+ assert_difference('EngagementCredit.count') do
+ post :credit_callback, params
+ end
+ end
+
+ ec = EngagementCredit.last
+ log_entry = EarnCallbackLog.last
+ ec.funded_by.should == cause
+ ec.campaign.should == cause.current_fundraising_campaign
+ log_entry.response_code.should == "200"
+ log_entry.network_user_id.should == user.anonymous_id
+ assert_response 200
+
+ advertiser.destroy
+ user.destroy
+ cause.destroy
+
+ track = UserTracking.last
+ track.target.should == ec
+ track.source_id.should == 15
+ track.source_type.should == "Foo"
+ track.user_id.should == user.id
+
+ Cacher.cache = nil
+ end
+
# TODO test that invalid signatures are thrown out
specify "should update tracking counters" do
@@ -80,9 +135,9 @@ context "The earn controller" do
old_value = engagement.send(counter)
post :track_engagement_counter, {
- :advertiser_id => advertiser.id,
- :counter => counter,
- :engagement_id => engagement.engagement_id
+ :advertiser_id => advertiser.id,
+ :counter => counter,
+ :engagement_id => engagement.engagement_id
}
engagement.reload
diff --git a/test/functional/controllers/fb/donations_controller_testspec.rb b/test/functional/controllers/fb/donations_controller_testspec.rb
index f1f133c..c7940c7 100644
--- a/test/functional/controllers/fb/donations_controller_testspec.rb
+++ b/test/functional/controllers/fb/donations_controller_testspec.rb
@@ -279,6 +279,59 @@ context 'Submitting a donation form' do
:donation => {:beneficiary_id => Beneficiary.find(:first).id},
:credit_card => {:exp_month => 1}
end
+
+ specify "should track the user" do
+ Cacher.cache = CACHE
+ UserTracking.track!(@cause.creator_id,
+ :source_type => "Foo",
+ :source_id => 15)
+
+ assert_difference('UserTracking.count') do
+ post :create,
+ :cause_id => @cause.id,
+ :donation => {:donor_id => @cause.creator_id,
+ :beneficiary_id => Beneficiary.find(:first).id},
+ :email => @cause.creator.email,
+ :processor => "NFG",
+ :credit_card => {:exp_month => 1}
+ end
+
+ tracking = UserTracking.last
+
+ tracking.user.should == @cause.creator
+ tracking.source_id.should == 15
+ tracking.source_type.should == "Foo"
+ tracking.target.should == Donation.last
+ tracking.message.should == "donated"
+ Cacher.cache = nil
+ end
+
+ specify "should track the user with proper params" do
+ Cacher.cache = CACHE
+
+ # 2 because we also store when the user shows up the 1st time
+ assert_difference('UserTracking.count', 2) do
+ post :create,
+ :track => 1,
+ :track_source_type => "Foo",
+ :track_source_id => 15,
+ :cause_id => @cause.id,
+ :donation => {:donor_id => @cause.creator_id,
+ :beneficiary_id => Beneficiary.find(:first).id},
+ :email => @cause.creator.email,
+ :processor => "NFG",
+ :credit_card => {:exp_month => 1}
+ end
+
+ tracking = UserTracking.last
+
+ tracking.user.should == @cause.creator
+ tracking.source_id.should == 15
+ tracking.source_type.should == "Foo"
+ tracking.target.should == Donation.last
+ tracking.message.should == "donated"
+ Cacher.cache = nil
+ end
end
context 'Viewing donations/new without cause_id' do
diff --git a/test/functional/models/user_tracking_testspec.rb b/test/functional/models/user_tracking_testspec.rb
new file mode 100644
index 0000000..2c5e25d
--- /dev/null
+++ b/test/functional/models/user_tracking_testspec.rb
@@ -0,0 +1,105 @@
+require File.expand_path('../functional_test_helper', File.dirname(__FILE__))
+
+
+context "UserTracking email parsing" do
+ include ActionController::UrlWriter
+ setup do
+ @cause = a.Cause.exists
+ end
+
+ it "Should add proper tags in links" do
+ view = ActionView::Base.new(ActionController::Base.view_paths, {})
+
+ cause_url(@cause).should == "http://test.host/causes/#{@cause.id}"\
+ "-#{@cause.name.parameterize}"
+ UserTracking.track_mails
+ cause_url(@cause).should == "http://test.host/causes/#{@cause.id}"\
+ "-#{@cause.name.parameterize}?track=1"
+
+ UserTracking.track_mails(true,
+ :track_source_id => 14,
+ :track_user_type => "Fool")
+ cause_url(@cause).should == "http://test.host/causes/48-frofrank-"\
+ "cruthunt-fryfryza-shojestyng?track=1&track_source_id=14&"\
+ "track_user_type=Fool"
+ end
+end
+
+context "UserTracking" do
+ setup do
+ @user = a.User.exists
+ Cacher.cache = CACHE
+ UserTracking.stop_tracking!(@user.id)
+ end
+
+ specify "should not track" do
+ assert_no_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something")
+ end
+ end
+
+ specify "should track" do
+ UserTracking.track!(@user.id)
+ assert_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something")
+ end
+ end
+
+ specify "should track with source id" do
+ UserTracking.track!(@user.id,
+ :source_type => "Foo",
+ :source_id => 15)
+ assert_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something")
+ end
+
+ UserTracking.last.source_type.should == "Foo"
+ UserTracking.last.source_id.should == 15
+ end
+
+ specify "should track with source" do
+ UserTracking.track!(@user.id,
+ :source => @user)
+ assert_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something")
+ end
+
+ UserTracking.last.source.should == @user
+ end
+
+ specify "should track with source and target id" do
+ UserTracking.track!(@user.id,
+ :source => @user)
+ assert_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something",
+ :target_type => @user.class.name,
+ :target_id => @user.id)
+ end
+
+ UserTracking.last.source.should == @user
+ UserTracking.last.target.should == @user
+ end
+
+ specify "should track with source and target" do
+ UserTracking.track!(@user.id,
+ :source => @user)
+ assert_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something",
+ :target => @user)
+ end
+
+ UserTracking.last.source.should == @user
+ UserTracking.last.target.should == @user
+ end
+
+ specify "should not track after a while" do
+ UserTracking.track!(@user.id)
+ Time.warp(Time.now+24.hours) do
+ assert_no_difference('UserTracking.count') do
+ UserTracking.track(@user.id, "Tracking something")
+ end
+ end
+ Time.warp(nil)
+ end
+end
+
diff --git a/test/unit/models/earn_engagement_testspec.rb b/test/unit/models/earn_engagement_testspec.rb
index 5bda2d5..1e453a5 100644
--- a/test/unit/models/earn_engagement_testspec.rb
+++ b/test/unit/models/earn_engagement_testspec.rb
@@ -20,7 +20,7 @@ context "An earn engagement" do
value = @engagement.send(name)
EarnEngagement.increment_tracked_counter(name,
- @engagement.earn_advertiser_id, @engagement.engagement_id)
+ @engagement.earn_advertiser_id, @engagement.engagement_id)
@engagement.reload
@engagement.send(name).should == value + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment