diff --git a/app/index.html b/app/index.html index 9694afa..3151c61 100644 --- a/app/index.html +++ b/app/index.html @@ -22,6 +22,10 @@
+ + diff --git a/app/js/controllers.js b/app/js/controllers.js index 7816292..599c11a 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -53,4 +53,21 @@ angular.module('myApp.controllers', []) } }); }); + }]) + .controller('RefCtrl', ['$scope', '$location', '$window', 'Prismic', function ($scope, $location, $window, Prismic) { + Prismic.ctx().then(function(ctx){ + // Get available refs. + $scope.refs = ctx.api.data.refs; + // Find selected release based on URL query. + var release = _.where($scope.refs, {ref: $location.search().ref}); + $scope.selectedRelease = release.length > 0 ? release[0] : $scope.refs[0]; + $scope.newRef = function(selected) { + // When select element changed, update ctx object and configure + // $location service. + ctx.ref = selected.ref; + $location.path($location.path()).search({'ref': selected.ref}); + // Alternatively, you can reload the page. + // $window.location.href = $location.path()+"?ref="+selected.ref; + } + }); }]); diff --git a/app/partials/form-releases.html b/app/partials/form-releases.html new file mode 100644 index 0000000..43ec66c --- /dev/null +++ b/app/partials/form-releases.html @@ -0,0 +1,3 @@ +