mirror of
https://github.com/fspc/bike-database.git
synced 2025-02-24 01:43:22 -05:00
lk | paginates bikes & orders by log # desc
This commit is contained in:
parent
9948681b68
commit
cc3f0f8c77
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,6 +22,7 @@ dump.rdb
|
||||
.DS_Store
|
||||
|
||||
/config/secrets.yml
|
||||
/ignored/
|
||||
|
||||
*.swp
|
||||
/.vagrant/*
|
||||
|
1
Gemfile
1
Gemfile
@ -9,6 +9,7 @@ gem 'oauth2', '1.0.0'
|
||||
gem 'dotenv-rails'
|
||||
gem 'sidekiq'
|
||||
gem 'sinatra', :require => nil
|
||||
gem 'will_paginate', '~> 3.0.6'
|
||||
|
||||
#SCSS & Bootstrap
|
||||
gem 'bootstrap-sass', '2.3.2.0'
|
||||
|
@ -237,6 +237,7 @@ GEM
|
||||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
websocket (1.0.7)
|
||||
will_paginate (3.0.7)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
|
||||
@ -278,6 +279,7 @@ DEPENDENCIES
|
||||
turbolinks (= 1.1.1)
|
||||
uglifier (= 2.1.1)
|
||||
webmock (= 1.21.0)
|
||||
will_paginate (~> 3.0.6)
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
@ -3,26 +3,24 @@ class BikesController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
@bikes = Bike.all.order(:log_number).reverse_order
|
||||
@bikes = Bike.all.order(:log_number).reverse_order.paginate(:page => params[:page], :per_page => 30)
|
||||
@unsold_bikes = @bikes.select{ |bike|
|
||||
!bike.date_sold &&
|
||||
(bike.purpose == "Sale")
|
||||
}
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
def show; end
|
||||
|
||||
def new
|
||||
@bike = Bike.new
|
||||
@log_number = Bike.order(:log_number).last.log_number + 1
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
def edit; end
|
||||
|
||||
def print_select
|
||||
@bikes = Bike.all
|
||||
@bikes = Bike.order(:log_number).reverse_order.paginate(:page => params[:page], :per_page => 30)
|
||||
end
|
||||
|
||||
def print_labels
|
||||
|
@ -34,4 +34,4 @@
|
||||
%td= bike.model
|
||||
%td= link_to 'Show', bike
|
||||
%td= link_to 'Edit', edit_bike_path(bike)
|
||||
|
||||
=will_paginate @bikes
|
||||
|
@ -5,10 +5,12 @@
|
||||
%table.table.table-striped.table-bordered.table-hover
|
||||
%thead
|
||||
%tr
|
||||
%th Bike
|
||||
%th Bike
|
||||
%th Select
|
||||
-@bikes.each do |bike|
|
||||
%tr
|
||||
%td= bike.name
|
||||
%td= check_box("print_bikes", bike.id)
|
||||
=submit_tag 'Generate Labels', class: "btn btn-default"
|
||||
%td= check_box("print_bikes", bike.id)
|
||||
=will_paginate @bikes
|
||||
%br
|
||||
=submit_tag 'Generate Labels', class: "btn btn-default"
|
||||
|
Loading…
x
Reference in New Issue
Block a user