mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] Clean use of store.set(url). Get url value ASAP.
This commit is contained in:
parent
04cd9dfbf5
commit
ce6b5c9940
3 changed files with 28 additions and 24 deletions
|
@ -91,9 +91,10 @@
|
|||
|
||||
c.checkInstall(function(isInstalled) {
|
||||
if (isInstalled) {
|
||||
domain = window.location.hostname;
|
||||
// Remove loader
|
||||
$('div.loader').remove();
|
||||
c.view('login', { 'domain': domain });
|
||||
// Pass domain to hide form field
|
||||
c.view('login', { 'domain': window.location.hostname });
|
||||
} else if (typeof isInstalled === 'undefined') {
|
||||
if (app.isInstalledTry > 0) {
|
||||
app.isInstalledTry--;
|
||||
|
@ -134,6 +135,7 @@
|
|||
*/
|
||||
|
||||
app.post('#/login', function (c) {
|
||||
// Store url from params, it could have change form 'run' state
|
||||
store.set('url', c.params['domain'] +'/yunohost/api');
|
||||
|
||||
params = {
|
||||
|
|
|
@ -43,10 +43,9 @@
|
|||
},
|
||||
|
||||
checkInstall: function(callback) {
|
||||
domain = window.location.hostname;
|
||||
$.ajax({
|
||||
dataType: "json",
|
||||
url: 'https://'+ domain +'/yunohost/api/installed',
|
||||
url: 'https://'+ store.get('url') +'/installed',
|
||||
timeout: 3000
|
||||
})
|
||||
.success(function(data) {
|
||||
|
@ -82,7 +81,7 @@
|
|||
}
|
||||
|
||||
jQuery.ajax({
|
||||
url: 'https://'+ store.get('url') + uri,
|
||||
url: 'https://' + store.get('url') + uri,
|
||||
type: method,
|
||||
crossdomain: true,
|
||||
data: data,
|
||||
|
|
|
@ -3,25 +3,6 @@
|
|||
var app = Sammy('#main', function (sam) {
|
||||
|
||||
|
||||
/**
|
||||
* Application bootstrap
|
||||
*
|
||||
*/
|
||||
sam.bind('run', function () {
|
||||
|
||||
// Flash messages
|
||||
var flashMessage = $('#flashMessage');
|
||||
$('#toggle-btn', flashMessage).click(function(e) {
|
||||
flashMessage.toggleClass('open');
|
||||
});
|
||||
$('#clear-btn', flashMessage).click(function(e) {
|
||||
flashMessage.removeClass('open').find('.messages').html('');
|
||||
$('#slider').removeClass('with-flashMessage');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Sammy Configuration
|
||||
*
|
||||
|
@ -80,6 +61,28 @@
|
|||
sam.isInstalledTry = 3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Application bootstrap
|
||||
*
|
||||
*/
|
||||
sam.bind('run', function () {
|
||||
// Store url
|
||||
sam.store.set('url', window.location.hostname + '/yunohost/api');
|
||||
|
||||
// Flash messages
|
||||
var flashMessage = $('#flashMessage');
|
||||
$('#toggle-btn', flashMessage).click(function(e) {
|
||||
flashMessage.toggleClass('open');
|
||||
});
|
||||
$('#clear-btn', flashMessage).click(function(e) {
|
||||
flashMessage.removeClass('open').find('.messages').html('');
|
||||
$('#slider').removeClass('with-flashMessage');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Errors
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue