* zin: support to update user toolbar after save user avatar.
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
window.updateUserAvatar = function(dialog)
|
||||
{
|
||||
const newSrc = $(dialog).find('.avatar-img').prop('src');
|
||||
const code = $('#toolbar').find('.avatar-img').dataset('code');
|
||||
$('.avatar-img[data-code="' + code + '"]').prop('src', newSrc);
|
||||
};
|
||||
@@ -18,11 +18,6 @@ class header extends wg
|
||||
'toolbar' => array('map' => 'btn')
|
||||
);
|
||||
|
||||
public static function getPageJS(): string|false
|
||||
{
|
||||
return file_get_contents(__DIR__ . DS . 'js' . DS . 'v1.js');
|
||||
}
|
||||
|
||||
protected function buildHeading()
|
||||
{
|
||||
if($this->hasBlock('heading')) return $this->block('heading');
|
||||
|
||||
@@ -730,6 +730,18 @@ function changeAppsTheme(theme)
|
||||
});
|
||||
}
|
||||
|
||||
function updateUserToolbar()
|
||||
{
|
||||
$.each(apps.openedMap, function(_code, app)
|
||||
{
|
||||
if(app.iframe && app.iframe.contentWindow && app.iframe.contentWindow.loadPage)
|
||||
{
|
||||
app.iframe.contentWindow.loadPage({selector: '#toolbar', partial: true, target: '#toolbar'});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
initAppsMenu();
|
||||
/* Refresh more menu on window resize */
|
||||
$(window).on('resize', refreshMenu);
|
||||
@@ -808,7 +820,8 @@ $.apps = $.extend(apps,
|
||||
getAppCode: getAppCode,
|
||||
updateAppsMenu: updateAppsMenu,
|
||||
changeAppsLang: changeAppsLang,
|
||||
changeAppsTheme: changeAppsTheme
|
||||
changeAppsTheme: changeAppsTheme,
|
||||
updateUserToolbar: updateUserToolbar
|
||||
});
|
||||
|
||||
window.notifyMessage = function(data)
|
||||
|
||||
@@ -996,7 +996,7 @@ class user extends control
|
||||
$this->app->user->avatar = $image->webPath;
|
||||
$this->session->set('user', $this->app->user);
|
||||
$this->dao->update(TABLE_USER)->set('avatar')->eq($image->webPath)->where('account')->eq($this->app->user->account)->exec();
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'callback' => "loadModal('" . $this->createLink('my', 'profile') . "', 'profile', {}, window.updateUserAvatar);"));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'callback' => "loadModal('" . $this->createLink('my', 'profile') . "', 'profile', {}, $.apps.updateUserToolbar);"));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->user->cropAvatar;
|
||||
|
||||
+7
-6
@@ -54,12 +54,13 @@
|
||||
if(DEBUG) console.log('[APP]', 'update:', {code, url, title});
|
||||
return state;
|
||||
},
|
||||
isOldPage: () => false,
|
||||
reloadApp: function(_code, url){loadPage(url);},
|
||||
openApp: function(url, options){loadPage(url, options);},
|
||||
goBack: function(){history.go(-1);},
|
||||
changeAppsLang: changeAppLang,
|
||||
changeAppsTheme: changeAppTheme
|
||||
isOldPage: () => false,
|
||||
reloadApp: function(_code, url){loadPage(url);},
|
||||
openApp: function(url, options){loadPage(url, options);},
|
||||
goBack: function(){history.go(-1);},
|
||||
changeAppsLang: changeAppLang,
|
||||
changeAppsTheme: changeAppTheme,
|
||||
updateUserToolbar: function(){loadPage({selector: '#toolbar', partial: true, target: '#toolbar'})},
|
||||
}, parent.window.$.apps);
|
||||
|
||||
const renderMap =
|
||||
|
||||
Reference in New Issue
Block a user