36 Commits
Author SHA1 Message Date
Edwin Perez 4b9f0169bc Added units to the user time input on the log 2013-10-19 15:43:53 -04:00
Edwin Perez b7ad63a2e5 Finished enhancing the user log enter time form 2013-10-19 14:06:41 -04:00
Edwin Perez 62310e7a25 Created a custom class for the adding an item in the user log grid 2013-10-19 12:20:48 -04:00
Jason Denney cfeb6fd1d2 Update README.md
Remove mailcatcher instructions since no emails are sent currently.
2013-10-15 16:21:57 -04:00
Jason Denney ec5db646a0 Use models to sort data when possible 2013-09-02 18:24:34 -04:00
Jason Denney de266e72d9 Merge pull request #62 from spacemunkay/denney-css-user-sign-up
Make user signup easier to read & enter
2013-09-02 15:08:59 -07:00
Jason Denney 67c51068cc Make user signup easier to read & enter 2013-09-02 18:08:05 -04:00
Jason Denney 8c6513099d Merge pull request #61 from spacemunkay/denney-move-model-to-bike
Moving bike model to the bikes table
2013-09-02 14:28:06 -07:00
Jason Denney 47f616b7b0 Moving bike model to the bikes table
Leaving the bike_models table and bikes.bike_model_id column as a backup.
2013-09-02 17:26:07 -04:00
Jason Denney 087325c444 Whoops, only create once… not for every update... 2013-09-02 16:23:58 -04:00
Jason Denney 3c4e5c21c2 Merge pull request #59 from spacemunkay/denney-remove-bike-log-end-date
Bike log events are instanteous, remove end_date
2013-09-02 12:28:59 -07:00
Jason Denney 69c01b8225 Bike log events are instanteous, remove end_date 2013-09-02 15:26:08 -04:00
Jason Denney 0aa9c16dbd Merge pull request #58 from spacemunkay/denney-default-sort-order
Set default sort order on users, bikes, userroles
2013-09-02 11:17:08 -07:00
Jason Denney e491c0530c Set default sort order on users, bikes, userroles 2013-09-02 14:16:39 -04:00
Jason Denney 3599cc2bbb Merge pull request #56 from spacemunkay/denney-bike-status-to-purpose
Changing bike_status to bike_purporse
2013-09-02 11:03:21 -07:00
Jason Denney cecb3b1a32 Changing bike_status to bike_purporse 2013-09-02 14:02:18 -04:00
Jason Denney 611b1b1151 Merge pull request #55 from spacemunkay/denney-disable-username-edit
set username to read only
2013-09-02 09:23:32 -07:00
Jason Denney 5e80c8866a set username to read only 2013-09-02 12:22:26 -04:00
Jason Denney 835e73ea97 Merge branch 'master' of github.com:spacemunkay/velocipede 2013-08-28 23:06:14 -04:00
Jason Denney cb2acd19ba ignore public/assets 2013-08-28 23:06:02 -04:00
Jason Denney ee12bfee8a Merge pull request #54 from spacemunkay/denney-autocomplete-max-chars
Changing min_chars for autocomplete to 1 char
2013-08-28 20:03:21 -07:00
Jason Denney 4d008163e1 Changing min_chars for autocomplete to 1 char 2013-08-28 23:01:29 -04:00
Jason Denney 06856f115c Merge pull request #52 from spacemunkay/denney-remove-bike-serial-constraint
Remove unique constraint on bike_serial
2013-08-17 21:56:07 -07:00
Jason Denney a9fb3487a1 Remove unique constraint on bike_serial
bike serial index was already removed.
2013-08-18 00:51:45 -04:00
Jason Denney 869b67d3e4 Merge pull request #50 from spacemunkay/denney-user-roles-by-full-name
User roles added by full name instead of username
2013-08-17 21:04:02 -07:00
Jason Denney cd4f891c95 User roles added by full name instead of username 2013-08-18 00:00:53 -04:00
Jason Denney 71a4bb0af4 Merge pull request #49 from spacemunkay/denney-remove-hours-bike
remove hours, created_at, updated_at in bike logs
2013-08-17 20:43:22 -07:00
Jason Denney f1214ab7e6 remove hours, created_at, updated_at in bike logs 2013-08-17 23:38:07 -04:00
Jason Denney aaa6fda90c Merge pull request #48 from spacemunkay/denney-add-end-date-user-timesheet
Added end date to user timesheet, removed created & updated
2013-08-17 20:23:17 -07:00
Jason Denney 4a7751959c Added end date to user timesheet, removed created & updated 2013-08-17 23:22:07 -04:00
Jason Denney 028a45702e More comments 2013-08-17 14:07:35 -04:00
Jason Denney 1a8b9c9247 Merge pull request #47 from spacemunkay/denney-create-user-sign-in
Changed so that user gets checked in after create.
2013-08-17 11:03:00 -07:00
Jason Denney 4e7f3a1761 Changed so that user gets checked in after create. 2013-08-17 14:01:40 -04:00
Jason Denney a6b41b5560 Merge pull request #46 from spacemunkay/denney-fix-search
Fixing search form for bikes updated to netzke 8.4
2013-08-15 19:07:01 -07:00
Jason Denney 4d7634605c Fixing search form for bikes updated to netzke 8.4
Updated Netzke 8.4, better search styling, case insensitive search, can search associations
Fixed mistake where bikes.condition_id was a string… durrrrrr needs to be integer
2013-08-15 22:05:29 -04:00
Jason Denney cf922be1b1 Quick workflow short term fix 2013-07-28 15:24:02 -04:00
28 changed files with 349 additions and 154 deletions
+1
View File
@@ -7,5 +7,6 @@ tmp/
.rbenv-version
.DS_Store
public/extjs
public/assets
public/images/icons
config/database.yml
+4 -4
View File
@@ -122,13 +122,13 @@ GEM
treetop (~> 1.4.8)
method_source (0.8.1)
mime-types (1.22)
multi_json (1.7.2)
netzke-basepack (0.8.2)
multi_json (1.7.9)
netzke-basepack (0.8.4)
netzke-core (~> 0.8.2)
netzke-cancan (0.8.2)
cancan
netzke-core
netzke-core (0.8.3)
netzke-core (0.8.4)
execjs
uglifier
nokogiri (1.5.9)
@@ -208,7 +208,7 @@ GEM
railties (>= 3.1)
therubyracer (~> 0.10.1)
tzinfo (0.3.37)
uglifier (1.3.0)
uglifier (2.1.2)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
warden (1.1.1)
-5
View File
@@ -28,11 +28,6 @@
1. Download icons from http://www.famfamfam.com/lab/icons/silk/
1. Link to the icons under `public/images/icons`: (From app root) `ln -s /MY/PATH/famfamfam_silk_icons/icons public/images/icons`
## Mailcatcher
Use mailcatcher to see what emails look like in development.
Follow the instructions from http://mailcatcher.me/ to create an rvm wrapper so you don't install it all over your gemsets
# License
Velocipede is released under the MIT license (http://opensource.org/licenses/MIT)
-4
View File
@@ -19,11 +19,8 @@ class BikeLogs < Netzke::Basepack::Grid
c.columns = [
{ :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db) },
{ :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) },
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
:description,
{ :name => :bike_action__action, :text => 'Action'},
{ :name => :created_at, :read_only => true},
{ :name => :updated_at, :read_only => true},
{ :name => :logged_by, :getter => lambda{ |rec|
user = User.find_by_id(rec.logger_id)
user.nil? ? "" : "#{user.first_name} #{user.last_name}"
@@ -48,7 +45,6 @@ class BikeLogs < Netzke::Basepack::Grid
def default_fields_for_forms
[
{ :name => :start_date},
{ :name => :end_date},
{ :name => :description},
#had to hack acts_as_loggable/log.rb to get this to work
{ :name => :bike_action__action, :field_label => 'Action'}
+11 -8
View File
@@ -2,11 +2,14 @@ class Bikes < Netzke::Basepack::Grid
def configure(c)
super
c.model = "Bike"
# columns with :id set, have :min_chars set in init_component
# See: http://stackoverflow.com/questions/17738962/netzke-grid-filtering
c.columns = [
{ :name => :shop_id, :text => 'Shop ID'},
:serial_number,
{ :name => :bike_brand__brand, :text => 'Brand' },
{ :name => :bike_model__model, :text => 'Model',
{ :id => :bike_brand__brand, :name => :bike_brand__brand, :text => 'Brand'},
{ :name => :model, :text => 'Model',
:scope => lambda { |rel|
if session[:selected_bike_brand_id]
rel.where(:bike_brand_id => session[:selected_bike_brand_id])
@@ -17,13 +20,13 @@ class Bikes < Netzke::Basepack::Grid
},
#needs to have type :action or else won't work in grid, because... netzke
{ :name => "color", :text => "Frame Color", :type => :action, :editor => { :xtype => "xcolorcombo"}, :renderer => :color_block},
{ :name => :bike_style__style, :text => 'Style' },
{ :id => :bike_style__style, :name => :bike_style__style, :text => 'Style' },
{ :name => :seat_tube_height, :text => 'Seat Tube (in)'},
{ :name => :top_tube_length, :text => 'Top Tube (in)'},
{ :name => :wheel_size, :text => 'Wheel Size (in)'},
:value,
{ :name => :bike_condition__condition, :text => 'Condition'},
{ :name => :bike_status__status, :text => 'Status'},
{ :id => :bike_condition__condition, :name => :bike_condition__condition, :text => 'Condition'},
{ :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}"
@@ -38,10 +41,10 @@ class Bikes < Netzke::Basepack::Grid
def default_fields_for_forms
# :field_label MUST be defined in order for search to work
[
{ :name => :bike_brand__brand, :field_label => 'Brand' },
{ :name => :model, :field_label => 'Model'},
{ :name => :shop_id, :field_label => 'Shop ID'},
{ :name => :serial_number, :field_label => 'Serial Number'},
{ :name => :bike_brand__brand, :field_label => 'Brand' },
{ :name => :bike_model__model, :field_label => 'Model'},
{ :name => "color", :xtype => "xcolorcombo"},
{ :name => :bike_style__style, :field_label => 'Style' },
{ :name => :seat_tube_height, :field_label => 'Seat Tube (in)'},
@@ -49,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
@@ -3,6 +3,17 @@
// calling superclass's initComponent
this.callParent();
// something...
//due to Netzke bug, :min_chars attribute doesn't work
var min_char_columns = [
"bike_brand__brand",
"bike_style__style",
"bike_condition__condition",
"bike_purpose__purpose"]
Ext.each(min_char_columns, function(column, index) {
Ext.ComponentManager.get(column).editor.minChars = 1;
});
// setting the 'rowclick' event
var view = this.getView();
view.on('itemclick', function(view, record){
+10 -22
View File
@@ -1,5 +1,4 @@
class UserLogs < Netzke::Basepack::Grid
def configure(c)
super
@@ -40,12 +39,10 @@ class UserLogs < Netzke::Basepack::Grid
c.columns = [
{ :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db) },
{ :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) },
{ :name => :end_date, :format => "g:ia - D, M j - Y", :default_value => Time.now.to_formatted_s(:db) },
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
:description,
{ :name => :user_action__action, :text => 'Action', :default_value => ::ActsAsLoggable::UserAction.all.first.id },
:created_at,
:updated_at,
{ :id => :user_action__action, :name => :user_action__action, :text => 'Action', :default_value => ::ActsAsLoggable::UserAction.all.first.id },
{ :name => :logged_by, :getter => lambda{ |rec|
user = User.find_by_id(rec.logger_id)
user.nil? ? "" : "#{user.first_name} #{user.last_name}"
@@ -54,23 +51,10 @@ class UserLogs < Netzke::Basepack::Grid
]
end
def default_fields_for_forms
#figure out a better way to do this
bike_store = Bike.all.map { |b| [b.id, b.shop_id] }
current_user ||= User.find_by_id(session[:selected_user_id]) || controller.current_user
bike_id = current_user.bike.nil? ? nil : current_user.bike.id
[
{ :no_binding => true, :xtype => 'displayfield', :fieldLabel => "Log for:", :value => "#{current_user.to_s}"},
{ :name => :start_date},
{ :name => :end_date},
{ :name => :description},
#had to hack acts_as_loggable/log.rb to get this to work
{ :name => :user_action__action, :field_label => 'Action'},
{ :name => :for_bike, :checkboxName => :copy_log, :inputValue => true, :title => "Copy description to a Bike's History?", :xtype => 'fieldset', :checkboxToggle => true, :collapsed => true, :items => [
{:xtype => 'combo', :no_binding => true, :name => :copy_id, :title => 'Bike', :fieldLabel => 'Bike', :store => bike_store, :value => bike_id}
]
}
]
# Overriding the defautl add in form
def preconfigure_record_window(c)
super
c.form_config.klass = UserLogsAddItem
end
#override with nil to remove actions
@@ -78,4 +62,8 @@ class UserLogs < Netzke::Basepack::Grid
[ :apply, :add_in_form, :search ]
end
js_configure do |c|
c.mixin :init_component
end
end
@@ -0,0 +1,49 @@
{
initComponent: function(){
// calling superclass's initComponent
this.callParent();
// TESTTING
//due to Netzke bug, :min_chars attribute doesn't work
var min_char_columns = [
"user_action__purpose"
];
// Ext.each(min_char_columns, function(column, index) {
// Ext.ComponentManager.get(column).editor.minChars = 1;
// });
var view = this.getView();
view.on('itemclick', function(view, record){
console.log('clicking ');
// The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
// console.log('Old record', record);
}, this);
view.on('itemupdate', function(record, index, node){
console.log('Updating item');
// if('end_date' in record.data.modified){
// console.log('start', record.data.start_date);
// console.log('end', record.data.end_date);
// }else if('start_date' in record.data.modified){
// }
}, this);
// var hoursInput = Ext.getCmp('user_logs_add_form_hours-inputEl');
// console.log(hoursInput);
// hoursInput.on('change', function(field, newValue, oldValue){
// console.log('Hours changing...', newValue);
// });
},
addNewItem: function(e){
e.fireEvent('click', {});
console.log(e);
console.log('Adding new item');
}
}
+31
View File
@@ -0,0 +1,31 @@
# The User Log Add Item Form
class UserLogsAddItem < Netzke::Basepack::Form
def configure(c)
super
c.model = 'ActsAsLoggable::Log'
#figure out a better way to do this
bike_store = Bike.all.map { |b| [b.id, b.shop_id] }
current_user ||= User.find_by_id(session[:selected_user_id]) || controller.current_user
bike_id = current_user.bike.nil? ? nil : current_user.bike.id
c.items = [
{ :no_binding => true, :xtype => 'displayfield', :fieldLabel => "Log for:", :value => "#{current_user.to_s}"},
{ :id => :user_logs_add_form_start, :name => :start_date},
{ :id => :user_logs_add_form_time, :no_binding => true, :name => :time, :xtype => 'field', :fieldLabel => "Time:", :value => 0 },
{ :id => :user_logs_add_form_units, :xtype => 'combo', :no_binding => true, :name => :units, :fieldLabel => 'Units', :store => ['Mins', 'Hrs'], :value => 'Mins' },
{ :id => :user_logs_add_form_end, :name => :end_date, :hidden => true },
{ :name => :description},
#had to hack acts_as_loggable/log.rb to get this to work
{ :name => :user_action__action, :field_label => 'Action'},
{ :name => :for_bike, :checkboxName => :copy_log, :inputValue => true,
:title => "Copy description to a Bike's History?", :xtype => 'fieldset', :checkboxToggle => true, :collapsed => true, :items => [
{:xtype => 'combo', :no_binding => true, :name => :copy_id, :title => 'Bike', :fieldLabel => 'Bike', :store => bike_store, :value => bike_id}
]
}
]
end
js_configure do |c|
c.mixin :init_component
end
end
@@ -0,0 +1,76 @@
{
initComponent: function(){
// calling superclass's initComponent
this.callParent();
var panel = this;
var theForm = this.getForm();
var startInput = Ext.getCmp('user_logs_add_form_start');
var timeInput = Ext.getCmp('user_logs_add_form_time');
var unitsInput = Ext.getCmp('user_logs_add_form_units');
var endInput = Ext.getCmp('user_logs_add_form_end');
var startdate = startInput.items.items[0];
var starttime = startInput.items.items[1];
var enddate = endInput.items.items[0];
var endtime = endInput.items.items[1];
startdate.on('change', function(e){
var hours = timeInput.getValue();
var startTime = starttime.getValue();
if('Mins' === unitsInput.getValue()){
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.MINUTE, parseInt(hours));
}else{
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.HOUR, parseInt(hours));
}
endtime.setValue(calculatedEndTime);
enddate.setValue(calculatedEndTime);
});
starttime.on('change', function(e){
var hours = timeInput.getValue();
var startTime = starttime.getValue();
if('Mins' === unitsInput.getValue()){
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.MINUTE, parseInt(hours));
}else{
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.HOUR, parseInt(hours));
}
endtime.setValue(calculatedEndTime);
enddate.setValue(calculatedEndTime);
});
timeInput.on('change', function(e){
var hours = timeInput.getValue();
var startTime = starttime.getValue();
if('Mins' === unitsInput.getValue()){
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.MINUTE, parseInt(hours));
}else{
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.HOUR, parseInt(hours));
}
endtime.setValue(calculatedEndTime);
enddate.setValue(calculatedEndTime);
});
unitsInput.on('change', function(e){
var hours = timeInput.getValue();
var startTime = starttime.getValue();
if('Mins' === unitsInput.getValue()){
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.MINUTE, parseInt(hours));
}else{
var calculatedEndTime = Ext.Date.add(new Date(startTime), Ext.Date.HOUR, parseInt(hours));
}
endtime.setValue(calculatedEndTime);
enddate.setValue(calculatedEndTime);
});
}
}
+3 -2
View File
@@ -4,8 +4,9 @@ class UserRoleJoins < Netzke::Basepack::Grid
c.model = "UserRoleJoin"
c.header = false
c.title = "User Roles"
c.data_store.sorters = [{ :property => :user__username, :direction => :ASC}]
c.columns = [
{ :name => :user__username, :text => "Username"},
{ :name => :user__username, :text => "Username", :read_only => true},
{ :name => :name, :getter => lambda{ |rec|
user = User.find_by_id(rec.user_id)
user.nil? ? "" : "#{user.first_name} #{user.last_name}"
@@ -19,7 +20,7 @@ class UserRoleJoins < Netzke::Basepack::Grid
def default_fields_for_forms
[
{ :name => :user__username, :field_label => 'Username' },
{ :name => :user__full_name, :field_label => 'Name'},
{ :name => :role__role, :field_label => 'Role' },
{ :name => :ends }
]
+2 -2
View File
@@ -14,11 +14,11 @@ class Users < Netzke::Basepack::Grid
c.model = "User"
c.columns = [
:username,
{ :name => :username, :read_only => true },
:first_name,
:last_name,
:email,
:bike__shop_id
{ :id => :bike__shop_id, :name => :bike__shop_id}
]
c.columns << :reset if can? :manage, User
@@ -2,6 +2,13 @@
initComponent: function(){
// calling superclass's initComponent
this.callParent();
//due to Netzke bug, :min_chars attribute doesn't work
var min_char_columns = ["bike__shop_id"]
Ext.each(min_char_columns, function(column, index) {
Ext.ComponentManager.get(column).editor.minChars = 1;
});
this.getView().on('itemclick', function(view, record){
// The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
this.selectCustomer({customer_id: record.get('id'), customer_type: 'User'});
+11 -14
View File
@@ -1,22 +1,23 @@
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
attr_accessible :shop_id, :serial_number, :bike_brand_id, :model, :color, :bike_style_id, :seat_tube_height,
:top_tube_length, :wheel_size, :value, :bike_condition_id, :bike_purpose_id
has_many :transactions
has_one :owner, :class_name => 'User'
has_one :task_list, :as => :item, :dependent => :destroy
belongs_to :bike_brand
belongs_to :bike_model
belongs_to :bike_style
belongs_to :bike_condition
belongs_to :bike_status
belongs_to :bike_purpose
default_scope order('shop_id ASC')
validates :shop_id, :presence => true, :uniqueness => true, :length => { :minimum => 3 }
validates :serial_number, :uniqueness => true, :length => { :minimum => 3 }
validates :serial_number, :length => { :minimum => 3 }
validates :model, :length => { :maximum => 50 }
validates :bike_brand_id, :presence => true
validates :bike_model_id, :presence => true
validates :color, :presence => true
validates :bike_style_id, :presence => true
validates :seat_tube_height, :presence => true
@@ -24,20 +25,16 @@ 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
after_save :create_task_list
after_create :create_task_list
def brand
self.bike_brand
end
def model
self.bike_model
end
def style
self.bike_style
end
@@ -46,8 +43,8 @@ class Bike < ActiveRecord::Base
self.bike_condition
end
def status
self.bike_status
def purpose
self.bike_purpose
end
def to_s
-1
View File
@@ -1,7 +1,6 @@
class BikeModel < ActiveRecord::Base
attr_accessible :model, :bike_brand_id
has_many :bikes
belongs_to :bike_brand
default_scope order('model ASC')
+9
View File
@@ -0,0 +1,9 @@
class BikePurpose < ActiveRecord::Base
attr_accessible :purpose
belongs_to :bike
def to_s
self.purpose
end
end
-9
View File
@@ -1,9 +0,0 @@
class BikeStatus < ActiveRecord::Base
attr_accessible :status
belongs_to :bike
def to_s
self.status
end
end
+4 -2
View File
@@ -20,6 +20,8 @@ class User < ActiveRecord::Base
belongs_to :bike
default_scope order('username ASC')
validates :first_name, :presence => true
validates :last_name, :presence => true
@@ -45,7 +47,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 +56,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
@@ -1,24 +1,25 @@
%fieldset
= f.label :addrStreet1
%br/
= f.text_field :addrStreet1
%br/
= f.label :addrStreet2
%br/
= f.text_field :addrStreet2
%br/
= f.label :addrCity
%br/
= f.text_field :addrCity
%br/
= f.label :addrState
%br/
= f.text_field :addrState
%br/
= f.label :addrZip
%br/
= f.text_field :addrZip
%br/
= f.label :phone
%br/
= f.text_field :phone
.control-group
= f.label :addrStreet1, :class => "control-label"
.controls
= f.text_field :addrStreet1, :class => "control-label"
.control-group
= f.label :addrStreet2, :class => "control-label"
.controls
= f.text_field :addrStreet2, :class => "control-label"
.control-group
= f.label :addrCity, :class => "control-label"
.controls
= f.text_field :addrCity, :class => "control-label"
.control-group
= f.label :addrState, :class => "control-label"
.controls
= f.text_field :addrState, :class => "control-label"
.control-group
= f.label :addrZip, :class => "control-label"
.controls
= f.text_field :addrZip, :class => "control-label"
.control-group
= f.label :phone, :class => "control-label"
.controls
= f.text_field :phone, :class => "control-label"
+33 -31
View File
@@ -1,34 +1,36 @@
= stylesheet_link_tag "bootstrap_and_overrides", :media => "all"
%h2 Sign up
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => "form-horizontal"}) do |f|
= devise_error_messages!
%div
= f.label :username
%br/
= f.text_field :username
%div
= f.label :first_name
%br/
= f.text_field :first_name
%div
= f.label :last_name
%br/
= f.text_field :last_name
%div
= f.label :email
%br/
= f.email_field :email
%div
- profile_builder = resource.user_profiles.empty? ? resource.user_profiles.build : resource.user_profiles
= f.fields_for :user_profiles, profile_builder do |builder|
= render 'user_profile_fields', f: builder
%div
= f.label :password
%br/
= f.password_field :password
%div
= f.label :password_confirmation
%br/
= f.password_field :password_confirmation
%div= f.submit "Sign up"
.controls
%h2 Sign up
.control-group
= f.label :username, :class => "control-label"
.controls
= f.text_field :username
.control-group
= f.label :first_name, :class => "control-label"
.controls
= f.text_field :first_name
.control-group
= f.label :last_name, :class => "control-label"
.controls
= f.text_field :last_name
.control-group
= f.label :email, :class => "control-label"
.controls
= f.email_field :email
- profile_builder = resource.user_profiles.empty? ? resource.user_profiles.build : resource.user_profiles
= f.fields_for :user_profiles, profile_builder do |builder|
= render 'user_profile_fields', f: builder
.control-group
= f.label :password, :class => "control-label"
.controls
= f.password_field :password
.control-group
= f.label :password_confirmation, :class => "control-label"
.controls
= f.password_field :password_confirmation
.control-group
.controls
= f.submit "Sign up"
= render "links"
+4 -1
View File
@@ -223,7 +223,10 @@ Devise.setup do |config|
end
#Check in the user if they sign in. (Devise uses Warden)
Warden::Manager.after_authentication do |user,auth,opts|
Warden::Manager.after_set_user do |user,auth,opts|
# this essentially gets called after every netzke request, but alas,
# only using the after_authenticaion callback doesn't get fired after
# user creation.
user.checkin unless user.checked_in?
end
@@ -0,0 +1,15 @@
class BikeConditionIdToInt < ActiveRecord::Migration
def up
#for Postgres
connection.execute(%q{
alter table bikes
alter column bike_condition_id
type integer using cast(bike_condition_id as integer)
})
end
def down
#you really don't want to go back
change_column :bikes, :bike_condition_id, :string
end
end
@@ -0,0 +1,7 @@
class BikeStatusToPurpose < ActiveRecord::Migration
def change
rename_column :bikes, :bike_status_id, :bike_purpose_id
rename_column :bike_statuses, :status, :purpose
rename_table :bike_statuses, :bike_purposes
end
end
@@ -0,0 +1,10 @@
class AddModelToBike < ActiveRecord::Migration
def change
add_column :bikes, :model, :string
change_column :bikes, :bike_model_id, :integer, :null => true
Bike.all.each do |bike|
bike.model = BikeModel.find_by_id(bike.bike_model_id).model
bike.save
end
end
end
+7 -6
View File
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130629152047) do
ActiveRecord::Schema.define(:version => 20130902201853) do
create_table "bike_actions", :force => true do |t|
t.string "action", :limit => 128, :null => false
@@ -34,8 +34,8 @@ ActiveRecord::Schema.define(:version => 20130629152047) do
t.integer "bike_brand_id", :null => false
end
create_table "bike_statuses", :force => true do |t|
t.string "status", :null => false
create_table "bike_purposes", :force => true do |t|
t.string "purpose", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
@@ -49,18 +49,19 @@ ActiveRecord::Schema.define(:version => 20130629152047) do
create_table "bikes", :force => true do |t|
t.string "serial_number"
t.integer "bike_brand_id", :null => false
t.integer "bike_model_id", :null => false
t.integer "bike_model_id"
t.string "color"
t.integer "bike_style_id", :null => false
t.float "seat_tube_height"
t.float "top_tube_length"
t.integer "wheel_size"
t.float "value"
t.string "bike_condition_id", :null => false
t.integer "bike_status_id", :null => false
t.integer "bike_condition_id", :null => false
t.integer "bike_purpose_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "shop_id"
t.string "model"
end
add_index "bikes", ["shop_id"], :name => "index_bikes_on_shop_id", :unique => true
+18
View File
@@ -0,0 +1,18 @@
undetermined:
id: 1
purpose: UNDETERMINED
scrap:
id: 2
purpose: SCRAP
parts:
id: 3
purpose: PARTS
storage:
id: 4
purpose: STORAGE
buildbike:
id: 5
purpose: BUILDBIKE
sale:
id: 6
purpose: SALE
-18
View File
@@ -1,18 +0,0 @@
undetermined:
id: 1
status: UNDETERMINED
scrap:
id: 2
status: SCRAP
parts:
id: 3
status: PARTS
storage:
id: 4
status: STORAGE
buildbike:
id: 5
status: BUILDBIKE
sale:
id: 6
status: SALE
+1 -1
View File
@@ -17,6 +17,6 @@ FactoryGirl.define do
wheel_size 27
value 100
bike_condition_id 1
bike_status_id 1
bike_purpose_id 1
end
end