Skip to content

Instantly share code, notes, and snippets.

@pzuraq
Created April 30, 2013 19:29
Show Gist options
  • Save pzuraq/5491257 to your computer and use it in GitHub Desktop.
Save pzuraq/5491257 to your computer and use it in GitHub Desktop.
{{#each text in content.vehicleTexts}}
<div class="row-fluid">
{{view Bootstrap.Forms.Wysihtml5
valueBinding="text.text"
inputFieldClassNames="span12 text-description"
labelBinding="text.type.name"
}}
</div>
{{/each}}
{"vehicle_texts":[{"id":57,"type_id":4,"vehicle_id":1021,"text":"TEST2"},{"id":63,"type_id":1,"vehicle_id":1021,"text":"TEST2"},{"id":64,"type_id":2,"vehicle_id":1021,"text":"TEST2"}]}
Case.VehicleFilterRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.modelFor('vehicle'));
controller.set('BodyStyles', this.get('BodyStyles'));
controller.set('Customers', this.get('Customers'));
controller.set('DriveTrains', this.get('DriveTrains'));
controller.set('Employees', this.get('Employees'));
controller.set('FuelTypes', this.get('FuelTypes'));
controller.set('IntMaterials', this.get('IntMaterials'));
controller.set('Makes', this.get('Makes'));
controller.set('Models', this.get('Models'));
controller.set('OdoStatuses', this.get('OdoStatuses'));
controller.set('VehicleOptions', this.get('VehicleOptions'));
controller.set('PaintColors', this.get('PaintColors'));
controller.set('Showrooms', this.get('Showrooms'));
controller.set('Transmissions', this.get('Transmissions'));
controller.set('Trims', this.get('Trims'));
controller.set('Vendors', this.get('Vendors'));
controller.set('VendorReps', this.get('VendorReps'));
var vehicleController = this.controllerFor('vehicle');
vehicleController.set('lastFilter', this.routeName);
}
});
Case.VehicleDetailsRoute = Case.VehicleFilterRoute.extend();
Case.VehicleAdditionalRoute = Case.VehicleFilterRoute.extend();
Case.VehicleOptionsRoute = Case.VehicleFilterRoute.extend();
Case.VehicleConsignorRoute = Case.VehicleFilterRoute.extend();
Case.VehiclePriceRoute = Case.VehicleFilterRoute.extend();
Case.VehicleDmvRoute = Case.VehicleFilterRoute.extend();
Case.VehicleExpensesRoute = Case.VehicleFilterRoute.extend();
Case.VehicleDescriptionRoute = Case.VehicleFilterRoute.extend({
setupController: function(controller) {
this._super(controller);
textTypes = this.get('VehicleTextTypes').toArray();
vehicleTexts = controller.get('content').get('vehicleTexts');
console.log(vehicleTexts.toArray());
for(var i = 0; i < textTypes.length; i++) {
if(vehicleTexts.findProperty('type', textTypes[i]) === undefined) {
vehicleTexts.createRecord({
type: textTypes[i],
});
}
}
},
});
Case.VehiclePhotosRoute = Case.VehicleFilterRoute.extend();
Case.VehicleTasksRoute = Case.VehicleFilterRoute.extend();
Case.VehicleText = DS.Model.extend({
type: DS.belongsTo('Case.VehicleTextType'),
vehicle: DS.belongsTo('Case.Vehicle'),
text: DS.attr('string')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment