app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js in activeadmin_trumbowyg-0.1.8 vs app/assets/javascripts/activeadmin/trumbowyg/plugins/mention/trumbowyg.mention.js in activeadmin_trumbowyg-0.2.0

- old
+ new

@@ -10,35 +10,43 @@ (function ($) { 'use strict'; var defaultOptions = { - source: '', + source: [], formatDropdownItem: formatDropdownItem, formatResult: formatResult }; $.extend(true, $.trumbowyg, { langs: { + // jshint camelcase:false en: { mention: 'Mention' }, da: { mention: 'Nævn' }, fr: { - mention: 'Mentioner' + mention: 'Mentionner' }, ru: { mention: 'Упомянуть' }, tr: { mention: 'Bahset' }, zh_tw: { mention: '標記' }, + pt_br: { + mention: 'Menção' + }, + ko: { + mention: '언급' + }, + // jshint camelcase:true }, plugins: { mention: { init: function (trumbowyg) { @@ -55,35 +63,32 @@ }); /** * Build dropdown list * - * @param {Array} items Items - * @param {object} trumbowyg Editor + * @param {Array} items Items + * @param {object} trumbowyg Editor * - * @return {Array} + * @return {Array} */ function buildDropdown(items, trumbowyg) { var dropdown = []; - // Check if source is an array - if (items.constructor === Array) { - $.each(items, function (i, item) { - var btn = 'mention-' + i, - btnDef = { - hasIcon: false, - text: trumbowyg.o.plugins.mention.formatDropdownItem(item), - fn: function () { - trumbowyg.execCmd('insertHTML', trumbowyg.o.plugins.mention.formatResult(item)); + $.each(items, function (i, item) { + var btn = 'mention-' + i, + btnDef = { + hasIcon: false, + text: trumbowyg.o.plugins.mention.formatDropdownItem(item), + fn: function () { + trumbowyg.execCmd('insertHTML', trumbowyg.o.plugins.mention.formatResult(item)); - return true; - } - }; + return true; + } + }; - trumbowyg.addBtnDef(btn, btnDef); - dropdown.push(btn); - }); - } + trumbowyg.addBtnDef(btn, btnDef); + dropdown.push(btn); + }); return dropdown; } /**