/* Authors: * Petr Vobornik * * Copyright (C) 2014 Red Hat * see file 'COPYING' for use and warranty information * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/on', '../jquery', './DropdownWidget'], function(declare, lang, on, $, DropdownWidget) { return declare([DropdownWidget], { /** * Represents and creates a dropdown widget for executing facet actions * * @class widgets.ActionDropdownWidget */ /** * Facet which contains actions * @type {facet.facet|facets.Facet} */ facet: null, /** * Names of actions, which should be later obtained from facet * @property {Array.} */ action_names: [], /** * Actions * @property {ordered_map} */ actions: [], on_item_click: function(event, item) { if (item.click) item.click(); this.emit('item-click', item); }, /** * Initializes action list * * - set facet * - get actions from facet * - init child widgets * * @param {facet.facet} facet */ init: function(facet) { var options, actions, action, name, i; this.facet = facet; if (!this.action_names) return; for (i=0; i