<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>bookmark UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67176/bookmark-ui-component</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>bookmark UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67176/bookmark-ui-component</link><pubDate>Tue, 19 Nov 2019 20:28:31 GMT</pubDate><guid isPermaLink="false">af623c91-daf9-4daf-831a-190bcf9b4069</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67176/bookmark-ui-component#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:28:31&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_bookmark" name="jQuery_telligent_evolution_ui_components_bookmark"&gt;&lt;/a&gt;jQuery.telligent.evolution.ui.components.bookmark&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which handles presentation of bookmark behavior for content. Transforms the output from &lt;code&gt;$core_v2_ui.Bookmark()&lt;/code&gt;, which is a &lt;code&gt;&amp;lt;span class=&amp;quot;ui-bookmark&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; stub. The default implementation uses the [[evolutionBookmark jQuery Plugin|evolutionBookmark plugin]]. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present bookmarks 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;bookmarktypeid&lt;/code&gt;: (string) Type Id Guid&lt;/li&gt;
&lt;li&gt;&lt;code&gt;value&lt;/code&gt;: (string) If the content is bookmarked or not by the accessing user (&lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contenttypename&lt;/code&gt;: (string) Type name for this content&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;Bookmarked? Yes/No&amp;#39; for a given call to &lt;code&gt;$core_v2_ui.Bookmark()&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.ui.components.rate = {
    setup: function() {
    },
    add: function(elm, options) {
        $(elm).html(&amp;#39;Bookmarked? &amp;#39; + (options.value == &amp;#39;true&amp;#39; ? &amp;#39;Yes&amp;#39; : &amp;#39;No&amp;#39;));

        console.log(&amp;#39;ContentId: &amp;#39; + options.contentid);
        console.log(&amp;#39;ContentTypeId: &amp;#39; + options.contenttypeid);
        console.log(&amp;#39;TypeId: &amp;#39; + options.bookmarktypeid);
        console.log(&amp;#39;Value: &amp;#39; + options.value);
        console.log(&amp;#39;ContentTypeName: &amp;#39; + options.contenttypename);
    }
}
&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;$.telligent.evolution.ui.components.bookmark = {
    setup: function() {
    },
    add: function(elm, options) {

        elm.empty();

        var config = {
            contentId: options.contentid,
            contentTypeId: options.contenttypeid,
            typeId: options.bookmarktypeid,
            initialState: options.value == &amp;#39;true&amp;#39;,
            contentTypeName: options.contenttypename,
            onBookmark: function(contentId, contentTypeId, typeId, complete) {
                $.telligent.evolution.post({
                    url: $.telligent.evolution.site.getBaseUrl() + &amp;#39;api.ashx/v2/bookmark.json?ContentId={ContentId}&amp;amp;ContentTypeId={ContentTypeId}&amp;#39; + (typeId ? &amp;#39;&amp;amp;TypeId=&amp;#39; + typeId : &amp;#39;&amp;#39;),
                    data: {
                        ContentId: contentId,
                        ContentTypeId: contentTypeId
                        },
                    dataType: &amp;#39;json&amp;#39;,
                    success: function(response) { complete(); }
                });
            },
            onUnbookmark: function(contentId, contentTypeId, typeId, complete) {
                $.telligent.evolution.del({
                    url: $.telligent.evolution.site.getBaseUrl() + &amp;#39;api.ashx/v2/bookmark.json?ContentId={ContentId}&amp;#39; + (typeId ? &amp;#39;&amp;amp;TypeId=&amp;#39; + typeId : &amp;#39;&amp;#39;),
                    data: {
                        ContentId: contentId
                        },
                    dataType: &amp;#39;json&amp;#39;,
                    success: function(response) { complete(); }
                });
            }
        };

        if (options.configuration.deleteBookmarkText) { config.deleteBookmarkText = options.configuration.deleteBookmarkText; }
        if (options.configuration.addBookmarkText) { config.addBookmarkText = options.configuration.addBookmarkText; }
        if (options.configuration.processingText) { config.processingText = options.configuration.processingText; }
        if (options.configuration.addBookmarkCssClass) { config.addBookmarkCssClass = options.configuration.addBookmarkCssClass; }
        if (options.configuration.deleteBookmarkCssClass) { config.deleteBookmarkCssClass = options.configuration.deleteBookmarkCssClass; }
        if (options.configuration.processingCssClass) { config.processingCssClass = options.configuration.processingCssClass; }

        $(elm).evolutionBookmark(config);
    }
};
&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>