From 16262e3fd2c00475cc3b43a2684a45cc8ae70829 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 19 Feb 2014 17:56:12 +0100 Subject: Move isadmin to template and rename it to oc_isadmin --- core/js/js.js | 1 + 1 file changed, 1 insertion(+) (limited to 'core/js') diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e5..3b3e0e99455 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -10,6 +10,7 @@ var oc_webroot; var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); +var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin'); window.oc_config = window.oc_config || {}; -- cgit v1.2.3 From b61f0f11c5aa03240d3c18f02a1c790bd43522c0 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 20 Feb 2014 10:26:05 +0100 Subject: Move oc_isadmin to the config JS script --- core/js/config.php | 1 + core/js/js.js | 1 - core/templates/layout.user.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index b6875fb73f9..6185be523e7 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,6 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', + "ox_isadmin" => p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), diff --git a/core/js/js.js b/core/js/js.js index 3b3e0e99455..d4d2583f1e5 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -10,7 +10,6 @@ var oc_webroot; var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user'); var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); -var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin'); window.oc_config = window.oc_config || {}; diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index d46f97852cc..bc1c700402e 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -6,7 +6,7 @@ - + <?php p(!empty($_['application'])?$_['application'].' - ':''); -- cgit v1.2.3 From ba7a79372a1e7f29f8f9de015fcc8500b6fed8dc Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 10:28:11 +0100 Subject: Variable value is expected and not an echoed output --- core/js/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index 6185be523e7..a9fd9d01098 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,7 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', - "ox_isadmin" => p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); + "ox_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), -- cgit v1.2.3 From 169f4cf7ff26932ec1e07bfc3676f22c06859db7 Mon Sep 17 00:00:00 2001 From: Lukas Reschke <lukas@statuscode.ch> Date: Thu, 20 Feb 2014 12:51:15 +0100 Subject: Fix typo --- core/js/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js') diff --git a/core/js/config.php b/core/js/config.php index a9fd9d01098..139c3b6d485 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -24,7 +24,7 @@ foreach(OC_App::getEnabledApps() as $app) { $array = array( "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false', - "ox_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', + "oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"".OC::$WEBROOT."\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution "datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')), -- cgit v1.2.3 From 92d57cb5a7de41e576c9cbd3fae70e9802561187 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 13:36:52 +0100 Subject: move avatar into clickable area of user menu --- core/css/styles.css | 8 ++++---- core/js/js.js | 4 +++- core/templates/layout.user.php | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'core/js') diff --git a/core/css/styles.css b/core/css/styles.css index c17d0a9bc07..1c80a3ea160 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -37,11 +37,12 @@ body { background:#fefefe; font:normal .8em/1.6em "Helvetica Neue",Helvetica,Ari .header-right { float:right; vertical-align:middle; padding:0.5em; } .header-right > * { vertical-align:middle; } +/* Profile picture in header */ #header .avatardiv { float: left; display: inline-block; + margin-right: 5px; } - #header .avatardiv img { opacity: 1; } @@ -708,12 +709,11 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } /* USER MENU */ #settings { float: right; - margin-top: 7px; - margin-left: 10px; color: #bbb; } #expand { - padding: 15px 15px 15px 5px; + display: block; + padding: 7px 12px 6px 7px; cursor: pointer; font-weight: bold; } diff --git a/core/js/js.js b/core/js/js.js index d4d2583f1e5..59d48806418 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -860,6 +860,7 @@ function initCore() { // checkShowCredentials(); // $('input#user, input#password').keyup(checkShowCredentials); + // user menu $('#settings #expand').keydown(function(event) { if (event.which === 13 || event.which === 32) { $('#expand').click() @@ -872,7 +873,8 @@ function initCore() { $('#settings #expanddiv').click(function(event){ event.stopPropagation(); }); - $(document).click(function(){//hide the settings menu when clicking outside it + //hide the user menu when clicking outside it + $(document).click(function(){ $('#settings #expanddiv').slideUp(200); }); diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index bc1c700402e..8b9e1e0f4fe 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -50,12 +50,12 @@ <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> <div id="settings" class="svg"> <span id="expand" tabindex="0" role="link"> + <?php if ($_['enableAvatars']): ?> + <div class="avatardiv"></div> + <?php endif; ?> <span id="expandDisplayName"><?php p(trim($_['user_displayname']) != '' ? $_['user_displayname'] : $_['user_uid']) ?></span> <img class="svg" alt="" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /> </span> - <?php if ($_['enableAvatars']): ?> - <div class="avatardiv"></div> - <?php endif; ?> <div id="expanddiv"> <ul> <?php foreach($_['settingsnavigation'] as $entry):?> -- cgit v1.2.3 From 20b740f8e4674ab16f44127bc809a35b8db24910 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt <hey@jancborchardt.net> Date: Thu, 20 Feb 2014 13:37:23 +0100 Subject: do not show display name on mobile when profile picture is present --- core/css/mobile.css | 6 ++++++ core/js/avatar.js | 9 ++++++++- core/js/jquery.avatar.js | 10 +++++++++- settings/js/personal.js | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/css/mobile.css b/core/css/mobile.css index a4cca6f37f6..65c756aa91a 100644 --- a/core/css/mobile.css +++ b/core/css/mobile.css @@ -17,4 +17,10 @@ transition: width 100ms; } +/* do not show display name on mobile when profile picture is present */ +#header .avatardiv.avatardiv-shown + #expandDisplayName { + display: none; +} + + } diff --git a/core/js/avatar.js b/core/js/avatar.js index c54c4068768..67d6b9b7b95 100644 --- a/core/js/avatar.js +++ b/core/js/avatar.js @@ -1,6 +1,13 @@ $(document).ready(function(){ if (OC.currentUser) { - $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true); + var callback = function() { + // do not show display name on mobile when profile picture is present + if($('#header .avatardiv').children().length > 0) { + $('#header .avatardiv').addClass('avatardiv-shown'); + } + }; + + $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true, callback); // Personal settings $('#avatar .avatardiv').avatar(OC.currentUser, 128); } diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index 6012eccfad6..02a40c088b4 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -39,10 +39,15 @@ * This will behave like the first example, but it will hide the avatardiv, if * it will display the default placeholder. undefined is the ie8fix from * example 4 and can be either true, or false/undefined, to be ignored. + * + * 6. $('.avatardiv').avatar('jdoe', 128, undefined, true, callback); + * This will behave like the above example, but it will call the function + * defined in callback after the avatar is placed into the DOM. + * */ (function ($) { - $.fn.avatar = function(user, size, ie8fix, hidedefault) { + $.fn.avatar = function(user, size, ie8fix, hidedefault, callback) { if (typeof(size) === 'undefined') { if (this.height() > 0) { size = this.height(); @@ -91,6 +96,9 @@ $div.html('<img src="'+url+'">'); } } + if(typeof callback === 'function') { + callback(); + } }); }); }; diff --git a/settings/js/personal.js b/settings/js/personal.js index ef261b50bbc..5944272067b 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -52,9 +52,11 @@ function updateAvatar (hidedefault) { if(hidedefault) { $headerdiv.hide(); + $('#header .avatardiv').removeClass('avatardiv-shown'); } else { $headerdiv.css({'background-color': ''}); $headerdiv.avatar(OC.currentUser, 32, true); + $('#header .avatardiv').addClass('avatardiv-shown'); } $displaydiv.css({'background-color': ''}); $displaydiv.avatar(OC.currentUser, 128, true); -- cgit v1.2.3