organized code into Smr module
[smr.git] / gui / app / views / objects / stock / index.html.erb
blobf7cace563a7c5ec9a115fb217c2ece773bff182a
1 <h1><%= @headline %></h1>
3 <% if @stock %>
4     <%= form_for @stock, :url=>{action: :create}, :method=>:POST do |f| %>
5      <fieldset id='stock' style='float:left;'>
6       <legend><% if @stock.id %>Edit<% else %>Add<% end %> Security</legend>
7         <%= f.hidden_field :id %>
8       <div style='display: block; float: left;'>
9         <%= f.text_field :name, :size=>25, :placeholder=>'Name' %><br/>
10         <%= f.text_field :symbol, :size=>12, :placeholder=>'Trading Symbol' %>
11         <%= f.select :id_stock_symbolextension, @symbolextensions.collect{|se| [se.extension, se.id] }, :prompt=>'-- Select Extension --' %>
12         via <%= f.select :id_stock_quotesource, @quotesources.collect{|qs| [qs.source, qs.id] }, :prompt=>'-- Select Source --' %>
13         <br/>
15         <%= f.url_field :url, :size=>25, :placeholder=>'Link to Investor Relations page' %><br/>
16         <%= f.label :fetch_quote %><%= f.check_box :fetch_quote %><br/>
17         <%= f.submit 'Save Security' %>
18       </div>
19       <div style='display: block; float: left;'>
20         <%= f.text_area :comment, :cols=>40, :rows=>15, placeholder: 'What is this company or paper about?' %>
21       </div>
22      </fieldset>
23     <% end %>
24   <% if @stock.fetch_quote and @quote_retrieval_status %>
25      <table class='quote_retrieval_status'>
26         <thead><tr><th colspan='2'>Quote Retrieval Status</th></thead>
27         <tbody>
28         <% @quote_retrieval_status.each do |k,v| %>
29          <tr><td><%= k %>:</td><td><%= v %></td></tr>
30         <% end %>
31         </tbody>
32      </table>
33   <% end %>
34 <% end %>
36 <h2>Securities</h2>
37 <% if not @stocks %>
38     <p>No securities exist yet.</p>
39 <% else %>
42 <table id='securities' border>
43     <thead>
44     <tr>
45         <th><%= smr_paginate @page, @total_pages, objects_stock_index_path %></th>
46         <th>Symbol</th>
47         <th>Quote Source</th>
48         <th>Fetch Quote</th>
49     </tr>
50     </thead>
51     <tbody>
52     <% @stocks.each do |s| %>
53         <tr>
54             <td rowspan=2>
55               <%= link_to '+', controller: 'objects/stock', action: 'edit', id: s.id %>
56               <%= s.name %><br/>
57               <%= link_to s.url %>
58             </td>
59             <td><%= s.symbol %><%= s.StockSymbolextension %></td>
60             <td><%= s.StockQuotesource %></td>
61             <td><%= s.fetch_quote %></td>
62         </tr>
63         <tr>
64             <td colspan=4><%= s.comment %></td>
65         </tr>
66     <% end %>
67     </tbody>
68 </table>
69 <% end %>