Exemplo n.º 1
0
        /// <summary>
        /// Configures a jquery UI Tabs with the provided selector
        /// </summary>
        /// <param name="selector">The jQuery selector</param>
        /// <param name="otherOptions">Add options to the tabs</param>
        /// <param name="includeScriptTag">Determines whether to include the script tag</param>
        /// <param name="selectFunction">The function to be called when a tab is selected. Receives two parameters (event, ui)</param>
        public string MakeJQTabs(string selector, string selectFunction, JSObject otherOptions, bool includeScriptTag)
        {
            var options = new JSObject();
            if (!string.IsNullOrEmpty(selectFunction)) options.Add("select", selectFunction);
            if (otherOptions != null) options.Merge(otherOptions);

            var builder = options.IsEmpty() ? JQ.Select(selector).AddCommand("tabs()") :
                                              JQ.Select(selector).AddCommand("tabs(" + options + ")");
            return includeScriptTag ? builder.ToScriptBlock()
                                    : builder.ToString();
        }