Skip to content

Instantly share code, notes, and snippets.

@thejohnnybot
Created February 9, 2015 22:02
Show Gist options
  • Select an option

  • Save thejohnnybot/ab9aae5a23cf7efa5025 to your computer and use it in GitHub Desktop.

Select an option

Save thejohnnybot/ab9aae5a23cf7efa5025 to your computer and use it in GitHub Desktop.
Ejemplo
<form {{action "search" on="submit"}} role="form">
<fieldset>
<legend><i class="fa fa-search">Search Quotes</i></legend>
<div class="row form-group">
<div class="col-xs-6">
<label for="first_name">First Name</label>
{{input class="form-control" name="first_name" value=firstNameField}}
</div>
<div class="col-xs-6">
<label for="last_name">Last Name</label>
{{input class="form-control" name="last_name" value=lastNameField}}
</div>
</div>
<div class="form-group">
<label for="license">License</label>
{{input class="form-control" name="license" value=licenseField}}
</div>
<div class="form-group">
<label for="phone">Phone</label>
{{input class="form-control" name="phone" value=phoneField}}
</div>
<div class="form-group">
<label for="email">Email</label>
{{input class="form-control" name="email" value=emailField placeholder="Email"}}
</div>
<div class="form-group">
<label for="zipcode">Zipcode</label>
{{input class="form-control" name="zip" value=zipField placeholder="Zip Code"}}
</div>
<div class="row form-group">
<div class="col-xs-6">
<label for="start_date">Start Date</label>
{{date-picker name="start_date" value=startDateField}}
</div>
<div class="col-xs-6">
<label for="end_date">End Date</label>
{{date-picker name="end_date" value=endDateField}}
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
</div>
</fieldset>
</form>
</div>
import Ember from 'ember';
import config from '../config/environment';
var fmt = Ember.String.fmt;
var oneWay = Ember.computed.oneWay;
var isBlank = Ember.isBlank;
export default Ember.ArrayController.extend(Paginatable, {
firstName: null,
lastName: null,
license: null,
phone: null,
email: null,
zip: null,
page: 1,
firstNameField: oneWay('firstName'),
lastNameField: oneWay('lastName'),
licenseField: oneWay('license'),
phoneField: oneWay('phone'),
emailField: oneWay('email'),
zipField: oneWay('zip'),
activateLoading: function() {
this.set('isLoading', true);
}.observes('firstName', 'lastName', 'license', 'phone', 'email', 'zip', 'startDate', 'endDate'),
newQuoteHref: function() {
return fmt(config.newQuoteURL, this.get('slug'));
}.property('slug'),
actions: {
search: function() {
this.setProperties({
firstName: this.get('firstNameField'),
lastName: this.get('lastNameField'),
license: this.get('licenseField'),
phone: this.get('phoneField'),
email: this.get('emailField'),
startDate: moment(this.get('startDateField'), "MM/DD/YYYY").format("YYYY-MM-DD"),
endDate: moment(this.get('endDateField'), "MM/DD/YYYY").format("YYYY-MM-DD"),
zip: this.get('zipField'),
page: 1
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment