feat(nav): deep-align menu_search panel, pill radius, senior media
- Layout-2 remote-box AJAX panel (history/hot/posts) via aksrt_menu_search - Live suggestions for post/topic/product; local history for guests - Publish radius switch (zibll bool pill) mapped to CSS radius class - Senior menu editor: WP media library image picker - Active menu underline + panel CSS; acceptance/contract updates
This commit is contained in:
1 parent
2a11a889c3
commit
159a12c481
14 files changed
+494
-117
No files matched your search
@@ -39,11 +39,15 @@
|
||||
};
|
||||
}
|
||||
|
||||
function field(name, label, value, type) {
|
||||
function field(name, label, value, type, withMedia) {
|
||||
type = type || 'text';
|
||||
var mediaBtn = withMedia
|
||||
? ' <button type="button" class="button aksrt-sme-pick-img" data-for="' + name + '">选择图片</button>'
|
||||
: '';
|
||||
return (
|
||||
'<label class="aksrt-sme-field"><span>' +
|
||||
label +
|
||||
mediaBtn +
|
||||
'</span><input type="' +
|
||||
type +
|
||||
'" data-name="' +
|
||||
@@ -62,7 +66,7 @@
|
||||
html += '<div class="aksrt-sme-card" data-index="' + i + '">';
|
||||
html += '<div class="aksrt-sme-card-head"><strong>卡片 #' + (i + 1) + '</strong>';
|
||||
html += ' <button type="button" class="button-link-delete aksrt-sme-del-card">删除</button></div>';
|
||||
html += field('img', '图片 URL', item.img || '');
|
||||
html += field('img', '图片 URL', item.img || '', 'text', true);
|
||||
html += field('title', '标题', item.title || '');
|
||||
html += field('badge', '徽章', item.badge || '');
|
||||
html += field('badge_class', '徽章 class', item.badge_class || '');
|
||||
@@ -236,6 +240,24 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '.aksrt-sme-pick-img', function (e) {
|
||||
e.preventDefault();
|
||||
var $btn = $(this);
|
||||
var name = $btn.data('for');
|
||||
var $input = $btn.closest('.aksrt-sme-field').find('input[data-name="' + name + '"]');
|
||||
if (typeof wp === 'undefined' || !wp.media) {
|
||||
window.alert('媒体库不可用');
|
||||
return;
|
||||
}
|
||||
var frame = wp.media({ title: '选择图片', button: { text: '使用此图' }, multiple: false, library: { type: 'image' } });
|
||||
frame.on('select', function () {
|
||||
var att = frame.state().get('selection').first().toJSON();
|
||||
if (att && att.url) $input.val(att.url).trigger('change');
|
||||
});
|
||||
frame.open();
|
||||
});
|
||||
|
||||
$(boot);
|
||||
$(document).on('menu-item-added', function () {
|
||||
setTimeout(boot, 50);
|
||||
|
||||
Reference in new issue
Block a user