Skip to content

Commit

Permalink
using decent exposure on TransaccionesController
Browse files Browse the repository at this point in the history
  • Loading branch information
macool committed Feb 23, 2014
1 parent 09c07e6 commit 489ca58
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
12 changes: 8 additions & 4 deletions app/controllers/transacciones_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
class TransaccionesController < BusinessController

expose(:transacciones) {
business.transacciones.includes(:bandango).page(params[:page]).per(10)
}
expose(:transaccion) {
business.transacciones.find params[:id]
}

def index
@transacciones = @business.transacciones.includes(:bandango).page(params[:page]).per(10)
end

def show
@transacciones = Transaccion.where(id: params[:id]).page
render :index
end

end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= div_for bandango_connection, :class => "model" do %>
<%= l bandango_connection.created_at, format: :short %>
<% bandango_connection.transacciones_sent.each do |transaccion| %>
- <%= link_to transaccion, business_transaccion_path(@business, transaccion) %>
- <%= link_to transaccion, business_transaccion_path(business, transaccion) %>
<% end %>
<% end %>
6 changes: 6 additions & 0 deletions app/views/transacciones/_table_head.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="model row">
<div class="col-xs-3 stronger align_center">Fecha</div>
<div class="col-xs-2 stronger align_center">Bandango</div>
<div class="col-xs-2 stronger align_center">Acción</div>
<div class="col-xs-5 stronger align_center">Attrs</div>
</div>
4 changes: 2 additions & 2 deletions app/views/transacciones/_transacciones.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% @transacciones.each do |transaccion| %>
<% transacciones.each do |transaccion| %>
<%= render transaccion %>
<% end %>
<div class="align_center">
<%= paginate @transacciones, remote: true %>
<%= paginate transacciones, remote: true %>
</div>
9 changes: 2 additions & 7 deletions app/views/transacciones/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
<%= link_to "Negocios", businesses_path %>
</li>
<li>
<%= link_to @business.nombre, business_path(@business) %>
<%= link_to business.nombre, business_path(business) %>
</li>
<li class="active">Transacciones</li>
</ol>

<div class="models">
<div class="model row">
<div class="col-xs-3 stronger align_center">Fecha</div>
<div class="col-xs-2 stronger align_center">Bandango</div>
<div class="col-xs-2 stronger align_center">Acción</div>
<div class="col-xs-5 stronger align_center">Attrs</div>
</div>
<%= render "table_head" %>
<div class="transacciones">
<%= render "transacciones" %>
</div>
Expand Down
6 changes: 6 additions & 0 deletions app/views/transacciones/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="models">
<%= render "table_head" %>
<div class="transacciones">
<%= render "transaccion" %>
</div>
</div>

0 comments on commit 489ca58

Please sign in to comment.