blue-twilight/resources/assets/js/admin.js

47 lines
1.3 KiB
JavaScript

/**
* This model is used by admin/about.blade.php, to perform a version check against Github.
* @constructor
*/
function AboutViewModel(urls) {
this.el = '#about-app';
this.data = {
can_upgrade: false,
is_loading: true,
version_body: '',
version_date: '',
version_name: '',
version_url: ''
};
this.computed = {
};
this.methods = {
init: function () {
var self = this;
$.ajax(
urls.latest_release_url,
{
complete: function() {
self.is_loading = false;
},
dataType: 'json',
error: function (xhr, textStatus, errorThrown) {
},
method: 'GET',
success: function (data) {
self.version_body = data.body;
self.version_date = data.publish_date;
self.version_name = data.name;
self.version_url = data.url;
// Set this last so any watchers on this property execute after all version data has been set
self.can_upgrade = data.can_upgrade;
}
}
);
}
};
}