2017-10-01 16:48:50 +01:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
2018-09-14 11:02:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This model is used by admin/settings.blade.php.
|
|
|
|
* @constructor
|
|
|
|
*/
|
2018-09-14 11:14:39 +01:00
|
|
|
function SettingsViewModel(urls, lang) {
|
2018-09-14 11:02:08 +01:00
|
|
|
this.el = '#settings-app';
|
|
|
|
|
|
|
|
this.data = {
|
|
|
|
is_rebuilding_permissions_cache: false
|
|
|
|
};
|
|
|
|
|
|
|
|
this.methods = {
|
2018-09-14 11:14:39 +01:00
|
|
|
rebuildPermissionsCache: function (e) {
|
2018-09-14 11:02:08 +01:00
|
|
|
var self = this;
|
|
|
|
|
|
|
|
$.ajax(
|
|
|
|
urls.rebuild_permissions_cache,
|
|
|
|
{
|
|
|
|
complete: function() {
|
|
|
|
self.is_rebuilding_permissions_cache = false;
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
error: function (xhr, textStatus, errorThrown) {
|
2018-09-14 11:14:39 +01:00
|
|
|
alert(lang.permissions_cache_rebuild_failed);
|
2018-09-14 11:02:08 +01:00
|
|
|
},
|
2018-09-14 11:14:39 +01:00
|
|
|
method: 'POST',
|
2018-09-14 11:02:08 +01:00
|
|
|
success: function (data) {
|
2018-09-14 11:14:39 +01:00
|
|
|
alert(lang.permissions_cache_rebuild_succeeded);
|
2018-09-14 11:02:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2018-09-14 11:14:39 +01:00
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
2018-09-14 11:02:08 +01:00
|
|
|
}
|
|
|
|
};
|
2017-10-01 16:48:50 +01:00
|
|
|
}
|