Permalink
Browse files

Took out all the pages that weren't working really.

  • Loading branch information...
1 parent 82a2c98 commit b47a340d10acd107c0814d85b859e601d832ba42 Jason Ardell committed Jun 18, 2010
@@ -16,6 +16,14 @@ def index
def show
@survey = Survey.find(:first, :conditions => { :owner_hash => params[:owner_hash] })
+ @chart = get_chart
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @survey }
+ end
+ end
+
+ def get_chart
# Create the google chart
datasets = []
colors = [ 'FFFF00', 'FF00FF', '00FFFF', 'FF0000', '00FF00', '0000FF' ]
@@ -46,32 +54,13 @@ def show
@chart.axis = axis
@chart.labels = labels
@chart.stripes = stripes
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @survey }
- end
+ @chart
end
def view
@survey = Survey.find(:first, :conditions => { :visitor_hash => params[:visitor_hash] })
- # Create the google chart
- datasets = []
- colors = [ 'FFFF00', 'FF00FF', '00FFFF', 'FF0000', '00FF00', '0000FF' ]
-
- @fields = get_fields
- @survey.submissions.each do |submission|
- submissionData = []
- @fields.each do |field|
- submissionData << submission[field[:name]]
- end
- datasets << (GoogleChartDataset.new :data => submissionData.reverse, :title => submission.name, :color => colors.pop)
- end
- data = GoogleChartData.new :datasets => datasets, :min => 0, :max => 10
- axis = GoogleChartAxis.new :axis => [GoogleChartAxis::LEFT, GoogleChartAxis::BOTTOM]
- @chart = GoogleLineChart.new :width => 400, :height => 300
- @chart.data = data
- @chart.axis = axis
+ @chart = get_chart
end
# GET /surveys/new
@@ -0,0 +1,3 @@
+<p>
+ <img src="<%= @chart.to_url %>" />
+</p>
@@ -11,8 +11,10 @@
<td><%= time_ago_in_words survey.created_at %> ago</td>
<td><%=h survey.group %></td>
<td><a href="/surveys/<%=h survey.owner_hash %>/show">Show</a></td>
+ <!--
<td><a href="/surveys/<%=h survey.owner_hash %>/edit">Edit</a></td>
- <td><%= link_to 'Delete', { :controller => 'surveys', :action => 'destroy', :owner_hash => survey.owner_hash }, :confirm => 'Are you sure?', :method => :delete %></td>
+ <td><%= link_to 'Delete', { :controller => 'surveys', :action => 'destroy', :owner_hash => survey.owner_hash }, :confirm => 'Are you sure?', :method => :delete %></td>
+ -->
</tr>
<% end %>
</table>
@@ -3,7 +3,7 @@
<%=h @survey.group %>
</p>
-<img src="<%= @chart.to_url %>" />
+<%= render(:partial => 'chart') %>
<p>This survey has <%= @survey.submissions.size %> submissions:</p>
@@ -18,5 +18,7 @@
<p><a href="/submissions/<%=h @survey.visitor_hash %>/new">Take this survey</a></p>
<!-- <p><%= link_to 'Email this survey', { :controller => 'survey', :action => 'email', :visitor_hash => @survey.owner_hash } %></p> -->
+<!--
<a href="/surveys/<%=h @survey.owner_hash %>/edit">Edit</a> |
-<%= link_to 'Back', surveys_path %>
+-->
+<%= link_to 'Back', surveys_path %>
@@ -1,7 +1,5 @@
<h1><%=h @survey.group %></h1>
-<p>
- <img src="<%= @chart.to_url %>" />
-</p>
+<%= render(:partial => 'chart') %>
<%= link_to 'Back', surveys_path %>

0 comments on commit b47a340

Please sign in to comment.