1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-02-28 16:53:23 -05:00

Added color blocks to grid view

This commit is contained in:
Jason Denney 2013-05-26 19:52:40 -04:00
parent 7f029f2a83
commit 687cb33974
2 changed files with 4 additions and 2 deletions

View File

@ -17,8 +17,7 @@ class Bikes < Netzke::Basepack::Grid
} }
}, },
#needs to have type :action or else won't work in grid, because... netzke #needs to have type :action or else won't work in grid, because... netzke
{ :name => "color", :type => :action, :editor => { :xtype => "xcolorcombo"}}, { :name => "color", :text => "Frame Color", :type => :action, :editor => { :xtype => "xcolorcombo"}, :renderer => :color_block},
#{ :name => :color },
{ :name => :bike_style__style, :text => 'Style' }, { :name => :bike_style__style, :text => 'Style' },
{ :name => :seat_tube_height, :text => 'Seat Tube (in)'}, { :name => :seat_tube_height, :text => 'Seat Tube (in)'},
{ :name => :top_tube_length, :text => 'Top Tube (in)'}, { :name => :top_tube_length, :text => 'Top Tube (in)'},

View File

@ -9,5 +9,8 @@
// The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server! // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
this.selectBikeBrand({bike_brand_id: record.get('bike_brand__brand')}); this.selectBikeBrand({bike_brand_id: record.get('bike_brand__brand')});
}, this); }, this);
},
colorBlock: function(value){
return Ext.String.format('<div style="display:inline-block">{1}</div><div style="background-color:#{0};width:50px;height:10px;display:inline-block;margin:0 5px 0 5px;border:solid;border-color:gray;border-width:1px;"></div>', value, value);
} }
} }