Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"modernizr": "~2.8.3",
"html5-polyfills": "*",
"underscore": "~1.7.0",
"vue": "~0.11.5"
"vue": "~0.11.5",
"fetch": "~0.7.0"
},
"overrides": {
"jquery": {
Expand Down
28 changes: 24 additions & 4 deletions src/js/init/vue.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define(['domReady', 'vue', 'sidebar'], function(domReady, Vue, sidebar) {
define(['domReady', 'vue', 'sidebar', 'fetch'], function(domReady, Vue, sidebar, fetch) {
var init = function(data) {
Vue.filter('defaultIcon', function(value){
Vue.filter('defaultIcon', function(value) {
// Returns a default icon if no value is given
return value || 'cube';
});
Expand All @@ -15,7 +15,27 @@ define(['domReady', 'vue', 'sidebar'], function(domReady, Vue, sidebar) {
});
};

domReady(function(){
var initUsers = function(data) {
new Vue({
el: '#users',
data: {
title: 'Projects using APIS.is',
users: data.users
}
});
};

domReady(function() {
fetch('http://beta.apis.is/meta/users/')
.then(function(response) {
return response.json();
}).then(function(json) {
initUsers(json);
}).catch(function(err) {
// TODO: Error handling! ;)
console.error(err);
});

var data = [];
var request = new XMLHttpRequest();
request.open('GET', 'http://beta.apis.is/docs.json', true);
Expand All @@ -35,4 +55,4 @@ define(['domReady', 'vue', 'sidebar'], function(domReady, Vue, sidebar) {

request.send();
});
});
});
12 changes: 7 additions & 5 deletions src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

(function() {
require.config({
baseUrl: '/js',
Expand All @@ -24,6 +23,8 @@
modernizr: 'vendor/modernizr',
vue: 'vendor/vue',

fetch: 'vendor/fetch',

sidebar: 'kolibri/koli-sidebar',
smoothscroll: 'kolibri/koli-smoothscroll',
cssTranslate: 'kolibri/koli-css-translate',
Expand All @@ -37,10 +38,11 @@

},
shim: {
jquery: { exports: '$' },
jqEasing: { deps: ['jquery'] },
underscore: { exports: '_' },
modernizr: { exports: 'Modernizr' },
jquery: {exports: '$'},
jqEasing: {deps: ['jquery']},
underscore: {exports: '_'},
modernizr: {exports: 'Modernizr'},
fetch: {exports: 'fetch'},
}
});

Expand Down
Loading