From 2ed333ab8235f82c2beba1063c2c01d7c575a3a9 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Sun, 26 Apr 2015 16:16:47 +0200 Subject: [PATCH] Clean contextmenu. --- src/_h5ai/client/css/inc/core/topbar.less | 1 - src/_h5ai/client/css/inc/ext/contextmenu.less | 84 +++++++++---------- src/_h5ai/client/js/inc/core/resource.js | 2 +- src/_h5ai/client/js/inc/ext/contextmenu.js | 16 ++-- 4 files changed, 49 insertions(+), 54 deletions(-) diff --git a/src/_h5ai/client/css/inc/core/topbar.less b/src/_h5ai/client/css/inc/core/topbar.less index c9690485..ba5161c0 100644 --- a/src/_h5ai/client/css/inc/core/topbar.less +++ b/src/_h5ai/client/css/inc/core/topbar.less @@ -44,7 +44,6 @@ flex: 1 1 auto; order: 2; height: 48px; - font-size: 16px; } #backlink { diff --git a/src/_h5ai/client/css/inc/ext/contextmenu.less b/src/_h5ai/client/css/inc/ext/contextmenu.less index 60ccc95d..b0fdea0f 100644 --- a/src/_h5ai/client/css/inc/ext/contextmenu.less +++ b/src/_h5ai/client/css/inc/ext/contextmenu.less @@ -26,48 +26,48 @@ padding: 0; list-style: none; text-align: left; - - .cm-label { - padding: 8px 16px; - white-space: nowrap; - font-weight: bold; - } - - .cm-entry { - padding: 8px 16px; - white-space: nowrap; - cursor: pointer; - - &:hover { - color: @col-text-hover; - background: @col-grey-100; - } - - .cm-icon { - position: relative; - top: -2px; - - img { - width: 20px; - height: 20px; - } - - &.no-icon { - opacity: 0; - } - } - - .cm-text { - margin: 0 0 0 12px; - } - } - - .cm-sep { - height: 1px; - margin: 8px 0; - padding: 0; - border-top: 1px solid rgba(0,0,0,0.08); - } } } + + .cm-label { + padding: 8px 16px; + white-space: nowrap; + font-weight: bold; + } + + .cm-entry { + padding: 8px 16px; + white-space: nowrap; + cursor: pointer; + + &:hover { + color: @col-text-hover; + background: @col-grey-100; + } + } + + .cm-icon { + position: relative; + top: -2px; + + img { + width: 20px; + height: 20px; + } + + &.no-icon { + opacity: 0; + } + } + + .cm-text { + margin: 0 0 0 12px; + } + + .cm-sep { + height: 1px; + margin: 8px 0; + padding: 0; + border-top: 1px solid rgba(0,0,0,0.08); + } } diff --git a/src/_h5ai/client/js/inc/core/resource.js b/src/_h5ai/client/js/inc/core/resource.js index 47228e00..25d53d60 100644 --- a/src/_h5ai/client/js/inc/core/resource.js +++ b/src/_h5ai/client/js/inc/core/resource.js @@ -14,7 +14,7 @@ modulejs.define('core/resource', ['_', 'config', 'core/settings'], function (_, function icon(id) { - var baseId = id.split('-')[0]; + var baseId = (id || '').split('-')[0]; var href = config.theme[id] || config.theme[baseId]; if (href) { diff --git a/src/_h5ai/client/js/inc/ext/contextmenu.js b/src/_h5ai/client/js/inc/ext/contextmenu.js index d0174d38..7161c94b 100644 --- a/src/_h5ai/client/js/inc/ext/contextmenu.js +++ b/src/_h5ai/client/js/inc/ext/contextmenu.js @@ -43,18 +43,13 @@ modulejs.define('ext/contextmenu', ['_', '$', 'core/resource', 'core/settings'], $(templateSep).appendTo($ul); } else if (entry.type === 'l') { - $(templateLabel) - .appendTo($ul) - .find('.cm-text') - .text(entry.text); + $(templateLabel).appendTo($ul) + .find('.cm-text').text(entry.text); } else if (entry.type === 'e') { - $li = $(templateEntry) - .appendTo($ul) - .data('cm-id', entry.id) - .find('.cm-text') - .text(entry.text); - + $li = $(templateEntry).appendTo($ul); + $li.data('cm-id', entry.id); + $li.find('.cm-text').text(entry.text); if (entry.icon) { $li.find('.cm-icon img').attr('src', resource.icon(entry.icon)); } else { @@ -137,6 +132,7 @@ modulejs.define('ext/contextmenu', ['_', '$', 'core/resource', 'core/settings'], function init() { + // settings.enabled = true; if (!settings.enabled) { return; }