viewsy
This commit is contained in:
parent
b23ee29f25
commit
e39510b309
|
|
@ -23,6 +23,10 @@
|
||||||
/* Margin bottom by footer height */
|
/* Margin bottom by footer height */
|
||||||
margin-bottom: 60px;
|
margin-bottom: 60px;
|
||||||
}
|
}
|
||||||
|
.starter {
|
||||||
|
padding-left: 0.2em;
|
||||||
|
padding-right: 0.2em;
|
||||||
|
}
|
||||||
.footer {
|
.footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|
@ -32,3 +36,6 @@
|
||||||
line-height: 60px; /* Vertically center the text there */
|
line-height: 60px; /* Vertically center the text there */
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
.li_active {
|
||||||
|
color: #0923ff;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@currencies = Currency.all
|
@currencies = Currency.all
|
||||||
|
@curr_id = Currency.first.id
|
||||||
|
bbt
|
||||||
end
|
end
|
||||||
|
|
||||||
def seed
|
def seed
|
||||||
|
|
@ -18,4 +20,14 @@ class HomeController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
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
|
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 @@
|
||||||
<h1>Currencies</h1>
|
<div class="row">
|
||||||
<p>
|
<div class="col-md-2">
|
||||||
<ul>
|
<h1>Currencies</h1>
|
||||||
<% for curr in @currencies %>
|
<p>
|
||||||
<li><%= curr.name %> (<%= curr.description %>)</li>
|
<div id="left_menu">
|
||||||
<% end %>
|
<%= render :partial => '/home/partials/left_menu' %>
|
||||||
</ul>
|
</div>
|
||||||
</p>
|
</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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
<div class="starter">
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
get 'home/index'
|
get 'home/index'
|
||||||
get 'home/seed'
|
get 'home/seed'
|
||||||
|
get 'home/get_trades'
|
||||||
root 'home#index'
|
root 'home#index'
|
||||||
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue