mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -04:00
lk | adds explanatory text to waiting list & disables mark_as_sold button for sold bikes, and removes unused columns
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class BikesController < ApplicationController
|
||||
before_action :set_bike, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_bike, only: [:edit, :update, :destroy]
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
|
||||
@@ -25,6 +25,10 @@ class Bike < ActiveRecord::Base
|
||||
]
|
||||
end
|
||||
|
||||
def sold?
|
||||
date_sold.present?
|
||||
end
|
||||
|
||||
def name
|
||||
self.color + " " + self.brand + ' ' + self.model + " (" + self.log_number.to_s + ")"
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
.col-sm-6
|
||||
%h1 Edit bike
|
||||
.col-sm-3.col-sm-offset-3
|
||||
=button_to "Mark as sold", {action: "mark_as_sold", id: @bike.id}, method: :patch, class: "btn btn-default"
|
||||
=button_to "Mark as sold", {action: "mark_as_sold", id: @bike.id}, method: :patch, class: "btn btn-default", disabled: @bike.sold?
|
||||
= render 'edit_form'
|
||||
.bottom-nav-links
|
||||
- if @previous_bike
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
.container
|
||||
%p#notice= notice
|
||||
= form_for(@bike) do |f|
|
||||
= render 'fields', f: f, disabled: true
|
||||
= link_to 'Edit', edit_bike_path(@bike)
|
||||
|
|
||||
= link_to 'Back', bikes_path
|
||||
@@ -3,6 +3,7 @@
|
||||
= link_to ' + New Client', new_client_path, class: "btn btn-default"
|
||||
.row
|
||||
%h1 Client Waiting List
|
||||
%p The waiting list shows clients who have not been voided or picked up their bike. Only clients with an application date are shown.
|
||||
|
||||
%table.table.table-striped.table-bordered.table-hover
|
||||
%thead
|
||||
|
||||
Reference in New Issue
Block a user