<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>UI Component tag</title><link>https://community.telligent.com/community/11/w/api-documentation/67201/ui-component-tag</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>UI Component tag</title><link>https://community.telligent.com/community/11/w/api-documentation/67201/ui-component-tag</link><pubDate>Wed, 20 Nov 2019 15:28:38 GMT</pubDate><guid isPermaLink="false">02738d42-cf25-45bd-a3e1-0b03614c98ee</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67201/ui-component-tag#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/20/2019 15:28:38&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;
&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_ui_components_tag" name="jQuery_telligent_evolution_ui_components_tag"&gt;&lt;/a&gt;jQuery.telligent.evolution.ui.components.tag&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which handles presentation of tagging behavior for content. Transforms the output from &lt;code&gt;$core_v2_ui.Tag()&lt;/code&gt;, which is a &lt;code&gt;&amp;lt;span class=&amp;quot;ui-tag&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; stub. The default implementation uses the [[evolutionInlineTagEditor jQuery Plugin|evolutionInlineTagEditor plugin]]. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present tagging differently.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Options" name="Options"&gt;&lt;/a&gt;Options&lt;/h3&gt;
&lt;p&gt;Data made available to instances of the component:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contenttypeid&lt;/code&gt;: (string) Content Type Id Guid&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contentid&lt;/code&gt;: (string) Content Id Guid&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tagtypeid&lt;/code&gt;: (string) Tag Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;urlformat&lt;/code&gt;: (string) URL containing a token named &lt;code&gt;{tag}&lt;/code&gt; which, when replaced with a tag name, shows other content with the same tag&lt;/li&gt;
&lt;li&gt;&lt;code&gt;readonly&lt;/code&gt;: (boolean) When true, the component should not present editing controls&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tags&lt;/code&gt;: Comma-separated list of tags currently applied to the content&lt;/li&gt;
&lt;li&gt;&lt;code&gt;selectabletags&lt;/code&gt;: Comma-separated list of optionally-selectable tags that may be presented to the user when not in read-only. These tags are already in use by other content.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;configuration&lt;/code&gt;: Object of all other keys and values passed via the options dictionary to &lt;code&gt;$core_v2_ui.Tag()&lt;/code&gt;, regardless of whether they have been pre-defined&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a id="Example" name="Example"&gt;&lt;/a&gt;Example&lt;/h3&gt;
&lt;p&gt;A barebones UI component override which would result in rendering a read-only message of &amp;#39;Tagged: [tag], [tag], [tag], [etc]&amp;#39;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.ui.components.tag = {
    setup: function() {
    },
    add: function(elm, options) {
        var message = &amp;#39;Tagged: &amp;#39;,
            renderedTagLinks = $.map(options.tags.split(&amp;#39;,&amp;#39;), function(tagName) {
                var tagUrl = options.urlformat.replace(/{tag}/, tagName);
                return  &amp;#39;&amp;lt;a href=&amp;quot;&amp;#39; + tagUrl + &amp;#39;&amp;quot;&amp;gt;&amp;#39; + tagName + &amp;#39;&amp;lt;/a&amp;gt;&amp;#39;;
            });

        $(elm).html(message + renderedTagLinks.join(&amp;#39;, &amp;#39;));
    }
};
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;&lt;a id="Default_Implementation" name="Default_Implementation"&gt;&lt;/a&gt;Default Implementation&lt;/h3&gt;
&lt;p&gt;For reference purposes or as the basis for an override:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(function($){

var formatTags = function(tagsList, urlFormat, elm) {
    var c = $(elm);
    c.html(&amp;#39;&amp;#39;);

    if (!tagsList) {
        return;
    }

    var first = true;
    $.each(tagsList.split(/,/), function(i, v) {
        var t = $.trim(v);
        if (t) {
            if (first) {
                first = false;
            } else {
                c.append(&amp;quot;, &amp;quot;);
            }
            if (!urlFormat) {
                c.append(t);
            } else {
                c.append($(&amp;#39;&amp;lt;a&amp;gt;&amp;#39;).attr(&amp;#39;rel&amp;#39;,&amp;#39;nofollow tag&amp;#39;).attr(&amp;#39;href&amp;#39;, urlFormat.replace(/{tag}/g, $.telligent.evolution.url.encodePathComponent($.telligent.evolution.html.decode(t)))).text(t));
            }
        }
    });
};

$.telligent.evolution.ui.components.tag = {
    setup: function() {
    },
    add: function(elm, options) {
        var tagsContainer = jQuery(&amp;#39;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;#39;);
        $(elm).append(tagsContainer);
        formatTags(options.tags, options.urlformat, tagsContainer);

        var editTags = null;
        if (options.readonly !== &amp;#39;true&amp;#39;) {
            editTags = $(&amp;#39;&amp;lt;a href=&amp;quot;javascript:void(0);&amp;quot; class=&amp;quot;internal-link edit-tags&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;#39;);
            $(elm).append(editTags);

            editTags.evolutionInlineTagEditor({
                allTags: $.grep(options.selectabletags.split(&amp;#39;,&amp;#39;), function(item) { return item; }),
                currentTags: $.grep(options.tags.split(&amp;#39;,&amp;#39;), function(item) { return item; }),
                onSave: function(tags, successFn) {
                    var data = {
                        Tags: tags &amp;amp;&amp;amp; tags.length &amp;gt; 0 ? tags.join(&amp;#39;,&amp;#39;) : &amp;#39;&amp;#39;,
                        ContentId: options.contentid,
                        ContentTypeId: options.contenttypeid
                    };

                    if (options.tagtypeid) {
                        data.TypeId = options.tagtypeid;
                    }

                    $.telligent.evolution.put({
                        url: $.telligent.evolution.site.getBaseUrl() + &amp;#39;api.ashx/v2/contenttags.json&amp;#39;,
                        data: data,
                        success: function(response) {
                            formatTags(data.Tags, options.urlformat, tagsContainer);
                            successFn();
                        }
                    });
                }
            });
        }
    }
};

}(jQuery));
&lt;/code&gt;&lt;/pre&gt;
&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>tag UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67201/ui-component-tag/revision/1</link><pubDate>Tue, 19 Nov 2019 20:29:22 GMT</pubDate><guid isPermaLink="false">02738d42-cf25-45bd-a3e1-0b03614c98ee</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67201/ui-component-tag#comments</comments><description>Revision 1 posted to API Documentation by Ben Tiedt on 11/19/2019 20:29:22&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_ui_components_tag" name="jQuery_telligent_evolution_ui_components_tag"&gt;&lt;/a&gt;jQuery.telligent.evolution.ui.components.tag&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which handles presentation of tagging behavior for content. Transforms the output from &lt;code&gt;$core_v2_ui.Tag()&lt;/code&gt;, which is a &lt;code&gt;&amp;lt;span class=&amp;quot;ui-tag&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; stub. The default implementation uses the [[evolutionInlineTagEditor jQuery Plugin|evolutionInlineTagEditor plugin]]. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present tagging differently.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Options" name="Options"&gt;&lt;/a&gt;Options&lt;/h3&gt;
&lt;p&gt;Data made available to instances of the component:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contenttypeid&lt;/code&gt;: (string) Content Type Id Guid&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contentid&lt;/code&gt;: (string) Content Id Guid&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tagtypeid&lt;/code&gt;: (string) Tag Type Id&lt;/li&gt;
&lt;li&gt;&lt;code&gt;urlformat&lt;/code&gt;: (string) URL containing a token named &lt;code&gt;{tag}&lt;/code&gt; which, when replaced with a tag name, shows other content with the same tag&lt;/li&gt;
&lt;li&gt;&lt;code&gt;readonly&lt;/code&gt;: (boolean) When true, the component should not present editing controls&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tags&lt;/code&gt;: Comma-separated list of tags currently applied to the content&lt;/li&gt;
&lt;li&gt;&lt;code&gt;selectabletags&lt;/code&gt;: Comma-separated list of optionally-selectable tags that may be presented to the user when not in read-only. These tags are already in use by other content.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;configuration&lt;/code&gt;: Object of all other keys and values passed via the options dictionary to &lt;code&gt;$core_v2_ui.Tag()&lt;/code&gt;, regardless of whether they have been pre-defined&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a id="Example" name="Example"&gt;&lt;/a&gt;Example&lt;/h3&gt;
&lt;p&gt;A barebones UI component override which would result in rendering a read-only message of &amp;#39;Tagged: [tag], [tag], [tag], [etc]&amp;#39;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.ui.components.tag = {
    setup: function() {
    },
    add: function(elm, options) {
        var message = &amp;#39;Tagged: &amp;#39;,
            renderedTagLinks = $.map(options.tags.split(&amp;#39;,&amp;#39;), function(tagName) {
                var tagUrl = options.urlformat.replace(/{tag}/, tagName);
                return  &amp;#39;&amp;lt;a href=&amp;quot;&amp;#39; + tagUrl + &amp;#39;&amp;quot;&amp;gt;&amp;#39; + tagName + &amp;#39;&amp;lt;/a&amp;gt;&amp;#39;;
            });

        $(elm).html(message + renderedTagLinks.join(&amp;#39;, &amp;#39;));
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;a id="Default_Implementation" name="Default_Implementation"&gt;&lt;/a&gt;Default Implementation&lt;/h3&gt;
&lt;p&gt;For reference purposes or as the basis for an override:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(function($){

var formatTags = function(tagsList, urlFormat, elm) {
    var c = $(elm);
    c.html(&amp;#39;&amp;#39;);

    if (!tagsList) {
        return;
    }

    var first = true;
    $.each(tagsList.split(/,/), function(i, v) {
        var t = $.trim(v);
        if (t) {
            if (first) {
                first = false;
            } else {
                c.append(&amp;quot;, &amp;quot;);
            }
            if (!urlFormat) {
                c.append(t);
            } else {
                c.append($(&amp;#39;&amp;lt;a&amp;gt;&amp;#39;).attr(&amp;#39;rel&amp;#39;,&amp;#39;nofollow tag&amp;#39;).attr(&amp;#39;href&amp;#39;, urlFormat.replace(/{tag}/g, $.telligent.evolution.url.encodePathComponent($.telligent.evolution.html.decode(t)))).text(t));
            }
        }
    });
};

$.telligent.evolution.ui.components.tag = {
    setup: function() {
    },
    add: function(elm, options) {
        var tagsContainer = jQuery(&amp;#39;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;#39;);
        $(elm).append(tagsContainer);
        formatTags(options.tags, options.urlformat, tagsContainer);

        var editTags = null;
        if (options.readonly !== &amp;#39;true&amp;#39;) {
            editTags = $(&amp;#39;&amp;lt;a href=&amp;quot;javascript:void(0);&amp;quot; class=&amp;quot;internal-link edit-tags&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;#39;);
            $(elm).append(editTags);

            editTags.evolutionInlineTagEditor({
                allTags: $.grep(options.selectabletags.split(&amp;#39;,&amp;#39;), function(item) { return item; }),
                currentTags: $.grep(options.tags.split(&amp;#39;,&amp;#39;), function(item) { return item; }),
                onSave: function(tags, successFn) {
                    var data = {
                        Tags: tags &amp;amp;&amp;amp; tags.length &amp;gt; 0 ? tags.join(&amp;#39;,&amp;#39;) : &amp;#39;&amp;#39;,
                        ContentId: options.contentid,
                        ContentTypeId: options.contenttypeid
                    };

                    if (options.tagtypeid) {
                        data.TypeId = options.tagtypeid;
                    }

                    $.telligent.evolution.put({
                        url: $.telligent.evolution.site.getBaseUrl() + &amp;#39;api.ashx/v2/contenttags.json&amp;#39;,
                        data: data,
                        success: function(response) {
                            formatTags(data.Tags, options.urlformat, tagsContainer);
                            successFn();
                        }
                    });
                }
            });
        }
    }
};

}(jQuery));
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>