Clean contextmenu.

This commit is contained in:
Lars Jung 2015-04-26 16:16:47 +02:00
parent 8d11090f7d
commit 2ed333ab82
4 changed files with 49 additions and 54 deletions

View file

@ -44,7 +44,6 @@
flex: 1 1 auto; flex: 1 1 auto;
order: 2; order: 2;
height: 48px; height: 48px;
font-size: 16px;
} }
#backlink { #backlink {

View file

@ -26,48 +26,48 @@
padding: 0; padding: 0;
list-style: none; list-style: none;
text-align: left; 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);
}
} }

View file

@ -14,7 +14,7 @@ modulejs.define('core/resource', ['_', 'config', 'core/settings'], function (_,
function icon(id) { function icon(id) {
var baseId = id.split('-')[0]; var baseId = (id || '').split('-')[0];
var href = config.theme[id] || config.theme[baseId]; var href = config.theme[id] || config.theme[baseId];
if (href) { if (href) {

View file

@ -43,18 +43,13 @@ modulejs.define('ext/contextmenu', ['_', '$', 'core/resource', 'core/settings'],
$(templateSep).appendTo($ul); $(templateSep).appendTo($ul);
} else if (entry.type === 'l') { } else if (entry.type === 'l') {
$(templateLabel) $(templateLabel).appendTo($ul)
.appendTo($ul) .find('.cm-text').text(entry.text);
.find('.cm-text')
.text(entry.text);
} else if (entry.type === 'e') { } else if (entry.type === 'e') {
$li = $(templateEntry) $li = $(templateEntry).appendTo($ul);
.appendTo($ul) $li.data('cm-id', entry.id);
.data('cm-id', entry.id) $li.find('.cm-text').text(entry.text);
.find('.cm-text')
.text(entry.text);
if (entry.icon) { if (entry.icon) {
$li.find('.cm-icon img').attr('src', resource.icon(entry.icon)); $li.find('.cm-icon img').attr('src', resource.icon(entry.icon));
} else { } else {
@ -137,6 +132,7 @@ modulejs.define('ext/contextmenu', ['_', '$', 'core/resource', 'core/settings'],
function init() { function init() {
// settings.enabled = true;
if (!settings.enabled) { if (!settings.enabled) {
return; return;
} }