Skip to content
Browse files

collapsible divs

  • Loading branch information...
1 parent 7cb17c1 commit 9c231fa4bd5951552ed6e99c57d1acb1fcedc182 Aashish Manchanda committed Jul 16, 2009
View
3 app/views/data_entries/_report_form.html.erb
@@ -1,4 +1,5 @@
-<% fields_for [report_form, @data_entry] do |f| %>
+
+<% fields_for @data_entry do |f| %>
<%= f.error_messages %>
<% report_form.data_type.data_fields.each do |field| %>
<% args = field.prepare_form_helpers %>
View
2 app/views/data_objects/_test.html.erb
@@ -1,6 +1,6 @@
<div style="width: 60%; float:left">
- <% form_for report_form do |f| %>
+ <% form_for test do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :data_type %><br />
View
17 app/views/reports/show.html.erb
@@ -1,5 +1,8 @@
+<% javascript 'jrails' %>
+
<% stylesheet 'report', 'notice' %>
<% title "Shift Report at the #{@report.shift.location.name}" %>
+
<fieldset>
<legend>Message Center</legend>
<%= render :partial => 'notices/notice', :collection => @report.get_notices %>
@@ -10,15 +13,21 @@
</fieldset>
</fieldset>
<p>
- <fieldset>
- <legend>Data Objects</legend>
- <%= render :partial => 'data_entries/report_form', :collection => @report.shift.location.data_objects %>
- </fieldset>
+ <span id="pref_link" class="dotted_link" style="display:none">
+ <%= link_toggle "data_form", "Show/Hide Data Objects", "fast" %>
+ </span>
</p>
+<div id = "data_form">
+<%= render :partial => 'data_entries/report_form', :collection => @report.shift.location.data_objects%>
+</div>
<% unless @report.departed || current_user!=@report.user %>
<%= render :partial => 'new_report_item_form' %>
<% end %>
<h2>Report:</h2>
</p>
<%= render :partial => 'report'%>
+<script type="text/javascript">
+$("#data_form").hide();
+ $("#pref_link").show();
+</script>

0 comments on commit 9c231fa

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