added pagination gem, many fixes
[smr.git] / gui / app / views / quoterecords / index.html.erb
blob573d113d57fb2cb2983a8cdb0f95ac672c412696
1 <h1>Quote Records</h1>
3 <%= form_tag({:action=>'index'}, method: :get) do %>
4     <p>
5      <%= select_tag 'id_stock', options_from_collection_for_select(@securities, "id", "name", @selected_security.id), prompt: '-- Select Security --' %>
6      <%= button_tag 'show', :name=>'show', :value=>'this' %>
7      <%= button_tag '<= previous', :name=>'show', :value=>'previous' %>
8      <%= button_tag 'next =>', :name=>'show', :value=>'next' %>
9     </p>
10 <% end %>
12 <% if not @intraday_quotes.empty? %>
13 <h2>Observations
14 <em>intraday quotes in contrast to previous records</em></h2>
15 <table border>
16   <% @intraday_quotes.each do |q| %>
17     <tr>
18         <td><b><%= q.quote %></b> at <%= q.time %></td>
19         <td>
20           <% msg, newqr = @quoterecords.inspect_quote(q) %>
21           <% if not msg.empty? %>
22             <span><%= msg %></span>
23           <% end %> 
24           <%= form_for newqr, url: {action: "create"} do |f| %>
25               <%= f.hidden_field :id_stock %>
26               <%= f.hidden_field :id_quote %>
27               <%= f.select :column, Quoterecord.new.get_columns, :prompt=>'-- Select Column --' %>
28               <%= f.text_field :comment, placeholder: 'Comment' %>
29               <%= f.check_box :is_pivotal_point %><%= f.label :is_pivotal_point, 'Pivotal Point' %>
30               <%= f.check_box :is_uphit %><%= f.label :is_uphit, 'UP hit' %>
31               <%= f.check_box :is_downhit %><%= f.label :is_downhit, 'DOWN hit' %>
32               <%= f.check_box :is_signal %><%= f.label :is_signal, 'Signal' %>
33               <%= f.submit 'record this one' %>
34           <% end %>
35         </td>
36     </tr>
37   <% end %>
38 </table>
39 <% end %>
41 <% if not @quoterecords.empty? %>
42 <h2>Previous Records</h2>
44 <table>
45     <thead>
46         <tr>
47             <th><%= paginate @quoterecords %></th>
48           <% @quoterecords.get_columns.each do |c| %>
49             <th><%= @quoterecords.translate_column(c) %></th>
50           <% end %>
51         </tr>
52         <tr>
53             <td></td>
54           <% @quoterecords.get_columns.each do |c| %>
55             <th><%= @quoterecords.get_pivot_point(c) %></th>
56           <% end %>
57         </tr>
58     </thead>
59     <tbody>
60      <% @quoterecords.each do |qr| %>
61         <tr>
62             <td><%=link_to '+', qr %> <%=smr_humanize(qr.time_created)%> <em><%= qr.comment %></em></td>
63           <% @quoterecords.get_columns.each do |c| %>
64             <td><%= qr.Quote.quote if qr.is_column?(c) %></td>
65           <% end %>
66         </tr>
67      <% end %>
68     </tbody>
69 </table>
70 <% end %>
72 <h2>Sensitivity Settings</h2>
73 <%= form_for @sensitivity, :url=>{controller: :quoterecord_threshold, action: :create}, :method=>:POST do |f| %>
74 <fieldset id='quoterecord_sensitivity'>
75   <legend>adjust when UP/DOWN or Pivot Point hits are triggered</legend>
76     <%= hidden_field_tag :id, @sensitivity.id %>
77     <%= f.hidden_field :id_stock %>
78     <%= f.number_field :quote_sensitivity, :step=>0.1, :min=>0.1, :placeholder=>'UP/DOWN hit sensitivity' %>
79     <%= f.number_field :hit_sensitivity, :step=>0.1, :min=>0.1, :placeholder=>'Pivot Point hit sensitivity' %>
80     <%= f.submit 'save' %>
81 </fieldset>
82 <% end %>