diff options
| author | Yuval Adam <yuval@y3xz.com> | 2015-06-10 16:38:08 +0300 |
|---|---|---|
| committer | Yuval Adam <yuval@y3xz.com> | 2015-06-10 16:38:08 +0300 |
| commit | f6cfae2649a3447bee4df4d6a3e9286531a71d17 (patch) | |
| tree | 187a4e30c03899854bc6097b58638475d2a06fa1 /client/button.js | |
| parent | 918bdef7c3c02bc33802ab094b222afd054ba08f (diff) | |
Implement instagram query by dates
Diffstat (limited to 'client/button.js')
| -rw-r--r-- | client/button.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/client/button.js b/client/button.js index 29eeb91..d298ef7 100644 --- a/client/button.js +++ b/client/button.js @@ -15,6 +15,26 @@ Template.login.events({ } }); +Template.dates.events({ + 'submit form.dates': function (event) { + var month = $('input[name=monthOptions]:checked').val(); + var year = $('input[name=yearOptions]:checked').val(); + if (month !== undefined && year !== undefined) { + Meteor.call('getInstagramMedia', +year, +month, function(error, results) { + console.log('Instagram response', results.data) + Session.set('photos', results.data.data); + }); + } + Router.go('photos'); + return false; + } +}) + +Template.dates.helpers({ + months: _.range(1, 13), + years: _.range(2012, 2016) +}) + Template.photos.helpers({ photos: function () { return Session.get('photos'); @@ -22,9 +42,5 @@ Template.photos.helpers({ }) Accounts.onLogin(function() { - // Meteor.call('getInstagramMedia', function(error, results) { - // console.log('Instagram response', results.data) - // Session.set('photos', results.data.data); - // }); Router.go('dates'); }); |
