viewsy
This commit is contained in:
parent
b23ee29f25
commit
e39510b309
|
|
@ -23,6 +23,10 @@
|
|||
/* Margin bottom by footer height */
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
.starter {
|
||||
padding-left: 0.2em;
|
||||
padding-right: 0.2em;
|
||||
}
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
|
|
@ -32,3 +36,6 @@
|
|||
line-height: 60px; /* Vertically center the text there */
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.li_active {
|
||||
color: #0923ff;
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
class HomeController < ApplicationController
|
||||
def index
|
||||
@currencies = Currency.all
|
||||
@curr_id = Currency.first.id
|
||||
bbt
|
||||
end
|
||||
|
||||
def seed
|
||||
|
|
@ -18,4 +20,14 @@ class HomeController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_trades
|
||||
@currencies = Currency.all
|
||||
@curr_id = params[:curr_id]
|
||||
bbt
|
||||
end
|
||||
|
||||
def bbt
|
||||
@bbt = BitBayTrade.where('currency_id = ?', @curr_id).order('cast(tid as unsigned) DESC').limit(20)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
$("#bbt_ajax").html("<%= escape_javascript(render('/home/partials/bb_trades')) %>");
|
||||
$("#left_menu").html("<%= escape_javascript(render('/home/partials/left_menu')) %>");
|
||||
|
|
@ -1,8 +1,15 @@
|
|||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<h1>Currencies</h1>
|
||||
<p>
|
||||
<ul>
|
||||
<% for curr in @currencies %>
|
||||
<li><%= curr.name %> (<%= curr.description %>)</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div id="left_menu">
|
||||
<%= render :partial => '/home/partials/left_menu' %>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div id="bbt_ajax">
|
||||
<%= render :partial => '/home/partials/bb_trades'%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<table class="table table-sm table-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">tid</th>
|
||||
<th scope="col">Data</th>
|
||||
<th scope="col">Cena</th>
|
||||
<th scope="col">Ilość</th>
|
||||
<th scope="col">Koszt transakcji</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for bbt in @bbt %>
|
||||
<tr class="<%= bbt.transaction_type == 'buy' ? 'bg-success' : 'bg-danger' %>">
|
||||
<th scope="row"><%= bbt.tid %></th>
|
||||
<td><%= bbt.date %></td>
|
||||
<td><%= '%.2f' % bbt.price %></td>
|
||||
<td><%= bbt.amount %></td>
|
||||
<td><%= '%.2f' % (bbt.price * bbt.amount) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<% for curr in @currencies %>
|
||||
<% if @curr_id.to_i == curr.id %>
|
||||
<%= link_to "#{curr.name} (#{curr.description})", {controller: :home, action: :get_trades, curr_id: curr.id}, remote: true, class: "btn btn-primary btn-md btn-block active", role: "button", 'aria-pressed' => true %><br/>
|
||||
<% else %>
|
||||
<%= link_to "#{curr.name} (#{curr.description})", {controller: :home, action: :get_trades, curr_id: curr.id}, remote: true, class: "btn btn-primary btn-md btn-block", role: "button" %><br/>
|
||||
<% end%>
|
||||
<% end %>
|
||||
|
|
@ -41,8 +41,9 @@
|
|||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="starter">
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
Rails.application.routes.draw do
|
||||
get 'home/index'
|
||||
get 'home/seed'
|
||||
get 'home/get_trades'
|
||||
root 'home#index'
|
||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue