Last active
February 10, 2017 22:17
-
-
Save tarponjargon/a55f02dae35caeb7cf6a7e9a77112981 to your computer and use it in GitHub Desktop.
Revisions
-
tarponjargon revised this gist
Feb 9, 2017 . 2 changed files with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,7 @@ import Ember from 'ember'; export default Ember.Route.extend({ beforeModel() { this.transitionTo('search'); } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ you have to manually change the url above to:<br> /search?foo[]=1&foo[]=2&foo[]=3<br><br> <b>OUTPUT</b> foo array contains: {{foo}}<br><br> Click one to remove from array:<br> (then note strange QP format change on url - how can ember retain the parameter-array format?)<br><br> -
tarponjargon revised this gist
Feb 9, 2017 . 2 changed files with 10 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ import Ember from 'ember'; export default Ember.Controller.extend({ appName: 'Ember Twiddle' }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ import Ember from 'ember'; var go = '/search?foo[]=1&foo[]=2&foo[]=3'; export default Ember.Route.extend({ beforeModel() { this.transitionTo(go); } }); -
tarponjargon revised this gist
Feb 9, 2017 . 5 changed files with 27 additions and 56 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ import Ember from 'ember'; export default Ember.Controller.extend({ appName: 'Ember Twiddle', customArray: ['1','2','3'] }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,54 +3,15 @@ import Ember from 'ember'; export default Ember.Controller.extend({ queryParams: [ 'foo' ], foo: null, actions: { removeItem: function(i) { alert(`about to remove ${i.toString()}`); this.foo.removeObject(i.toString()); console.log(this.foo); }, } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ import Ember from 'ember'; export default Ember.Route.extend({ queryParams: { foo: { refreshModel: true } } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,2 @@ {{link-to 'Click Here' 'search' }} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,10 @@ foo array contains: {{foo}}<br><br> Click one to remove from array:<br> (then note strange QP format change on url - how can ember retain the parameter-array format?)<br><br> {{#each foo as |f|}} delete <a href="#" {{action "removeItem" f}}>{{f}}</a><br> {{/each}} {{outlet}} -
tarponjargon revised this gist
Feb 9, 2017 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,9 @@ here are the controller properties (click one of the top 3 to remove from the controller properties)<br> I am kind of expecting the QP to reflect the key deletion but it's not happening <br> {{#each-in this as |key value|}} <a href="#" {{action "deleteStuff" key}}>{{key}}: {{value}}</a><br> {{/each-in}} <br><br> (side question: in a template, how do you iterate over *just* the controller properties and not the functions?) -
tarponjargon created this gist
Feb 9, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ import Ember from 'ember'; export default Ember.Controller.extend({ appName: 'Ember Twiddle' }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ import Ember from 'ember'; export default Ember.Controller.extend({ queryParams: [ 'q', 'paging', 'search_page', 'search_title', 'sort', 'search_sort', 'category_code', 'bct', 'filter_breadcrumb', 'filter_price', 'filter_size_apparel', 'filter_size_jewelry', 'filter_metal_type', 'filter_color', 'filter_county' ], q: null, paging: 18, sort: 'best', search_sort: 'relevance', search_title: null, bct: null, category_code: null, search_page: null, filter_breadcrumb: null, filter_price: null, filter_size_apparel: null, filter_size_jewelry: null, filter_metal_type: null, filter_color: null, filter_county: null, actions: { deleteStuff(key) { let urlData = this; alert("deleteStuff called with " + key); delete urlData[key]; urlData.notifyPropertyChange(); let newData = {}; console.log(urlData); urlData.queryParams.forEach(function (param) { if (Ember.get(urlData, param)) { newData[param] = Ember.get(urlData, param); console.log(`${param}`); } }); this.transitionToRoute('results', { queryParams: newData }); } } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ import Ember from 'ember'; import config from './config/environment'; const Router = Ember.Router.extend({ location: 'none', rootURL: config.rootURL }); Router.map(function() { this.route('search'); }); export default Router; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ <h1>Welcome to {{appName}}</h1> <br> <br> {{outlet}} <br> <br> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ {{link-to 'Click Here' 'search' (query-params q="shirt" search_page="3" filter_breadcrumb="Category > Subcategory")}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ here's the data list:<br> {{#each-in this as |key value|}} <a href="#" {{action "deleteStuff" key}}>{{key}}: {{value}}</a><br> {{/each-in}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ { "version": "0.11.0", "EmberENV": { "FEATURES": {} }, "options": { "use_pods": false, "enable-testing": false }, "dependencies": { "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", "ember": "2.10.2", "ember-data": "2.11.0", "ember-template-compiler": "2.10.2", "ember-testing": "2.10.2" }, "addons": {} }