Skip to content

Instantly share code, notes, and snippets.

@solocommand
Created February 19, 2017 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solocommand/ea5bd4072b49eef3e41d7a8a3a100141 to your computer and use it in GitHub Desktop.
Save solocommand/ea5bd4072b49eef3e41d7a8a3a100141 to your computer and use it in GitHub Desktop.
Checkbox filters
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
value : null,
label : null,
title : null,
linkTo : null,
icon : Ember.computed('value', function() {
return this.get('value')
? 'ion-android-checkbox-outline'
: 'ion-android-checkbox-outline-blank'
;
}),
});
import Ember from 'ember';
export function queryParamsDynamic([key, value]) {
let hash = {};
hash[key] = value;
let qp = Ember.Object.extend({
isQueryParams: true,
values: null,
});
return qp.create({
values: Ember.assign({}, hash)
});
}
export default Ember.Helper.helper(queryParamsDynamic);
{{-browse/filter-checkbox
linkTo=routeName
key='upgrades'
value=upgrades
label="Upgrades"
title="Toggle inclusion of ship upgrades"
}}
{{#link-to linkTo (query-params-dynamic key (if value false true)) class="btn btn-outline-info" title=title}}
<i class="{{ icon }}"></i> {{ label }}
{{/link-to}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment