mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
Changing bike_status to bike_purporse
This commit is contained in:
@@ -26,7 +26,7 @@ class Bikes < Netzke::Basepack::Grid
|
||||
{ :name => :wheel_size, :text => 'Wheel Size (in)'},
|
||||
:value,
|
||||
{ :id => :bike_condition__condition, :name => :bike_condition__condition, :text => 'Condition'},
|
||||
{ :id => :bike_status__status, :name => :bike_status__status, :text => 'Status'},
|
||||
{ :id => :bike_purpose__purpose, :name => :bike_purpose__purpose, :text => 'Purpose'},
|
||||
{ :name => :owner, :getter => lambda { |rec|
|
||||
user = rec.owner
|
||||
user.nil? ? "" : "#{user.first_name} #{user.last_name}"
|
||||
@@ -52,7 +52,7 @@ class Bikes < Netzke::Basepack::Grid
|
||||
{ :name => :wheel_size, :field_label => 'Wheel Size (in)'},
|
||||
{ :name => :value, :field_label => 'Value'},
|
||||
{ :name => :bike_condition__condition, :field_label => 'Condition'},
|
||||
{ :name => :bike_status__status, :field_label => 'Status'}
|
||||
{ :name => :bike_purpose__purpose, :field_label => 'Purpose'}
|
||||
]
|
||||
end
|
||||
#override with nil to remove actions
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"bike_model__model",
|
||||
"bike_style__style",
|
||||
"bike_condition__condition",
|
||||
"bike_status__status"]
|
||||
"bike_purpose__purpose"]
|
||||
Ext.each(min_char_columns, function(column, index) {
|
||||
Ext.ComponentManager.get(column).editor.minChars = 1;
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
//due to Netzke bug, :min_chars attribute doesn't work
|
||||
var min_char_columns = [
|
||||
"user_action__status"]
|
||||
"user_action__purpose"]
|
||||
Ext.each(min_char_columns, function(column, index) {
|
||||
Ext.ComponentManager.get(column).editor.minChars = 1;
|
||||
});
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
class Bike < ActiveRecord::Base
|
||||
acts_as_loggable
|
||||
attr_accessible :shop_id, :serial_number, :bike_brand_id, :bike_model_id, :color, :bike_style_id, :seat_tube_height,
|
||||
:top_tube_length, :wheel_size, :value, :bike_condition_id, :bike_status_id
|
||||
:top_tube_length, :wheel_size, :value, :bike_condition_id, :bike_purpose_id
|
||||
|
||||
has_many :transactions
|
||||
|
||||
@@ -11,7 +11,7 @@ class Bike < ActiveRecord::Base
|
||||
belongs_to :bike_model
|
||||
belongs_to :bike_style
|
||||
belongs_to :bike_condition
|
||||
belongs_to :bike_status
|
||||
belongs_to :bike_purpose
|
||||
|
||||
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 }
|
||||
validates :serial_number, :length => { :minimum => 3 }
|
||||
@@ -24,7 +24,7 @@ class Bike < ActiveRecord::Base
|
||||
validates :wheel_size, :presence => true
|
||||
#validates :value, :presence => true
|
||||
validates :bike_condition_id, :presence => true
|
||||
validates :bike_status_id, :presence => true
|
||||
validates :bike_purpose_id, :presence => true
|
||||
|
||||
self.per_page = 15
|
||||
|
||||
@@ -46,8 +46,8 @@ class Bike < ActiveRecord::Base
|
||||
self.bike_condition
|
||||
end
|
||||
|
||||
def status
|
||||
self.bike_status
|
||||
def purpose
|
||||
self.bike_purpose
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class BikePurpose < ActiveRecord::Base
|
||||
attr_accessible :purpose
|
||||
|
||||
belongs_to :bike
|
||||
|
||||
def to_s
|
||||
self.purpose
|
||||
end
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
class BikeStatus < ActiveRecord::Base
|
||||
attr_accessible :status
|
||||
|
||||
belongs_to :bike
|
||||
|
||||
def to_s
|
||||
self.status
|
||||
end
|
||||
end
|
||||
+2
-2
@@ -45,7 +45,7 @@ class User < ActiveRecord::Base
|
||||
### TODO methods below probably belong somewhere else
|
||||
|
||||
def completed_build_bikes
|
||||
status_id = BikeStatus.find_by_status("BUILDBIKE").id
|
||||
purpose_id = BikePurpose.find_by_purpose("BUILDBIKE").id
|
||||
Bike.find_by_sql("
|
||||
SELECT *
|
||||
FROM bikes
|
||||
@@ -54,7 +54,7 @@ class User < ActiveRecord::Base
|
||||
FROM transactions
|
||||
WHERE customer_id = #{self.id}
|
||||
) AS transactions ON bikes.id = transactions.bike_id
|
||||
WHERE bike_status_id = #{status_id}")
|
||||
WHERE bike_purpose_id = #{purpose_id}")
|
||||
end
|
||||
|
||||
def total_credits
|
||||
|
||||
Reference in New Issue
Block a user