/** * (c) Copyright by authors of the Tiki Wiki CMS Groupware Project * * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. * $Id$ * * Handles list plugin GUI */ // event for plugin list $(document) .off('plugin_list_ready') .on('plugin_list_ready', function (params) { var $textarea = params.modal.find("textarea[name=content]"); jqueryTiki.plugins.list.setup($textarea); }); $(document).ready(function () { jqueryTiki.plugins = jqueryTiki.plugins || {}; jqueryTiki.plugins.list = { /** * Local data */ current: {}, fields: {}, plugins: {}, objectType: null, $editor: null, /** * Main GUI setup * * @param $textarea */ setup: function ($textarea) { var gui = this; gui.current = {}; gui.fields = {}; gui.plugins = {}; gui.trackers = {}; gui.objectType = null; gui.sortableOptions = { listType: "ul", maxLevels: 2, handle: "div:first", items: "li", disableNesting: "no-nesting" }; // display GUI interface here gui.$editor = $("
") .addClass('plugin-list-editor clearfix'); var buildMainToolbar = function () { var $tb = $("
") .addClass("btn-toolbar") .append( gui.buildToolBar(gui.plugins, "", "", function () { if ($(this).data("plugin")) { var params = []; if ($(this).data("value")) { params[$(this).data("value")] = ""; } $ul.append( gui.addPlugin({ name: $(this).data("plugin"), params: params, plugins: [] }) ).nestedSortable(gui.sortableOptions); return false; } $(".dropdown-menu", $tb).hide(); }) ); $(".dropdown-toggle", $tb).removeClass("btn-link btn-sm").addClass("btn-primary btn-sm"); return $tb; }; var $toolbar = buildMainToolbar(); gui.$editor.append($toolbar); var $ul = $("