Macro Split Button has been taken around the back along with its C# Control
This commit is contained in:
@@ -357,15 +357,10 @@
|
||||
<Content Include="Umbraco_Client\Dialogs\AssignDomain2.css" />
|
||||
<Content Include="Umbraco_Client\Dialogs\UmbracoField.js" />
|
||||
<Content Include="Umbraco_Client\PunyCode\punycode.min.js" />
|
||||
<Content Include="Umbraco_Client\Splitbutton\InsertMacroSplitButton.js" />
|
||||
<Content Include="Umbraco_Client\Tablesorting\img\asc.gif" />
|
||||
<Content Include="Umbraco_Client\Tablesorting\img\desc.gif" />
|
||||
<Content Include="Umbraco_Client\Tablesorting\jquery.tablesorter.min.js" />
|
||||
<Content Include="Umbraco_Client\Splitbutton\jquery.splitbutton.js" />
|
||||
<Content Include="Umbraco_Client\Application\JQuery\jquery.hotkeys.js" />
|
||||
<Content Include="Umbraco_Client\Splitbutton\Images\splitbutton_hover.png" />
|
||||
<Content Include="Umbraco_Client\Splitbutton\Images\splitbutton_downarrow.png" />
|
||||
<Content Include="Umbraco_Client\Splitbutton\splitbutton.css" />
|
||||
<Content Include="Umbraco_Client\Modal\jquery.simplemodal.1.4.1.custom.js" />
|
||||
<Content Include="Umbraco\Config\Lang\ko.xml" />
|
||||
<Content Include="Umbraco\Dashboard\FeedProxy.aspx" />
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
|
||||
(function ($) {
|
||||
|
||||
Umbraco.Controls.InsertMacroSplitButton = base2.Base.extend({
|
||||
|
||||
//private methods/variables
|
||||
_opts: null,
|
||||
|
||||
// Constructor
|
||||
constructor: function (opts) {
|
||||
// Merge options with default
|
||||
this._opts = $.extend({
|
||||
// Default options go here
|
||||
}, opts);
|
||||
},
|
||||
|
||||
//public methods/variables
|
||||
|
||||
init: function () {
|
||||
var self = this;
|
||||
|
||||
//the container is the 'scope' of which to find .sbPlaceHolder's, by default it is null so the scope is the whole page
|
||||
var container = this._opts.container != null ? this._opts.container : null;
|
||||
|
||||
//setup the split buttons, find all .sbPlaceHolder's and assign the menu to it which should always
|
||||
//be the previous element with the class .sbMenu
|
||||
var splitButtons = $('.sbPlaceHolder', container);
|
||||
splitButtons.each(function() {
|
||||
var menu = $(this).prev(".sbMenu");
|
||||
$(this).find("a.sbLink").splitbutton({ menu: menu });
|
||||
});
|
||||
|
||||
//assign the click handler to each macro item drop down
|
||||
$(".sbMenu .macro-item").click(function () {
|
||||
var alias = $(this).attr("rel");
|
||||
if ($(this).attr("data-has-params") == "true") {
|
||||
self._opts.openMacroModel.apply(self, [alias]);
|
||||
}
|
||||
else {
|
||||
self._opts.insertMacroMarkup.apply(self, [alias]);
|
||||
}
|
||||
});
|
||||
|
||||
//assign the callback for the regular insert macro button (not the drop down)
|
||||
$(".sbPlaceHolder a.sbLink").click(function() {
|
||||
self._opts.openMacroModel.apply(self, []); //call the callback with no alias
|
||||
});
|
||||
|
||||
//a fix for scroll issues TODO: put this code in this class and make it flexible (i.e. NOT with ids)
|
||||
//applySplitButtonOverflow('mcontainer', 'innerc', 'macroMenu', '.macro-item', 'showMoreMacros');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 130 B |
Binary file not shown.
|
Before Width: | Height: | Size: 149 B |
@@ -1,530 +0,0 @@
|
||||
(function ($) {
|
||||
function _1(_2) {
|
||||
$(_2).appendTo("body");
|
||||
$(_2).addClass("menu-top");
|
||||
var _3 = [];
|
||||
_4($(_2));
|
||||
var _5 = null;
|
||||
for (var i = 0; i < _3.length; i++) {
|
||||
var _6 = _3[i];
|
||||
_7(_6);
|
||||
_6.children("div.menu-item").each(function () {
|
||||
_10(_2, $(this));
|
||||
});
|
||||
_6.bind("mouseenter", function () {
|
||||
if (_5) {
|
||||
clearTimeout(_5);
|
||||
_5 = null;
|
||||
}
|
||||
}).bind("mouseleave", function () {
|
||||
_5 = setTimeout(function () {
|
||||
_18(_2);
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
function _4(_8) {
|
||||
_3.push(_8);
|
||||
_8.find(">div").each(function () {
|
||||
var _9 = $(this);
|
||||
var _a = _9.find(">div");
|
||||
if (_a.length) {
|
||||
_a.insertAfter(_2);
|
||||
_9[0].submenu = _a;
|
||||
_4(_a);
|
||||
}
|
||||
});
|
||||
};
|
||||
function _7(_b) {
|
||||
_b.addClass("menu").find(">div").each(function () {
|
||||
var _c = $(this);
|
||||
if (_c.hasClass("menu-sep")) {
|
||||
_c.html(" ");
|
||||
} else {
|
||||
var _d = _c.addClass("menu-item").html();
|
||||
_c.empty().append($("<div class=\"menu-text\"></div>").html(_d));
|
||||
var _e = _c.attr("iconCls") || _c.attr("icon");
|
||||
if (_e) {
|
||||
$("<div class=\"menu-icon\"></div>").addClass(_e).appendTo(_c);
|
||||
}
|
||||
if (_c[0].submenu) {
|
||||
$("<div class=\"menu-rightarrow\"></div>").appendTo(_c);
|
||||
}
|
||||
if ($.boxModel == true) {
|
||||
var _f = _c.height();
|
||||
_c.height(_f - (_c.outerHeight() - _c.height()));
|
||||
}
|
||||
}
|
||||
});
|
||||
_b.hide();
|
||||
};
|
||||
};
|
||||
function _10(_11, _12) {
|
||||
_12.click(function () {
|
||||
if (!this.submenu) {
|
||||
_18(_11);
|
||||
var _13 = $(this).attr("href");
|
||||
if (_13) {
|
||||
location.href = _13;
|
||||
}
|
||||
}
|
||||
var _14 = $(_11).menu("getItem", this);
|
||||
$.data(_11, "menu").options.onClick.call(_11, _14);
|
||||
});
|
||||
_12.hover(function () {
|
||||
_12.siblings().each(function () {
|
||||
if (this.submenu) {
|
||||
_1b(this.submenu);
|
||||
}
|
||||
$(this).removeClass("menu-active");
|
||||
});
|
||||
_12.addClass("menu-active");
|
||||
var _15 = _12[0].submenu;
|
||||
if (_15) {
|
||||
var _16 = _12.offset().left + _12.outerWidth() - 2;
|
||||
if (_16 + _15.outerWidth() > $(window).width()) {
|
||||
_16 = _12.offset().left - _15.outerWidth() + 2;
|
||||
}
|
||||
_1f(_15, { left: _16, top: _12.offset().top - 3 });
|
||||
}
|
||||
}, function (e) {
|
||||
_12.removeClass("menu-active");
|
||||
var _17 = _12[0].submenu;
|
||||
if (_17) {
|
||||
if (e.pageX >= parseInt(_17.css("left"))) {
|
||||
_12.addClass("menu-active");
|
||||
} else {
|
||||
_1b(_17);
|
||||
}
|
||||
} else {
|
||||
_12.removeClass("menu-active");
|
||||
}
|
||||
});
|
||||
_12.unbind(".menu").bind("mousedown.menu", function () {
|
||||
return false;
|
||||
});
|
||||
};
|
||||
function _18(_19) {
|
||||
var _1a = $.data(_19, "menu").options;
|
||||
_1b($(_19));
|
||||
$(document).unbind(".menu");
|
||||
_1a.onHide.call(_19);
|
||||
return false;
|
||||
};
|
||||
function _1c(_1d, pos) {
|
||||
var _1e = $.data(_1d, "menu").options;
|
||||
if (pos) {
|
||||
_1e.left = pos.left;
|
||||
_1e.top = pos.top;
|
||||
}
|
||||
_1f($(_1d), { left: _1e.left, top: _1e.top }, function () {
|
||||
$(document).unbind(".menu").bind("mousedown.menu", function () {
|
||||
_18(_1d);
|
||||
$(document).unbind(".menu");
|
||||
return false;
|
||||
});
|
||||
_1e.onShow.call(_1d);
|
||||
});
|
||||
};
|
||||
function _1f(_20, pos, _21) {
|
||||
if (!_20) {
|
||||
return;
|
||||
}
|
||||
if (pos) {
|
||||
_20.css(pos);
|
||||
}
|
||||
_20.show(0, function () {
|
||||
if (!_20[0].shadow) {
|
||||
_20[0].shadow = $("<div class=\"menu-shadow\"></div>").insertAfter(_20);
|
||||
}
|
||||
_20[0].shadow.css({ display: "block", zIndex: $.fn.menu.defaults.zIndex++, left: _20.css("left"), top: _20.css("top"), width: _20.outerWidth(), height: _20.outerHeight() });
|
||||
_20.css("z-index", $.fn.menu.defaults.zIndex++);
|
||||
if (_21) {
|
||||
_21();
|
||||
}
|
||||
});
|
||||
};
|
||||
function _1b(_22) {
|
||||
if (!_22) {
|
||||
return;
|
||||
}
|
||||
_23(_22);
|
||||
_22.find("div.menu-item").each(function () {
|
||||
if (this.submenu) {
|
||||
_1b(this.submenu);
|
||||
}
|
||||
$(this).removeClass("menu-active");
|
||||
});
|
||||
function _23(m) {
|
||||
m.stop(true, true);
|
||||
if (m[0].shadow) {
|
||||
m[0].shadow.hide();
|
||||
}
|
||||
m.hide();
|
||||
};
|
||||
};
|
||||
function _24(_25, _26) {
|
||||
var _27 = null;
|
||||
var tmp = $("<div></div>");
|
||||
function _28(_29) {
|
||||
_29.children("div.menu-item").each(function () {
|
||||
var _2a = $(_25).menu("getItem", this);
|
||||
var s = tmp.empty().html(_2a.text).text();
|
||||
if (_26 == $.trim(s)) {
|
||||
_27 = _2a;
|
||||
} else {
|
||||
if (this.submenu && !_27) {
|
||||
_28(this.submenu);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
_28($(_25));
|
||||
tmp.remove();
|
||||
return _27;
|
||||
};
|
||||
function _2b(_2c, _2d) {
|
||||
var _2e = $(_2c);
|
||||
if (_2d.parent) {
|
||||
_2e = _2d.parent.submenu;
|
||||
}
|
||||
var _2f = $("<div class=\"menu-item\"></div>").appendTo(_2e);
|
||||
$("<div class=\"menu-text\"></div>").html(_2d.text).appendTo(_2f);
|
||||
if (_2d.iconCls) {
|
||||
$("<div class=\"menu-icon\"></div>").addClass(_2d.iconCls).appendTo(_2f);
|
||||
}
|
||||
if (_2d.id) {
|
||||
_2f.attr("id", _2d.id);
|
||||
}
|
||||
if (_2d.href) {
|
||||
_2f.attr("href", _2d.href);
|
||||
}
|
||||
if (_2d.onclick) {
|
||||
_2f.attr("onclick", _2d.onclick);
|
||||
}
|
||||
_10(_2c, _2f);
|
||||
};
|
||||
function _30(_31, _32) {
|
||||
function _33(el) {
|
||||
if (el.submenu) {
|
||||
el.submenu.children("div.menu-item").each(function () {
|
||||
_33(this);
|
||||
});
|
||||
var _34 = el.submenu[0].shadow;
|
||||
if (_34) {
|
||||
_34.remove();
|
||||
}
|
||||
el.submenu.remove();
|
||||
}
|
||||
$(el).remove();
|
||||
};
|
||||
_33(_32);
|
||||
};
|
||||
function _35(_36) {
|
||||
$(_36).children("div.menu-item").each(function () {
|
||||
_30(_36, this);
|
||||
});
|
||||
if (_36.shadow) {
|
||||
_36.shadow.remove();
|
||||
}
|
||||
$(_36).remove();
|
||||
};
|
||||
$.fn.menu = function (_37, _38) {
|
||||
if (typeof _37 == "string") {
|
||||
return $.fn.menu.methods[_37](this, _38);
|
||||
}
|
||||
_37 = _37 || {};
|
||||
return this.each(function () {
|
||||
var _39 = $.data(this, "menu");
|
||||
if (_39) {
|
||||
$.extend(_39.options, _37);
|
||||
} else {
|
||||
_39 = $.data(this, "menu", { options: $.extend({}, $.fn.menu.defaults, _37) });
|
||||
_1(this);
|
||||
}
|
||||
$(this).css({ left: _39.options.left, top: _39.options.top });
|
||||
});
|
||||
};
|
||||
$.fn.menu.methods = { show: function (jq, pos) {
|
||||
return jq.each(function () {
|
||||
_1c(this, pos);
|
||||
});
|
||||
}, hide: function (jq) {
|
||||
return jq.each(function () {
|
||||
_18(this);
|
||||
});
|
||||
}, destroy: function (jq) {
|
||||
return jq.each(function () {
|
||||
_35(this);
|
||||
});
|
||||
}, setText: function (jq, _3a) {
|
||||
return jq.each(function () {
|
||||
$(_3a.target).children("div.menu-text").html(_3a.text);
|
||||
});
|
||||
}, setIcon: function (jq, _3b) {
|
||||
return jq.each(function () {
|
||||
var _3c = $(this).menu("getItem", _3b.target);
|
||||
if (_3c.iconCls) {
|
||||
$(_3c.target).children("div.menu-icon").removeClass(_3c.iconCls).addClass(_3b.iconCls);
|
||||
} else {
|
||||
$("<div class=\"menu-icon\"></div>").addClass(_3b.iconCls).appendTo(_3b.target);
|
||||
}
|
||||
});
|
||||
}, getItem: function (jq, _3d) {
|
||||
var _3e = { target: _3d, id: $(_3d).attr("id"), text: $.trim($(_3d).children("div.menu-text").html()), href: $(_3d).attr("href"), onclick: $(_3d).attr("onclick") };
|
||||
var _3f = $(_3d).children("div.menu-icon");
|
||||
if (_3f.length) {
|
||||
var cc = [];
|
||||
var aa = _3f.attr("class").split(" ");
|
||||
for (var i = 0; i < aa.length; i++) {
|
||||
if (aa[i] != "menu-icon") {
|
||||
cc.push(aa[i]);
|
||||
}
|
||||
}
|
||||
_3e.iconCls = cc.join(" ");
|
||||
}
|
||||
return _3e;
|
||||
}, findItem: function (jq, _40) {
|
||||
return _24(jq[0], _40);
|
||||
}, appendItem: function (jq, _41) {
|
||||
return jq.each(function () {
|
||||
_2b(this, _41);
|
||||
});
|
||||
}, removeItem: function (jq, _42) {
|
||||
return jq.each(function () {
|
||||
_30(this, _42);
|
||||
});
|
||||
}
|
||||
};
|
||||
$.fn.menu.defaults = { zIndex: 110000, left: 0, top: 0, onShow: function () {
|
||||
}, onHide: function () {
|
||||
}, onClick: function (_43) {
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
(function ($) {
|
||||
function _1(_2) {
|
||||
var _3 = $.data(_2, "linkbutton").options;
|
||||
$(_2).empty();
|
||||
$(_2).addClass("l-btn");
|
||||
if (_3.id) {
|
||||
$(_2).attr("id", _3.id);
|
||||
} else {
|
||||
$(_2).removeAttr("id");
|
||||
}
|
||||
if (_3.plain) {
|
||||
$(_2).addClass("l-btn-plain");
|
||||
} else {
|
||||
$(_2).removeClass("l-btn-plain");
|
||||
}
|
||||
if (_3.text) {
|
||||
$(_2).html(_3.text).wrapInner("<span class=\"l-btn-left\">" + "<span class=\"l-btn-text\">" + "</span>" + "</span>");
|
||||
if (_3.iconCls) {
|
||||
$(_2).find(".l-btn-text").addClass(_3.iconCls).css("padding-left", "20px");
|
||||
}
|
||||
} else {
|
||||
$(_2).html(" ").wrapInner("<span class=\"l-btn-left\">" + "<span class=\"l-btn-text\">" + "<span class=\"l-btn-empty\"></span>" + "</span>" + "</span>");
|
||||
if (_3.iconCls) {
|
||||
$(_2).find(".l-btn-empty").addClass(_3.iconCls);
|
||||
}
|
||||
}
|
||||
_4(_2, _3.disabled);
|
||||
};
|
||||
function _4(_5, _6) {
|
||||
var _7 = $.data(_5, "linkbutton");
|
||||
if (_6) {
|
||||
_7.options.disabled = true;
|
||||
var _8 = $(_5).attr("href");
|
||||
if (_8) {
|
||||
_7.href = _8;
|
||||
$(_5).attr("href", "javascript:void(0)");
|
||||
}
|
||||
var _9 = $(_5).attr("onclick");
|
||||
if (_9) {
|
||||
_7.onclick = _9;
|
||||
$(_5).attr("onclick", "");
|
||||
}
|
||||
$(_5).addClass("l-btn-disabled");
|
||||
} else {
|
||||
_7.options.disabled = false;
|
||||
if (_7.href) {
|
||||
$(_5).attr("href", _7.href);
|
||||
}
|
||||
if (_7.onclick) {
|
||||
_5.onclick = _7.onclick;
|
||||
}
|
||||
$(_5).removeClass("l-btn-disabled");
|
||||
}
|
||||
};
|
||||
$.fn.linkbutton = function (_a, _b) {
|
||||
if (typeof _a == "string") {
|
||||
return $.fn.linkbutton.methods[_a](this, _b);
|
||||
}
|
||||
_a = _a || {};
|
||||
return this.each(function () {
|
||||
var _c = $.data(this, "linkbutton");
|
||||
if (_c) {
|
||||
$.extend(_c.options, _a);
|
||||
} else {
|
||||
$.data(this, "linkbutton", { options: $.extend({}, $.fn.linkbutton.defaults, $.fn.linkbutton.parseOptions(this), _a) });
|
||||
$(this).removeAttr("disabled");
|
||||
}
|
||||
_1(this);
|
||||
});
|
||||
};
|
||||
$.fn.linkbutton.methods = { options: function (jq) {
|
||||
return $.data(jq[0], "linkbutton").options;
|
||||
}, enable: function (jq) {
|
||||
return jq.each(function () {
|
||||
_4(this, false);
|
||||
});
|
||||
}, disable: function (jq) {
|
||||
return jq.each(function () {
|
||||
_4(this, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
$.fn.linkbutton.parseOptions = function (_d) {
|
||||
var t = $(_d);
|
||||
return { id: t.attr("id"), disabled: (t.attr("disabled") ? true : undefined), plain: (t.attr("plain") ? t.attr("plain") == "true" : undefined), text: $.trim(t.html()), iconCls: (t.attr("icon") || t.attr("iconCls")) };
|
||||
};
|
||||
$.fn.linkbutton.defaults = { id: null, disabled: false, plain: false, text: "", iconCls: null };
|
||||
})(jQuery);
|
||||
|
||||
|
||||
(function ($) {
|
||||
function _1(_2) {
|
||||
var _3 = $.data(_2, "splitbutton").options;
|
||||
var _4 = $(_2);
|
||||
_4.removeClass("s-btn-active s-btn-plain-active");
|
||||
_4.linkbutton(_3);
|
||||
if (_3.menu) {
|
||||
$(_3.menu).menu({ onShow: function () {
|
||||
_4.addClass((_3.plain == true) ? "s-btn-plain-active" : "s-btn-active");
|
||||
}, onHide: function () {
|
||||
_4.removeClass((_3.plain == true) ? "s-btn-plain-active" : "s-btn-active");
|
||||
}
|
||||
});
|
||||
}
|
||||
_5(_2, _3.disabled);
|
||||
};
|
||||
function _5(_6, _7) {
|
||||
var _8 = $.data(_6, "splitbutton").options;
|
||||
_8.disabled = _7;
|
||||
var _9 = $(_6);
|
||||
var _a = _9.find(".s-btn-downarrow");
|
||||
if (_7) {
|
||||
_9.linkbutton("disable");
|
||||
_a.unbind(".splitbutton");
|
||||
} else {
|
||||
_9.linkbutton("enable");
|
||||
_a.unbind(".splitbutton");
|
||||
_a.bind("click.splitbutton", function () {
|
||||
_b();
|
||||
return false;
|
||||
});
|
||||
var _c = null;
|
||||
// _a.bind("mouseenter.splitbutton", function () {
|
||||
// _c = setTimeout(function () {
|
||||
// _b();
|
||||
// }, _8.duration);
|
||||
// return false;
|
||||
// })
|
||||
|
||||
_a.bind("mouseleave.splitbutton", function () {
|
||||
if (_c) {
|
||||
clearTimeout(_c);
|
||||
}
|
||||
});
|
||||
}
|
||||
function _b() {
|
||||
if (!_8.menu) {
|
||||
return;
|
||||
}
|
||||
var _d = _9.offset().left;
|
||||
if (_d + $(_8.menu).outerWidth() + 5 > $(window).width()) {
|
||||
_d = $(window).width() - $(_8.menu).outerWidth() - 5;
|
||||
}
|
||||
$("body>div.menu-top").menu("hide");
|
||||
$(_8.menu).menu("show", { left: _d, top: _9.offset().top + _9.outerHeight() });
|
||||
_9.blur();
|
||||
};
|
||||
};
|
||||
$.fn.splitbutton = function (_e, _f) {
|
||||
if (typeof _e == "string") {
|
||||
return $.fn.splitbutton.methods[_e](this, _f);
|
||||
}
|
||||
_e = _e || {};
|
||||
return this.each(function () {
|
||||
var _10 = $.data(this, "splitbutton");
|
||||
if (_10) {
|
||||
$.extend(_10.options, _e);
|
||||
} else {
|
||||
$(this).append("<span class=\"s-btn-downarrow\"> </span>");
|
||||
$.data(this, "splitbutton", { options: $.extend({}, $.fn.splitbutton.defaults, $.fn.splitbutton.parseOptions(this), _e) });
|
||||
$(this).removeAttr("disabled");
|
||||
}
|
||||
_1(this);
|
||||
});
|
||||
};
|
||||
$.fn.splitbutton.methods = { options: function (jq) {
|
||||
return $.data(jq[0], "splitbutton").options;
|
||||
}, enable: function (jq) {
|
||||
return jq.each(function () {
|
||||
_5(this, false);
|
||||
});
|
||||
}, disable: function (jq) {
|
||||
return jq.each(function () {
|
||||
_5(this, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
$.fn.splitbutton.parseOptions = function (_11) {
|
||||
var t = $(_11);
|
||||
return $.extend({}, $.fn.linkbutton.parseOptions(_11), { menu: t.attr("menu"), duration: t.attr("duration") });
|
||||
};
|
||||
$.fn.splitbutton.defaults = $.extend({}, $.fn.linkbutton.defaults, { plain: true, menu: null, duration: 100 });
|
||||
})(jQuery);
|
||||
|
||||
function applySplitButtonOverflow(containerId, innerId, menuId, itemCssSelector, buttonId) {
|
||||
//hack for the dropdown scrill
|
||||
jQuery("<div id='" + containerId + "'><div id='" + innerId + "' style='position:relative;'></div></div>").appendTo("#" + menuId);
|
||||
jQuery(itemCssSelector).each(function () {
|
||||
jQuery("#" + innerId).append(this);
|
||||
});
|
||||
|
||||
//only needed when we need to add scroll to macro menu
|
||||
var maxHeight = 500;
|
||||
var menu = jQuery("#" + menuId);
|
||||
var container = jQuery("#" + containerId);
|
||||
var menuHeight = menu.height();
|
||||
|
||||
if (menuHeight > maxHeight) {
|
||||
jQuery("<div id='" + buttonId + "' class='menudown'><span> </span></div>").appendTo("#" + menuId);
|
||||
menu.css({
|
||||
height: maxHeight,
|
||||
overflow: "hidden"
|
||||
})
|
||||
container.css({
|
||||
height: maxHeight - 20,
|
||||
overflow: "hidden"
|
||||
});
|
||||
var interval;
|
||||
jQuery("#" + buttonId).hover(function (e) {
|
||||
interval = setInterval(function () {
|
||||
var offset = jQuery("#" + innerId).offset();
|
||||
var currentTop = jQuery("#" + innerId).css("top").replace("px", "");
|
||||
if (Number(currentTop) > -(menuHeight - 40)) {
|
||||
jQuery("#" + innerId).css("top", currentTop - 20);
|
||||
}
|
||||
}, 125);
|
||||
}, function () {
|
||||
clearInterval(interval);
|
||||
});
|
||||
|
||||
jQuery("#" + buttonId).hover(function (e) {
|
||||
jQuery("#" + innerId).css("top", 0)
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
.sbPlaceHolder
|
||||
{
|
||||
display:inline;
|
||||
width:90px;
|
||||
height:23px;
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
.sbLink
|
||||
{
|
||||
vertical-align:top;
|
||||
}
|
||||
|
||||
.menudown
|
||||
{
|
||||
|
||||
clear:both;
|
||||
text-align: center;
|
||||
cursor:pointer;
|
||||
|
||||
}
|
||||
|
||||
.menudown span
|
||||
{
|
||||
background:url('images/splitbutton_downarrow.png') no-repeat 0px 0px;
|
||||
|
||||
}
|
||||
.menudown:hover
|
||||
{
|
||||
background-color:#DDD;
|
||||
}
|
||||
a.l-btn{
|
||||
color:#444;
|
||||
font-size:12px;
|
||||
text-decoration:none;
|
||||
display:inline-block;
|
||||
zoom:1;
|
||||
height:24px;
|
||||
padding-right:18px;
|
||||
cursor:pointer;
|
||||
outline:none;
|
||||
}
|
||||
a.l-btn-plain{
|
||||
background:transparent;
|
||||
padding-right:5px;
|
||||
border:1px solid transparent;
|
||||
_border:0px solid #efefef;
|
||||
_padding:1px 6px 1px 1px;
|
||||
}
|
||||
|
||||
|
||||
a.l-btn span.l-btn-left{
|
||||
display:block;
|
||||
padding:4px 0px 4px 18px;
|
||||
line-height:16px;
|
||||
}
|
||||
a.l-btn-plain span.l-btn-left{
|
||||
background:transparent;
|
||||
padding-left:5px;
|
||||
}
|
||||
|
||||
a.l-btn span span.l-btn-text{
|
||||
display:inline-block;
|
||||
height:16px;
|
||||
line-height:16px;
|
||||
padding:0px;
|
||||
}
|
||||
a.l-btn span span span.l-btn-empty{
|
||||
display:inline-block;
|
||||
padding:0px;
|
||||
width:16px;
|
||||
}
|
||||
a:hover.l-btn{
|
||||
background-position: bottom right;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
a:hover.l-btn-plain{
|
||||
border:1px solid #4b4b6f;
|
||||
background:url('images/splitbutton_hover.png') repeat-x left bottom;
|
||||
_padding:0px 5px 0px 0px;
|
||||
}
|
||||
a:hover.l-btn-disabled{
|
||||
background-position:top right;
|
||||
}
|
||||
a:hover.l-btn-disabled span.l-btn-left{
|
||||
background-position:top left;
|
||||
}
|
||||
|
||||
.menu{
|
||||
position:absolute;
|
||||
background-color:#f0f0f0;
|
||||
margin:0;
|
||||
padding:2px;
|
||||
border: 1px solid #979797;
|
||||
overflow:hidden;
|
||||
}
|
||||
.menu-item{
|
||||
position:relative;
|
||||
margin:0;
|
||||
padding:0;
|
||||
height:22px;
|
||||
line-height:20px;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
cursor:pointer;
|
||||
border:1px solid transparent;
|
||||
_border:1px solid #f0f0f0;
|
||||
}
|
||||
.menu-text{
|
||||
position:absolute;
|
||||
left:2px;
|
||||
top:0px;
|
||||
}
|
||||
.menu-icon{
|
||||
position:absolute;
|
||||
width:16px;
|
||||
height:16px;
|
||||
top:3px;
|
||||
left:2px;
|
||||
}
|
||||
|
||||
|
||||
.menu-active{
|
||||
border: 1px solid #a8d8eb;
|
||||
background: #dcecf3;
|
||||
}
|
||||
|
||||
|
||||
.s-btn-downarrow{
|
||||
display:inline-block;
|
||||
width:16px;
|
||||
background:url('images/splitbutton_downarrow.png') no-repeat 4px 0px;
|
||||
}
|
||||
|
||||
a.s-btn-active{
|
||||
background-position: bottom right;
|
||||
}
|
||||
a.s-btn-active span.l-btn-left{
|
||||
background-position: bottom left;
|
||||
}
|
||||
a.s-btn-active .s-btn-downarrow{
|
||||
background:url('images/splitbutton_downarrow.png') no-repeat 4px -18px;
|
||||
}
|
||||
a:hover.l-btn .s-btn-downarrow{
|
||||
background:url('images/splitbutton_downarrow.png') no-repeat 4px -18px;
|
||||
}
|
||||
|
||||
a.s-btn-plain-active{
|
||||
background:transparent;
|
||||
border:1px solid #8f8f8f;
|
||||
_padding:0px 5px 0px 0px;
|
||||
|
||||
}
|
||||
a.s-btn-plain-active .s-btn-downarrow{
|
||||
background:url('images/splitbutton_downarrow.png') no-repeat 4px -18px;
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.UI;
|
||||
using ClientDependency.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
namespace Umbraco.Web.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the 'insert macro' button when editing a template which includes the drop down list selector
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Though this would be nicer to do in a UserControl, unfortunatley the way that the ScrollingMenu control is designed it seems that
|
||||
/// we have to insert all items via code and loading a UserControl in dynamically is equally ugly.
|
||||
/// </remarks>
|
||||
[ClientDependency(ClientDependencyType.Css, "splitbutton/splitbutton.css", "UmbracoClient")]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "splitbutton/jquery.splitbutton.js", "UmbracoClient", Priority = 100)]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "splitbutton/InsertMacroSplitButton.js", "UmbracoClient", Priority = 101)]
|
||||
internal class InsertMacroSplitButton : UmbracoControl
|
||||
{
|
||||
protected LiteralControl ListContainer;
|
||||
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
EnsureChildControls();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The JS callback to display the dialog modal screen to customize the macro to be inserted into the editor if the
|
||||
/// macro has parameters.
|
||||
/// </summary>
|
||||
public string ClientCallbackOpenMacroModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The JS callback method which accepts an 'alias' parameter that is invoked when clicking the macro button
|
||||
/// to insert a macro that has no parameters.
|
||||
/// </summary>
|
||||
public string ClientCallbackInsertMacroMarkup { get; set; }
|
||||
|
||||
protected override void CreateChildControls()
|
||||
{
|
||||
base.CreateChildControls();
|
||||
|
||||
//var menuItemsId = ClientID + "menuitems";
|
||||
//var placeHolderId = ClientID + "sbPlaceholder";
|
||||
|
||||
/*create the list, similar to this, but swap the repeater for real html:
|
||||
|
||||
<div id="macroMenu" style="width: 285px">
|
||||
<asp:Repeater ID="rpt_macros" runat="server">
|
||||
<ItemTemplate>
|
||||
<div class="macro" rel="<%# DataBinder.Eval(Container, "DataItem.macroAlias")%>"
|
||||
data-has-params="<%# DoesMacroHaveSettings(DataBinder.Eval(Container, "DataItem.id").ToString()) %>">
|
||||
<%# DataBinder.Eval(Container, "DataItem.macroName")%>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</div>
|
||||
*/
|
||||
|
||||
//Create the drop down menu list first (it is hidden)
|
||||
var divMacroItemContainer = new TagBuilder("div");
|
||||
divMacroItemContainer.Attributes.Add("style", "width: 285px;display:none;");
|
||||
divMacroItemContainer.Attributes.Add("class", "sbMenu");
|
||||
|
||||
var macros = Services.MacroService.GetAll().OrderBy(x => x.Name);
|
||||
foreach (var macro in macros)
|
||||
{
|
||||
var divMacro = new TagBuilder("div");
|
||||
divMacro.AddCssClass("macro-item");
|
||||
divMacro.Attributes.Add("rel", macro.Alias);
|
||||
divMacro.Attributes.Add("data-has-params", DoesMacroHaveParameters(macro.Id).ToString().ToLower());
|
||||
divMacro.SetInnerText(macro.Name);
|
||||
divMacroItemContainer.InnerHtml += divMacro.ToString();
|
||||
}
|
||||
|
||||
/*create the button itself, similar to this:
|
||||
|
||||
<div id="splitButtonMacro" style="display: inline; height: 23px; vertical-align: top;">
|
||||
<a href="javascript:openMacroModal();" class="sbLink">
|
||||
<img alt="Insert Macro" src="../images/editor/insMacroSB.png" title="Insert Macro"
|
||||
style="vertical-align: top;">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
*/
|
||||
|
||||
var divSplitButtonWrapper = new TagBuilder("div");
|
||||
divSplitButtonWrapper.AddCssClass("sbPlaceHolder");
|
||||
divSplitButtonWrapper.Attributes.Add("id", ClientID + "sbPlaceholder");
|
||||
var divButton = new TagBuilder("div");
|
||||
divButton.Attributes.Add("style", "display: inline; height: 23px; vertical-align: top;");
|
||||
var aButton = new TagBuilder("a");
|
||||
aButton.Attributes.Add("href", "#"); //will be bound with jquery
|
||||
aButton.AddCssClass("sbLink");
|
||||
var imgButton = new TagBuilder("img");
|
||||
imgButton.Attributes.Add("alt", "Insert Macro");
|
||||
imgButton.Attributes.Add("src", this.ResolveUrl(SystemDirectories.Umbraco + "/images/editor/insMacroSB.png"));
|
||||
imgButton.Attributes.Add("title", "Insert Macro");
|
||||
imgButton.Attributes.Add("style", "vertical-align: top;");
|
||||
aButton.InnerHtml = imgButton.ToString();
|
||||
divButton.InnerHtml = aButton.ToString();
|
||||
divSplitButtonWrapper.InnerHtml = divButton.ToString();
|
||||
|
||||
ListContainer = new LiteralControl(divMacroItemContainer.ToString() + divSplitButtonWrapper.ToString());
|
||||
Controls.Add(ListContainer);
|
||||
|
||||
// Page.ClientScript.RegisterStartupScript(
|
||||
// typeof(InsertMacroSplitButton),
|
||||
// ClientID,
|
||||
// @"jQuery(document).ready(function() {
|
||||
// jQuery('#" + placeHolderId + " a.sbLink').splitbutton({menu:'#" + menuItemsId + "'}); " +
|
||||
// "});",
|
||||
// true);
|
||||
|
||||
Page.ClientScript.RegisterStartupScript(
|
||||
typeof(InsertMacroSplitButton),
|
||||
typeof(InsertMacroSplitButton).Name, //same key for all instancees, we should only render once
|
||||
@"jQuery(document).ready(function() {
|
||||
var splitButton = new Umbraco.Controls.InsertMacroSplitButton({
|
||||
openMacroModel: " + ClientCallbackOpenMacroModel + @",
|
||||
insertMacroMarkup: " + ClientCallbackInsertMacroMarkup + @"
|
||||
});
|
||||
splitButton.init();
|
||||
});",
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
private bool DoesMacroHaveParameters(int macroId)
|
||||
{
|
||||
bool hasParameters;
|
||||
using (var scope = Current.ScopeProvider.CreateScope())
|
||||
{
|
||||
hasParameters = scope.Database.ExecuteScalar<int>("SELECT COUNT(*) from cmsMacroProperty where macro=@macroId", new { macroId }) > 0;
|
||||
scope.Complete();
|
||||
}
|
||||
return hasParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1078,7 +1078,6 @@
|
||||
<Compile Include="Templates\TemplateUtilities.cs" />
|
||||
<Compile Include="Trees\PartialViewMacrosTreeController.cs" />
|
||||
<Compile Include="Trees\PartialViewsTreeController.cs" />
|
||||
<Compile Include="UI\Controls\InsertMacroSplitButton.cs" />
|
||||
<Compile Include="UI\IAssignedApp.cs" />
|
||||
<Compile Include="_Legacy\BusinessLogic\Task.cs" />
|
||||
<Compile Include="_Legacy\BusinessLogic\Tasks.cs" />
|
||||
|
||||
Reference in New Issue
Block a user