Skip to content

Commit

Permalink
Adding stand alone goal for hurricane sandy.
Browse files Browse the repository at this point in the history
  • Loading branch information
karledurante committed Nov 21, 2012
1 parent 5cf45a3 commit dd42350
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 7 deletions.
37 changes: 37 additions & 0 deletions app/assets/stylesheets/mini_goal.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@import "colors";

#mini-goal {
width: 460px;
height: 110px;

.goal {

margin: 10px 0;
padding: 24px 0 18px 0;
border-top: solid 1px $grey;
border-bottom: solid 1px $grey;

h1, h2 {
color: $black;
}

.sold {
float: left;
width: 230px;
}

.reset {
clear: both;
}

.em {
font-size: 20px;
}

.shirts_sold {
float: left;
width: 230px;
}

}
}
6 changes: 5 additions & 1 deletion app/controllers/goals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class GoalsController < ApplicationController
def edit
end

def show
render :layout => 'mini_goal'
end

def update
@goal.shirts_sold = params[:shirts_sold]
@goal.dollars_raised = params[:dollars_raised]
Expand All @@ -20,7 +24,7 @@ def update
def sms

shirts_sold = params[:Body].to_i
dollars_raised = shirts_sold * 25
dollars_raised = shirts_sold * 10

@goal.shirts_sold = shirts_sold
@goal.dollars_raised = dollars_raised
Expand Down
12 changes: 12 additions & 0 deletions app/views/goals/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="goal">
<div class="sold">
<h1><%= @goal.shirts_sold %></h1>
shirts sold
</div>

<div class="progress">
<h1>$<%= @goal.dollars_raised %></h1>
dollars raised
</div>
<div class="reset"></div>
</div>
10 changes: 5 additions & 5 deletions app/views/home/_goal.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div class="goal">
<div class="sold">
<h1><%= @goal.shirts_sold %></h1>
<h1>93</h1>
shirts sold
</div>

<div class="progress">
<h1>$<%= @goal.dollars_raised %></h1>
<h1>$2325</h1>
dollars raised
</div>

<div class="reset"></div>

<div class="meter">
<div class="fill" style="width:<%=@goal.shirts_sold_as_percentage%>%">&nbsp;</div>
<div class="fill" style="width:124%">&nbsp;</div>
</div>

<div class="shirts_sold">
<span class="em"><%= number_to_percentage(@goal.shirts_sold_as_percentage, :precision => 0)%></span> of <%= @goal.total_shirt_goal %> shirt goal
<span class="em">124%</span> of 75 shirt goal
</div>
<div class="days_to_go">
<span class="em"><%= @goal.days_left_in_campaign%></span> days to go
<span class="em">0</span> days to go
</div>
<div class="reset"></div>
</div>
39 changes: 39 additions & 0 deletions app/views/layouts/mini_goal.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>Goal</title>

<script type="text/javascript">
(function() {
var config = {
kitId: 'sog7buz',
scriptTimeout: 3000
};
var h=document.getElementsByTagName("html")[0];h.className+=" wf-loading";var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wf-loading(\s|$)/g," ");h.className+=" wf-inactive"},config.scriptTimeout);var tk=document.createElement("script"),d=false;tk.src='//use.typekit.net/'+config.kitId+'.js';tk.type="text/javascript";tk.async="true";tk.onload=tk.onreadystatechange=function(){var a=this.readyState;if(d||a&&a!="complete"&&a!="loaded")return;d=true;clearTimeout(t);try{Typekit.load(config)}catch(b){}};var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(tk,s)
})();
</script>

<%= stylesheet_link_tag "application", :media => "all" %>
<%= csrf_meta_tags %>

<!-- google analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35895415-1']);
_gaq.push(['_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>
</head>
<body>

<div id="mini-goal" class="content">
<%= yield %>
</div>

</body>
</html>
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

end

match '/special/guct' => 'home#guct'
match '/goal' => 'goals#show'

root :to => 'home#index'
end

0 comments on commit dd42350

Please sign in to comment.