From aae26901b5fcfd2b4fda2442e006b3a92a5ba864 Mon Sep 17 00:00:00 2001 From: Raymond Benc Date: Mon, 27 Jul 2015 21:07:05 +0200 Subject: [PATCH] Updated how we handle AJAX notifications to users --- PF.Base/less/alerts.less | 41 ++++++++++++++- .../include/component/ajax/ajax.class.php | 5 +- .../controller/admincp/index.class.php | 6 +-- .../default/controller/profile.html.php | 8 +-- PF.Base/static/jscript/main.js | 17 +++++++ .../default/style/default/css/custom.css | 38 ++++++++++++-- .../default/style/default/less/alerts.less | 23 ++++++++- .../default/style/default/less/forms.less | 1 - PF.Base/theme/default/flavor/default.css | 50 ++++++++++++++++++- .../frontend/default/template/error.html.php | 2 + 10 files changed, 168 insertions(+), 23 deletions(-) diff --git a/PF.Base/less/alerts.less b/PF.Base/less/alerts.less index 31b3e03d..ce66a105 100644 --- a/PF.Base/less/alerts.less +++ b/PF.Base/less/alerts.less @@ -1,5 +1,5 @@ -div.public_message, div.message, div.error_message, .valid_message { +div.message, div.error_message, .valid_message { background:@brandInfo; color:@brandPrimaryColor; font-size:@fontSizeBase + 2; @@ -14,4 +14,43 @@ div.error_message { .valid_message { background:@brandSuccess; +} + +div.public_message { + .reset(); + + position:fixed; + bottom:0px; + left:0px; + right:0px; + height:50px; + line-height:50px; + margin-bottom:-50px; + display:none; + z-index:1000000; + background:fade(#2ecc71, 80%); + color:#fff; + font-size:18px; + font-weight:200; + text-align:center; +} + +.ajax_processing { + position:fixed; + top:5px; + right:0px; + z-index:100000000; + height:@headerHeight; + text-align:right; + /*background:@topBg;*/ + left:auto; + + + i { + display:inline-block; + font-size:20px; + color:@brandPrimary; + margin-right:10px; + vertical-align:middle; + } } \ No newline at end of file diff --git a/PF.Base/module/custom/include/component/ajax/ajax.class.php b/PF.Base/module/custom/include/component/ajax/ajax.class.php index cf7b4e2c..3046b8f3 100644 --- a/PF.Base/module/custom/include/component/ajax/ajax.class.php +++ b/PF.Base/module/custom/include/component/ajax/ajax.class.php @@ -150,13 +150,12 @@ public function updateFields() if ($bReturnCustom && $bReturnUser) { - $this->call('$(\'#js_custom_submit_button\').attr(\'disabled\', false).removeClass(\'disabled\'); $(\'#js_custom_update_info\').html(\''.str_replace("'", "\\'", Phpfox::getPhrase('user.done')).'\').fadeOut(5000);') - ->slideDown('#js_custom_public_message'); + $this->call('$(\'#public_message\').html(\'Profile successfully updated!\'); $Core.processingEnd(); $Core.loadInit();'); return true; } } - $this->call('$(\'#js_custom_submit_button\').attr(\'disabled\', false).removeClass(\'disabled\'); $(\'#js_custom_update_info\').hide();'); + $this->call('$(\'#js_custom_submit_button\').attr(\'disabled\', false).removeClass(\'disabled\'); $Core.processingEnd();'); } } diff --git a/PF.Base/module/language/include/component/controller/admincp/index.class.php b/PF.Base/module/language/include/component/controller/admincp/index.class.php index 33bfbbb3..2954f8f0 100644 --- a/PF.Base/module/language/include/component/controller/admincp/index.class.php +++ b/PF.Base/module/language/include/component/controller/admincp/index.class.php @@ -21,7 +21,7 @@ class Language_Component_Controller_Admincp_Index extends Phpfox_Component public function process() { Phpfox::getUserParam('language.can_manage_lang_packs', true); - + if (($sExportId = $this->request()->get('export'))) { $oArchiveExport = Phpfox::getLib('archive.export')->set(array('zip')); @@ -43,14 +43,14 @@ public function process() } } - if (PHPFOX_IS_TECHIE) { + // if (PHPFOX_IS_TECHIE) { $this->template()->setActionMenu([ 'New Language' => [ 'url' => $this->url()->makeUrl('admincp.language.add'), 'class' => 'popup' ] ]); - } + // } $this->template()->assign(array( 'aLanguages' => $aLanguages diff --git a/PF.Base/module/user/template/default/controller/profile.html.php b/PF.Base/module/user/template/default/controller/profile.html.php index a791ca4b..0c7fb4d9 100644 --- a/PF.Base/module/user/template/default/controller/profile.html.php +++ b/PF.Base/module/user/template/default/controller/profile.html.php @@ -27,13 +27,7 @@
- - -
- {phrase var='user.view_your_updated_profile'} -
- -
+ {if isset($iUserId)}
{/if} diff --git a/PF.Base/static/jscript/main.js b/PF.Base/static/jscript/main.js index 075a81ef..d68ce9eb 100644 --- a/PF.Base/static/jscript/main.js +++ b/PF.Base/static/jscript/main.js @@ -2192,6 +2192,23 @@ $Core.reloadPage = function() $Behavior.addModerationListener = function() { + var m = $('#public_message'); + if (m.length) { + var h = m.html().length; + if (h) { + m.show(); + m.animate({ + 'margin-bottom': '0px' + }, 'fast', function() { + setTimeout(function() { + m.animate({'margin-bottom': '-50px'}, 'fast', function() { + m.html('').hide(); + }); + }, 1100); + }); + } + } + $(window).on('moderation_ended', function(){ /* Search for moderation rows */ if ($('.moderation_row:visible').length < 1) diff --git a/PF.Base/theme/adminpanel/default/style/default/css/custom.css b/PF.Base/theme/adminpanel/default/style/default/css/custom.css index e7401155..3016b780 100644 --- a/PF.Base/theme/adminpanel/default/style/default/css/custom.css +++ b/PF.Base/theme/adminpanel/default/style/default/css/custom.css @@ -936,7 +936,6 @@ select:focus { } .js_box .table { padding: 0px; - margin-bottom: 10px; border: 0px; } .js_box .table_clear { @@ -1774,7 +1773,6 @@ div#main div.block div.bottom ul li a:hover { opacity: 1; } .error_message, -div.public_message, div.message { text-align: left; background: transparent; @@ -1800,18 +1798,48 @@ div.message { color: #ffffff; } .error_message a, -div.public_message a, div.message a, .error_message a:hover, -div.public_message a:hover, div.message a:hover { color: #ffffff !important; text-decoration: underline; } -div.public_message, div.message { background: #5bc0de; } +div.public_message { + text-align: left; + background: transparent; + border-radius: 0px; + box-shadow: none; + color: inherit; + height: auto; + line-height: normal; + position: static; + margin: 0; + padding: 0; + border: 0; + font: inherit; + font-size: 100%; + vertical-align: baseline; + width: auto; + float: none; + text-indent: 0px; + position: fixed; + bottom: 0px; + left: 0px; + right: 0px; + height: 50px; + line-height: 50px; + margin-bottom: -50px; + display: none; + z-index: 1000000; + background: rgba(46, 204, 113, 0.8); + color: #fff; + font-size: 18px; + font-weight: 200; + text-align: center; +} i._aa { background: #2980b9; } diff --git a/PF.Base/theme/adminpanel/default/style/default/less/alerts.less b/PF.Base/theme/adminpanel/default/style/default/less/alerts.less index 5a52d492..ce7b5afd 100644 --- a/PF.Base/theme/adminpanel/default/style/default/less/alerts.less +++ b/PF.Base/theme/adminpanel/default/style/default/less/alerts.less @@ -1,5 +1,5 @@ -.error_message, div.public_message, div.message { +.error_message, div.message { .reset(); .alert(); @@ -12,6 +12,25 @@ } } -div.public_message, div.message { +div.message { background:@brandInfo; +} + +div.public_message { + .reset(); + + position:fixed; + bottom:0px; + left:0px; + right:0px; + height:50px; + line-height:50px; + margin-bottom:-50px; + display:none; + z-index:1000000; + background:fade(#2ecc71, 80%); + color:#fff; + font-size:18px; + font-weight:200; + text-align:center; } \ No newline at end of file diff --git a/PF.Base/theme/adminpanel/default/style/default/less/forms.less b/PF.Base/theme/adminpanel/default/style/default/less/forms.less index 3b7fa805..6e7d664e 100644 --- a/PF.Base/theme/adminpanel/default/style/default/less/forms.less +++ b/PF.Base/theme/adminpanel/default/style/default/less/forms.less @@ -19,7 +19,6 @@ select, select:focus { .js_box { .table { padding:0px; - margin-bottom:10px; border:0px; } diff --git a/PF.Base/theme/default/flavor/default.css b/PF.Base/theme/default/flavor/default.css index 48e3b29f..c1a4d909 100644 --- a/PF.Base/theme/default/flavor/default.css +++ b/PF.Base/theme/default/flavor/default.css @@ -5919,7 +5919,6 @@ a.item_bar_approve:hover { /* Target only IE7 and IE8 with this hack */ opacity: 0.99; } -div.public_message, div.message, div.error_message, .valid_message { @@ -5936,6 +5935,55 @@ div.error_message { .valid_message { background: #5cb85c; } +div.public_message { + background: transparent; + border-radius: 0px; + box-shadow: none; + color: inherit; + height: auto; + line-height: normal; + position: static; + margin: 0; + padding: 0; + border: 0; + font: inherit; + font-size: 100%; + vertical-align: baseline; + width: auto; + float: none; + text-indent: 0px; + position: fixed; + bottom: 0px; + left: 0px; + right: 0px; + height: 50px; + line-height: 50px; + margin-bottom: -50px; + display: none; + z-index: 1000000; + background: rgba(46, 204, 113, 0.8); + color: #fff; + font-size: 18px; + font-weight: 200; + text-align: center; +} +.ajax_processing { + position: fixed; + top: 5px; + right: 0px; + z-index: 100000000; + height: 40px; + text-align: right; + /*background:@topBg;*/ + left: auto; +} +.ajax_processing i { + display: inline-block; + font-size: 20px; + color: #298ada; + margin-right: 10px; + vertical-align: middle; +} #left #js_block_border_music_list, #right #js_block_border_music_list { border: 1px #dbdbdb solid; diff --git a/PF.Base/theme/frontend/default/template/error.html.php b/PF.Base/theme/frontend/default/template/error.html.php index 1112f9f8..ce7cf31d 100644 --- a/PF.Base/theme/frontend/default/template/error.html.php +++ b/PF.Base/theme/frontend/default/template/error.html.php @@ -25,6 +25,8 @@ $('#public_message').show(); {r}; +{else} +
{/if}