Skip to content

Commit

Permalink
Merge branch 'master' of github.com:spot-us/spot-us
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenrabaino committed Jun 12, 2011
2 parents 9d069fe + 7656a4b commit ac89294
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 26 deletions.
17 changes: 6 additions & 11 deletions app/models/news_item.rb
Expand Up @@ -174,17 +174,16 @@ def excerpt?
return (self.short_description ? self.short_description : self.extended_description).to_s.strip_and_shorten
end


def validate
return valid_excerpt unless excerpt.blank?
return valid_description unless short_description.blank?
return true
end

def valid_excerpt
unless excerpt.blank?
excerpt_length = excerpt.strip_html.gsub(/\s+/, "").length
if excerpt_length<250 || excerpt_length>1000
errors.add("wrong_excerpt_length", "Your summary must be between 250 to 1000 characters")
def valid_description
unless short_description.blank?
description_length = short_description.strip_html.split(' ').length
if description_length > 600
errors.add("wrong_description_length", "Your pitch description can only be 600 words")
return false
else
return true
Expand All @@ -194,10 +193,6 @@ def valid_excerpt
end
end

# def network_id
# APP_CONFIG[:has_networks] ? network_id : 0 #APP_CONFIG[:all_network]
# end

# NOTE: You can chain scopes off of with_sort, but you can't chain with_sort off of scopes.
# Well, you can, but you will lose the previous scopes.
def self.with_sort(sort='desc')
Expand Down
24 changes: 24 additions & 0 deletions app/views/layouts/_google_analytics.html.erb
Expand Up @@ -7,3 +7,27 @@ try {
var pageTracker = _gat._getTracker("<%= APP_CONFIG[:google][:analytics_user_id] %>");
pageTracker._trackPageview();
} catch(err) {}</script>

<script type="text/javascript">
<!--//--><![CDATA[//><!-- "
var _gaq = _gaq || [];
_gaq.push(
["_setAccount", "<%= APP_CONFIG[:google][:analytics_user_id] %>"],
["_trackPageLoadTime"],
["_trackPageview"]
);

_gaq.push(
["inn._setAccount", "UA-17578670-2"],
["inn._setCustomVar", 1, "MemberName", "Spot.Us"],
["inn._trackPageview"]
);

(function() {
var ga = document.createElement("script");ga.type = "text/ javascript";ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google- analytics.com/ga.js";
var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);
})();

//--><!]]>
</script>
14 changes: 13 additions & 1 deletion app/views/myspot/purchases/_purchase_form.html.erb
Expand Up @@ -11,13 +11,15 @@
amount = parseFloat(jQuery(this).val())*fraction;
jQuery('#spotus_donation_amount_paypal').html('$ '+formatAsMoney(amount));
jQuery('#hidden_spotus_donation_amount_paypal').val(formatAsMoney(amount));
jQuery('#total_amount_paypal').html('$ ' + formatAsMoney(parseFloat(jQuery(this).val())+amount));
});

jQuery('#card_amount').change(function(){
fraction = parseFloat(<%=SpotusDonation::SPOTUS_TITHE%>)
amount = parseFloat(jQuery(this).val())*fraction;
jQuery('#spotus_donation_amount_card').html('$ '+formatAsMoney(amount));
jQuery('#hidden_spotus_donation_amount_card').val(formatAsMoney(amount));
jQuery('#total_amount_card').html('$ ' + formatAsMoney(parseFloat(jQuery(this).val())+amount));
});

});
Expand All @@ -42,6 +44,11 @@
<span id="spotus_donation_amount_card">$ <%=number_to_currency(@donation_amount*SpotusDonation::SPOTUS_TITHE, :unit => '')%></span>
<%= hidden_field_tag "spotus_donation_amount", number_to_currency(@donation_amount*SpotusDonation::SPOTUS_TITHE, :unit => ''), :size => 5, :id => "hidden_spotus_donation_amount_card" %>
</div>

<div class="row" style="font-size:16px">
<label>You Owe:</label>
<span id="total_amount_card">$ <%=number_to_currency(@donation_amount + @donation_amount*SpotusDonation::SPOTUS_TITHE, :unit => '')%></span>
</div>

<h3>Your Card Details</h3>
<% if @purchase && @purchase.errors.any? %>
Expand Down Expand Up @@ -152,14 +159,19 @@
<div class="row">
<%= hidden_field_tag "item_number_#{i}", "2-#{@pitch.id}-#{current_user.id}" %>
<%= hidden_field_tag "item_name_#{i}", "Support Spot.Us" %>
<%#= hidden_field_tag "amount_#{i}", @purchase.spotus_donation[:amount] %>
</div>
<div class="row">
<label for="<%="amount_#{i}"%>">Spot.Us Donation Amount</label>
<span id="spotus_donation_amount_paypal">$ <%=number_to_currency(@donation_amount*SpotusDonation::SPOTUS_TITHE, :unit => '')%></span>
<%= hidden_field_tag "amount_#{i}", number_to_currency(@donation_amount*SpotusDonation::SPOTUS_TITHE, :unit => ''), :size => 5, :id => "hidden_spotus_donation_amount_paypal" %>
</div>
<%# end %>

<div class="row" style="font-size:16px">
<label>You Owe:</label>
<span id="total_amount_paypal">$ <%=number_to_currency(@donation_amount + @donation_amount*SpotusDonation::SPOTUS_TITHE, :unit => '')%></span>
</div>

<div class="row">
<%= get_button("Pay with PayPal") %>
</div>
Expand Down
27 changes: 15 additions & 12 deletions app/views/pitches/_form.html.erb
Expand Up @@ -26,22 +26,24 @@
</span> <a href='#' rel='nofollow' id='hoverAnchorSlug'><img src='/images/new/help.png'></a>" %>
<%= f.text_field :slug %>
</div>
<div class="row">
<%= f.label :excerpt, "Short Description <span class='required'>
*
</span> <a href='#' rel='nofollow' id='hoverAnchorSummary'><img src='/images/new/help.png'></a>" %>
<%= ckeditor_textarea("pitch", "excerpt", :toolbar => 'Simple', :width => '450px', :height => '75px') %>
</div>
<%if false%>
<div class="row">
<%= f.label :excerpt, "Overview &amp; Elevator Pitch <span class='required'>
*
</span> <a href='#' rel='nofollow' id='hoverAnchorSummary'><img src='/images/new/help.png'></a>" %>
<%= ckeditor_textarea("pitch", "excerpt", :toolbar => 'Simple', :width => '450px', :height => '75px') %>
</div>
<%end%>
<div class="row">
<%= f.label :short_description, "Long Description <span class='required'>
*
</span> <a href='#' rel='nofollow' id='hoverAnchorShortDescription'><img src='/images/new/help.png'></a>" %>
<%= ckeditor_textarea("pitch", "short_description", :toolbar => 'Medium', :width => '450px', :height => '125px') %>
</div>
<% if APP_CONFIG[:has_networks] || (current_user && current_user.admin?)%>
<div class="row">
<%= render :partial => 'shared/network', :locals => {:f => f, :instance => @pitch} %>
</div>
<div class="row">
<%= render :partial => 'shared/network', :locals => {:f => f, :instance => @pitch} %>
</div>
<% end %>
<div class="row">
<%= f.label :topics, "Topics <span class='required'>
Expand Down Expand Up @@ -154,9 +156,10 @@
We will use this slug for all list views instead of the headline.
</ul>
<ul class='hoverContainer helper' id='hoverContainerSummary' style="display:none;">
<h3>Sell the story with a 1,000 character short description!</h3>
Why would someone care? What are the details? Be concise and sell the story.
We use this summary for the Summary page for all stories.
<h3>Sell the story with a 250 words overview!</h3>
Why would someone donate to see the final story? What are the details? Be concise and sell the story.
We use this summary for the Summary page for all pitches. Think like you are in a bar or cafe quickly
explaining your story. Make people excited to see your future story.
</ul>
<ul class='hoverContainer helper' id='hoverContainerShortDescription' style="display:none;">
<h3>Sell the story!</h3>
Expand Down
3 changes: 1 addition & 2 deletions app/views/pitches/tabs/_summary.html.erb
Expand Up @@ -14,8 +14,7 @@
</div>
<%end%>
<div class="shortDescription">
<%= @pitch.excerpt?.strip_double_spaces %>
<div class='readMore'><%=link_to "read more &rarr;", "#{pitch_path(@pitch)}/details", {:rel=>"nofollow", :title=>"read more"}%></div>
<%= @pitch.short_description %>
</div>
<% unless @pitch.extended_description.blank? %>
<div class="extendedDescription">
Expand Down

0 comments on commit ac89294

Please sign in to comment.